Create a Project with Maven for Eclipse
December 7, 2010 Leave a Comment
Install & configure Maven from http://maven.apache.org/download.html.
Go to eclipse workspace and run the following command
mvn archetype:create -DgroupId=com.mycompany.projectname -DartifactId=projectname -DarchetypeArtifactId=maven-archetype-webapp
-DartifactId is your project name and -DgrouipId is your package.
Change the ‘com.mycompany.app’ and ‘my-app’ as you want them to be.
The command will download necessary poms & jars and create the folder architecture with a very basic pom.xml file.
Now, we will make it an eclipse project so that we can import it from eclipse. Go to the project folder. Run
cd my-app mvn eclipse:eclipse -Dwtpversion=2.0
This will generate eclipse .classpath & .project file. So open eclipse and just import the project.
To make a web project change jar to war in pom.xml and run
mvn eclipse:clean eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true -Dwtpversion=2.0
Refer this article for more.
Advertisement