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.

About: Muhammad Ali

I am a Java and Tibco expert. I have Master's degree in software engineering of distributed systems from Royal Institute of technology KTH Stockholm Sweden and I am an expert software engineer and integrator with over a decade of industry experience from Europe, Gulf and Asia regions. I am a strong opensource believer and encourage "sharing as caring" principle.


One thought on “Create maven archetype project”

Comments are closed.