Normally, -D is used to specify a system property to the JVM. However, when I 
check out the following invocation of the archetype plugin:

mvn archetype:generate -DgroupId=com.mycompany -DartifactId=SampleApp 
-DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

The invocation is like:

java
        -classpath 
/usr/local/apache-maven-3.3.9/boot/plexus-classworlds-2.5.2.jar
        -Dclassworlds.conf=/usr/local/apache-maven-3.3.9/bin/m2.conf
        -Dmaven.home=/usr/local/apache-maven-3.3.9
        
-Dmaven.multiModuleProjectDirectory=/Users/username/Documents/Maven_Archetype_Test
        org.codehaus.plexus.classworlds.launcher.Launcher archetype:generate
        -DgroupId=com.mycompany
        -DartifactId=SampleApp
        -DarchetypeArtifactId=maven-archetype-webapp
        -DinteractiveMode=false

Options coming after the class name (i.e, after 
"org.codehaus.plexus.classworlds.launcher.Launcher”) are passed to the main 
method of the application. Hence, the options

        -DgroupId=com.mycompany
        -DartifactId=SampleApp
        -DarchetypeArtifactId=maven-archetype-webapp
        -DinteractiveMode=false

are not sent to the JVM but to 
org.codehaus.plexus.classworlds.launcher.Launcher. Yet, these options 
“masquerade” as JVM options (unless these options are not set to be System 
Properties in Launcher class or somewhere else).

I wonder the reason for this. Why not simply specify the arguments as

        -groupId=com.mycompany
        -artifactId=SampleApp
        -archetypeArtifactId=maven-archetype-webapp
        -interactiveMode=false

but as

        -DgroupId=com.mycompany
        -DartifactId=SampleApp
        -DarchetypeArtifactId=maven-archetype-webapp
        -DinteractiveMode=false

?

Regards
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to