Step1:
mvn archetype:create \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DgroupId=com.test \
-DartifactId=VanillaProject
This creates a project "VanillaProject" with pom.xml (as below) and class App.java in package com.test & a JUnit testcase for the class.
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
With Project Folder structure:
Step 2:
App.java (modified with System.out.println):
package com.test;
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
if(args!=null)
System.out.println( args[0]+"::"+args[1] );
}
}
2. Run the pom.xml to compile & test
mvn install
3. This compiles to get App.class. Now, run the class file
mvn exec:java -Dexec.mainClass="com.test.App" -Dexec.args="Arg0 Arg1"
No comments:
Post a Comment