Create maven archetype project

A simple maven archetypes with most common set of libraries, configured property files and some boiler plate code that you often copy past in every project can be of great help. I had similar requirements and here I am sharing my experience of creating a maven archetype project.

The source code is available here
Java-maven-archetype-github

All the dependencies and properties define in pom.xml will be included in the generated project.
java-maven-archetype\src\main\resources\archetype-resources\pom.xml

Interesting to look how to include the properties and properties with default values

 ${project.basedir}/src/main/resources/app.properties

And if you look at the app.properties file ${property1} will be asked while generating the project.

property1=${property1}

Now to install this archetype locally do

#mvn install

And to create a project out of it do

#mvn archetype:generate -DarchetypeGroupId=com.asciimango.app  -DarchetypeArtifactId=hello-app-archetype -DarchetypeVersion=1.0.0-SNAPSHOT -DgroupId=com.test.app  -DartifactId=testapp

That’s it then wish you happy coding in the newly generated project.

One thought on “Create maven archetype project

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s