Matt RaibleMatt Raible is a Java Champion and Developer Advocate at Okta.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

Maven 2 Archetypes get a much needed improvement

Yesterday, a new version of the Maven Archetype Plugin was released. This release incorporates many of the improvements that were developed in a different project - code named "Archetype NG". The two major improvements are 1) you only have to use "mvn archetype:create" now and 2) you can create archetypes from existing projects.

I haven't tried #2, but #1 seems to work pretty well (especially since AppFuse archetypes are the first 9 ;-)).

powers:~ mraible$ mvn archetype:create
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:create] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:create
[INFO] No goals needed for project - skipping
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] [archetype:create]
Choose archetype:
1: internal -> appfuse-basic-jsf (AppFuse archetype for creating a web application with Hibernate, Spring and JSF)
2: internal -> appfuse-basic-spring (AppFuse archetype for creating a web application with Hibernate, Spring and Spring MVC)
3: internal -> appfuse-basic-struts (AppFuse archetype for creating a web application with Hibernate, Spring and Struts 2)
4: internal -> appfuse-basic-tapestry (AppFuse archetype for creating a web application with Hibernate, Spring and Tapestry 4)
5: internal -> appfuse-core (AppFuse archetype for creating a jar application with Hibernate and Spring and XFire)
6: internal -> appfuse-modular-jsf (AppFuse archetype for creating a modular application with Hibernate, Spring and JSF)
7: internal -> appfuse-modular-spring (AppFuse archetype for creating a modular application with Hibernate, Spring and Spring MVC)
8: internal -> appfuse-modular-struts (AppFuse archetype for creating a modular application with Hibernate, Spring and Struts 2)
9: internal -> appfuse-modular-tapestry (AppFuse archetype for creating a modular application with Hibernate, Spring and Tapestry 4)
10: internal -> maven-archetype-j2ee-simple (A simple J2EE Java application)
11: internal -> maven-archetype-marmalade-mojo (A Maven plugin development project using marmalade)
12: internal -> maven-archetype-mojo (A Maven Java plugin development project)
13: internal -> maven-archetype-portlet (A simple portlet application)
14: internal -> maven-archetype-profiles ()
15: internal -> maven-archetype-quickstart ()
16: internal -> maven-archetype-site-simple (A simple site generation project)
17: internal -> maven-archetype-site (A more complex site project)
18: internal -> maven-archetype-webapp (A simple Java web application)
19: internal -> struts2-archetype-starter (A starter Struts 2 application with Sitemesh, DWR, and Spring)
20: internal -> struts2-archetype-blank (A minimal Struts 2 application)
21: internal -> struts2-archetype-portlet (A minimal Struts 2 application that can be deployed as a portlet)
22: internal -> struts2-archetype-dbportlet (A starter Struts 2 portlet that demonstrates a simple CRUD interface with db backing)
23: internal -> struts2-archetype-plugin (A Struts 2 plugin)
24: internal -> shale-archetype-blank (A blank Shale web application with JSF)
25: internal -> maven-adf-archetype (Archetype to ease the burden of creating a new application based with ADF)
26: internal -> data-app (A new Databinder application with sources and resources.)
27: internal -> jini-service-archetype (Archetype for Jini service project creation)
28: internal -> softeu-archetype-seam (JSF+Facelets+Seam Archetype)
29: internal -> softeu-archetype-seam-simple (JSF+Facelets+Seam (no persistence) Archetype)
30: internal -> softeu-archetype-jsf (JSF+Facelets Archetype)
31: internal -> jpa-maven-archetype (JPA application)
32: internal -> spring-osgi-bundle-archetype (Spring-OSGi archetype)
33: internal -> confluence-plugin-archetype (Atlassian Confluence plugin archetype)
34: internal -> maven-archetype-har (Hibernate Archive)
35: internal -> maven-archetype-sar (JBoss Service Archive)
36: internal -> wicket-archetype-quickstart (A simple Apache Wicket project)
Choose a number:  (1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30/31/32/33/34/35/36): 3
71K downloaded
Define value for groupId: :
Define value for artifactId: : myapp
Define value for version: : 1.0-SNAPSHOT
Define value for package: : war
Confirm properties configuration:
artifactId: myapp
version: 1.0-SNAPSHOT
package: war
 Y: : Y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating OldArchetype: appfuse-basic-struts:2.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value:
[INFO] Parameter: packageName, Value: war
[INFO] Parameter: basedir, Value: /Users/mraible
[INFO] Parameter: package, Value: war
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: artifactId, Value: myapp
...{suppressed hundreds of Velocity warnings}...
[INFO] OldArchetype created in dir: /Users/mraible/myapp
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 43 seconds
[INFO] Finished at: Sat Feb 09 14:39:11 MST 2008
[INFO] Final Memory: 7M/511M
[INFO] ------------------------------------------------------------------------
powers:~ mraible$

There's some typos (duplicate colons) in the prompts, but this is an alpha release, so I don't see any problem with that. I wonder where this list of archetypes is stored? We need to change the default version of AppFuse from 2.0 to 2.0.1.

Posted in Java at Feb 09 2008, 03:20:00 PM MST 15 Comments

I asked to Raphaƫl on the vote thread and he replied:

The main list is the internal catalog.
It is also possible to define a specific catalog by -DarchetypeCatalog= the catalog is an xml file located at the root and called archetype-catalog.xml.

The process that populates a catalog during deploy. is not currently working.


Posted by Arnaud HERITIER on February 09, 2008 at 04:50 PM MST #

The sources of the archetypes are pluggable. The default catalog is a simple XML file that is stored within Archetype itself. We originally had a source that was a page in our Wiki, but the Confluence instance on Codehaus craps out way too often so I extracted the content and put it in simple XML file. A source that we (Sonatype) have created is a repository manager source that we integrated into M2Eclipse. So we consult the the repository index produced by Nexus (Proximity on steroids) within Eclipse to present the user with a list of Archetypes that are available in the repository. So there is currently an implementation for a Confluence source (not recommended on a high load site), a Nexus source, and a simple XML source. We'll be demonstrating Nexus this coming Friday in Mountain View. Check out the user list for details.

Posted by Jason van Zyl on February 09, 2008 at 09:28 PM MST #

I try to create a custom catalog (because previous command no more work), for scala and lift project (that are on the wiki page since 2 month). but it failed :( I think every archetypes not listed in the internal could not be used.

Posted by David Bernard on February 10, 2008 at 03:09 PM MST #

This is a great improvement for the command-line users.

Friends of IDE integration have had the ability to choose from the same list for some time now. Q for eclipse has a pluggable architecture for declaring archetype sources (quite similar to the archetype catalogs in this new version of the plug-in).

I think its great to see this usability improvements going down into the maven "core" components.

Posted by Abel Muiño on February 11, 2008 at 07:51 AM MST #

I am having a bit of trouble using my own archetypes. I have an internal repository manager and have created archetypes for various components. Is anyone using the new archetype plugin to use existing custom archetypes (not in maven-archetypes)? I just gained a (might I say a little klunky) menu interface, but I lost the ability to use my own archetypes. To be quite honest, I am a bit surprised that the decision was made to alter the default behavior when things like the archetypeArtifactId are specified - I already specified what I wanted, yet it asks me to enter a number. If anyone knows how to work around this I would greatly appreciate the help.

Posted by Brent Atkinson on February 11, 2008 at 09:06 PM MST #

Brent - it looks like you're right. This new version of the archetype plugin breaks compatibility with the old version. It prompts me for both version and package. It should default both of these values to what's specified in the archetype (1.0-SNAPSHOT and war). Try any of the "archetype:create" on the AppFuse QuickStart to reproduce.

I've entered an issue in JIRA for this: ARCHEENGINE-127

Posted by Matt Raible on February 11, 2008 at 10:11 PM MST #

@Brett until those issue will be fixed, I suggest to workaround :
  • using the old plugin
  • create a local archetype-catalog.xml (under ~/.m2/archetype-catalog.xml) (file://... and http://... don't work)

Posted by David Bernard on February 12, 2008 at 01:53 AM MST #

Thank you David and Matt both. I will give the catalog workaround a try. I figured by specifying the older plugin version I could probably get it to work, but I thought this was my issue and I wanted to fix my archetypes to make them work. If the plugin now expects a totally different setup to use custom archetypes I am ok with that (ie. the catalogs), but I am discouraged it all magically broke. I fought with it a little while thinking maybe something I did broke them. I was surprised to find that a newer version of the archetype plugin was released that would totally break the main usage pattern (up to this point anyway) for using maven archetypes. Anyway, I am glad that people like you two are on the prowl - you saved me from thinking I was crazy - well ok not totally, but mostly. :D

Posted by Brent Atkinson on February 12, 2008 at 08:34 AM MST #

Hi there

having trouble with the new archetype mechanism, like not being able to use the archetype-archetype plugin (its not in the list).

Is it possible to make it backwardly compatable with the old way?

Also i have been trying to find out about how to use it in the new way, but it seems that none of the documentation has been updated, and all the links on are dead.

Is this known about?


Posted by Mark Miller on February 18, 2008 at 07:44 AM MST #


I am not 100% certain what exactly you are trying to accomplish from your post, but after the archetype plugin was updated with this new functionality it essentially broke the old archetype usage. For example, you can no longer invoke the plugin as you used to be able to. Also, the new version of the plugin, which uses an xml catalog file to generate the new menu functionality doesn't support custom catalogs fully. I haven't verified it yet, but it was previously stated that you can create an archetype-catalog.xml file listing your desired archetypes and install it in the root of your ~/.m2 directory. This should enable you to run the new plugin and have your archetypes available in the menu.

It seems that the new archetype plugin was published as a release a little prematurely as it doesn't fully support the old way of doing things, and also doesn't fully support an alternative way of doing things. Also, as you mentioned the archetype plugin documentation doesn't reflect the new plugin's usage. To revert to the old way, you can run the older version of the plugin. You need to specify the full coordinates when running the plugin. So rather than 'mvn archetype:create', you would replace that with 'mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create'. I hope this helps.

Posted by Brent Atkinson on February 18, 2008 at 12:25 PM MST #


I just tried using a local catalog with the new plugin using my original archetypes and wasn't able to get it working. One thing I noticed was that the new plugin's internal catalog (located in org.apache.maven.archetype:archetype-common:2.0-alpha-1), comments out an archetype definition. Apparently, the archetype is commented out because it doesn't have an archetype.xml file. Comparing my archetypes with the ones pointed to by the internal catalog, there is a difference in how the archetypes are packaged. The ones in the internal catalog are packaged with the archetype.xml file in META-INF/, not META-INF/maven/. I wonder if this has any significance. Also, I don't quite understand why the repository elements in the catalog files are not specified as repository id's and instead use the URLs directly. Will this mean that the new plugin doesn't work with repositories that require authentication (like my own)? Anyway, it wasn't immediately obvious how to use the local catalog and it didn't use it by default. Once you have an archetype-catalog.xml file in your ~/.m2/ directory, use 'mvn archetype:create -DarchetypeCatalog=local' to have it use your local catalog.

Posted by Brent Atkinson on February 18, 2008 at 02:28 PM MST #

It seems that the new archetype plugin was published as a release a little prematurely as it doesn't fully support the old way of doing things, and also doesn't fully support an alternative way of doing things.

This is a totally stupid way to release something like this into the main stream. Just when some of us have built our own processes for using Maven 2 archetype functionality, along comes something like this...

How about reverting the maven-archetype-plugin to it's original form and releasing a new, supposedly-improved archetype plugin with a separate name like "maven-appfuse-archetype-plugin"?

When are people that do this kind of thing in the maven2 world going to grow up?

Posted by Bradley Smith on March 17, 2008 at 02:05 PM MDT #

I tried to create archetype from existing project, but when I try to generate project from that archetype, it will create only project directory with pom.xml (without directory structure and resources). So I tried it with maven-archetype-quickstart as well and the result was same. Is there anybody who knows resolved this problem. I tried following steps:
  1. generate project from maven-archetype-quickstart
  2. create-from-project
  3. change groupId and artifactId in pom.xml and change paths in archetype.xml, because there ware paths with package subdirectory from existing project for resources and testResources.
  4. install it
  5. archetype:crawl
  6. generate project from local archetypes catalog
And result was only project directory with pom.xml (without directory structure and resources)

Posted by Zdeno Tubel on March 20, 2008 at 05:47 AM MDT #

Hello all, I have the same problem than Zdeno Tubel. I generate an archetype by using the command "mvn archetype:create-from-project". All seems to be ok and I can install it in my local repository. But when I try to generate a new project from it I have only a project directory with pom.xml file. No ressources or directory were created. It's surprising because if I open the jar file corresponding to my archetype, I can see all the ressource files in it. Maybe a problem with the command : "mvn archetype:generate -DarchetypeCatalog=local" ???

Posted by Sébastien PRAT on April 10, 2008 at 07:22 AM MDT #

For your information this problem is related to windows platform. If you try to open the generated jar and to extract the file "archetype-metadata.xml" you will get an error.

The problem seems to be solved in the 2.0-alpha-3 release (not yet available).

Posted by Sébastien PRAT on April 10, 2008 at 07:56 AM MDT #

Post a Comment:
  • HTML Syntax: Allowed