quote

martedì, novembre 25, 2014

Create a simple maven project


$ mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart 

It works in interactive mode, so you will be asked to type groupId, atifactId and so on.
Here how to create a webapp template from the maven archetype plugin in not interactive mode.
$ mvn archetype:generate -DgroupId=org.enricogiurin.poc -DartifactId=maven-usage -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
Resources:
https://maven.apache.org/archetype/maven-archetype-bundles/maven-archetype-quickstart/
http://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven/
http://maven.apache.org/guides/mini/guide-building-for-different-environments.html
http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html

To make compatible with java 8, add this:


<plugin>    
<groupId>org.apache.maven.plugins</groupId>    
<artifactId>maven-compiler-plugin</artifactId>    
<version>2.3.2</version>
<configuration>
<source>1.8</source>        
<target>1.8</target>    
</configuration>
</plugin>