In your command line enter:
D:\>mvn archetype:generate -DgroupId=de.consulting.it.harder -DartifactId=java-project -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
This will create a basic Maven project from scratch.
Update your POM with the following properties to define the Compiler:
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
Define JUnit as your first dependency for Testing with scope "test":
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
I suggest Hamcrest, if you do not know it yet:
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all -->
</dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
If you want to package as executable JAR:
$ mvn clean package
If you want to start the JAR:
$ java -jar <your jar file name here>
Here is the POM with all attributes for executable JARs: Download Example POM
If you want to package as executable JAR:
$ mvn clean package
If you want to start the JAR:
$ java -jar <your jar file name here>
Keine Kommentare:
Kommentar veröffentlichen