No edit summary |
|||
| Line 9: | Line 9: | ||
mvn --version | mvn --version | ||
</syntaxhighlight>Get maven to generate a test hello world archetype project:<syntaxhighlight lang="bash"> | </syntaxhighlight>Get maven to generate a test hello world archetype project:<syntaxhighlight lang="bash"> | ||
mvn archetype:generate -DgroupId= | mvn archetype:generate -DgroupId=test.hello -DartifactId=hello-maven -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false | ||
</syntaxhighlight>run a test with maven on the project<syntaxhighlight lang="bash"> | </syntaxhighlight>run a test with maven on the project<syntaxhighlight lang="bash"> | ||
mvn test | mvn test | ||
| Line 15: | Line 15: | ||
mvn package | mvn package | ||
</syntaxhighlight>run the compiled package<syntaxhighlight lang="bash"> | </syntaxhighlight>run the compiled package<syntaxhighlight lang="bash"> | ||
java -cp target/hello-maven-1.0-SNAPSHOT.jar | java -cp target/hello-maven-1.0-SNAPSHOT.jar test.hello.App | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 12:14, 10 September 2024
Install Maven
sudo yum -y update
sudo yum install java-1.8.0-openjdk -y
sudo yum install maven -y
test to see if installed correctly:
mvn --version
Get maven to generate a test hello world archetype project:
mvn archetype:generate -DgroupId=test.hello -DartifactId=hello-maven -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
run a test with maven on the project
mvn test
Compile the hello world app into a package after test is successful:
mvn package
run the compiled package
java -cp target/hello-maven-1.0-SNAPSHOT.jar test.hello.App