Maven Project Compilation Output

Q

Where is the compilation output of my "hello" Maven project? I just finished the "mvn package" command.

✍: FYIcenter.com

A

After fixing the JDK version issue in the pom.xml, you should run "mvn package" again to compile the "hello" project:

C:\fyicenter>cd hello

C:\fyicenter\hello>\fyicenter\apache-maven-3.5.4\bin\mvn package

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------ com.fyicenter:hello >-------------------------
[INFO] Building hello 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\fyicenter\hello\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ hello ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\fyicenter\hello\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hello ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\fyicenter\hello\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ hello ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\fyicenter\hello\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ hello ---
Downloading from central: https://repo.maven.apache.org/maven2
   /org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.pom
...
Downloading from central: https://repo.maven.apache.org/maven2
   /surefire/surefire-junit3/2.12.4/surefire-junit3-2.12.4.jar

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.fyicenter.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hello ---
Downloading from central: https://repo.maven.apache.org/maven2
   /org/apache/maven/maven-archiver/2.5/maven-archiver-2.5.pom
...
Downloading from central: https://repo.maven.apache.org/maven2
   /org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.jar

[INFO] Building jar: C:\fyicenter\hello\target\hello-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:11 min
[INFO] ------------------------------------------------------------------------

The output tells you that the output of the compilation is a JAR file located at .\target\hello-1.0-SNAPSHOT.jar

The "mvn package" command actually performed JUnit tests using the default com.fyicenter.AppTest.java code.

You can verify the output JAR file by running the "java" command:

C:\fyicenter\hello>java -cp target/hello-1.0-SNAPSHOT.jar com.fyicenter.App

Hello World!

 

"maven-archetype-quickstart" - Default Java Code

pom.xml - Maven Project File

Using Apache Maven

⇑⇑ FAQ for Apache Maven

2018-11-09, 158👍, 0💬