Agile, maven

Maven generate archetype

Recently, a colleague and myself decided to brushing some dust off some maven archetypes we created for our employer to fasilitate kick-start development in projects of similar type. Things went smoothly until we hit a problem which wasn´t easily solvable. Searching for a possible solution to this problem on the web, we then discovered that using mvn archetype:create-from-project plugin would give us a great starting point for creating a better archetype.

The steps we went through were as follows:

Generate the arhetype from a project

From the root folder of the working project run the command

mvn archetype:create-from-project

This will create the archetype based on the project it was generated from. Next step, install the archetype…

Tailor the archetype to meet your needs

We wanted to create an archetype that we could use again and again so we needed to tailor the archetype a bit to make it re-usable. This was of course a highly iterative process, we made some changes, installed the archetype (see next step) and generated a test project.

Install the archetype

Move to the generated archetype and run:

mvn install

This will install the archetype so that it can be used to generate new projects. Now you can use the archetype:

Use the archetype

Navigate to the folder where you want to create your new project and type the command

mvn archetype:generate -DarchetypeCatalog=local

You will be prompted for information about the project you are creating, amongst other you need to specify the groupId and artifactId.

After a couple of dozens attempts we finally had something that we were satisfied with. Now our archetype sets up a spring server component with one spring web service set up and exposed, a test client (spring ws that too) and a fitnesse server which tests the web service. The component runs in a jetty container and can be started from both eclipse and from the command line.


Maven archetype:create-from-project documentation


2 thoughts on “Maven generate archetype

  1. Nulled Scripts – Top Brands 2k12 – superior software…

    During my study fro 64 and 32 suggestion operating system I rest many people inconsistent about what computer they should purchase or what bit system they should pick out…I invent this article should be a crucial help for people to on the reprove machine destined for their use.

    [url=]nulled scripts[/url]

Leave a Reply

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

You are commenting using your 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 )


Connecting to %s