mavenbook> mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch05 \ -DartifactId=simple-webapp \ -DpackageName=org.sonatype.mavenbook \ -DarchetypeArtifactId=maven-archetype-webapp
<plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <configuration> <connectors> <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> <port>80</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> </configuration> </plugin> </plugins>
Specify the compiler version:
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins>
To execute a class directly, use the -Dexec.mainClass=com. ... .Clazz Maven target. Executing the maven help target on the exec plugin (the first command below) results in maven retrieving forty or so additional downloads but, when help finally appears, we eventually find that -DcommandlineArgs allows parameters to be specified.
mvn help:describe -Dplugin=exec -Dfull mvn exec:java -Dexec.mainClass=com.sonatype.maven.weather.Main \ -DcommandlineArgs=75035