go to  ForumEasy.com   
JavaPro
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Let's run it!
 
Subject: Let's run it!
Author: Alex_Raj
In response to: Build Java project
Posted on: 03/26/2012 12:24:41 AM

You may test the newly compiled and packaged JAR with the following command:

java -cp ./target/MyProject-1.0-SNAPSHOT.jar com.mycompany.App

Which will print:
Hello World!



 

> On 03/26/2012 12:10:57 AM Alex_Raj wrote:

With the pom.xml file being available, you can build your Java project's package (jar) by:
mvn package


The output is as follows:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProject 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ MyProject
---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\HelloWorld\Maven\MyProject\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ MyProject ---

[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. b
uild is platform dependent!
[INFO] Compiling 1 source file to C:\HelloWorld\Maven\MyProject\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ My
Project ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\HelloWorld\Maven\MyProject\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ MyPro
ject ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. b
uild is platform dependent!
[INFO] Compiling 1 source file to C:\HelloWorld\Maven\MyProject\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ MyProject ---
[INFO] Surefire report directory: C:\HelloWorld\Maven\MyProject\target\surefire-reports

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

Results :

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

[INFO]
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ MyProject ---
[INFO] Building jar: C:\HelloWorld\Maven\MyProject\target\MyProj
ect-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.248s
[INFO] Finished at: Sun Mar 25 21:55:38 PDT 2012
[INFO] Final Memory: 10M/121M
[INFO] ------------------------------------------------------------------------





References:

 


 
Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
 
Get your own forum today. It's easy and free.