Skip to content

Instantly share code, notes, and snippets.

@gbalbuena
Created January 23, 2020 00:13
Show Gist options
  • Save gbalbuena/72b91929c0c6f72d9e78d5f9ed088b4d to your computer and use it in GitHub Desktop.
Save gbalbuena/72b91929c0c6f72d9e78d5f9ed088b4d to your computer and use it in GitHub Desktop.
basic maven and makefile to compile build and test java projects
build:
docker run -it --rm -v "$(shell pwd)":/usr/src/app -w /usr/src/app maven:3-jdk-8-openj9 mvn clean package
test:
docker run -it --rm -v "$(shell pwd)":/usr/src/app -w /usr/src/app maven:3-jdk-8-openj9 mvn test
run:
docker run -it --rm -v "$(shell pwd)":/usr/src/app -w /usr/src/app maven:3-jdk-8-openj9 java -jar target/*.jar
.PHONY: build test run
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>au.com.dius</groupId>
<artifactId>project</artifactId>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<mainClass>com.dius.bowling.Run</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment