Ask for maven archetype properties with defaults

sgargan picture sgargan · Oct 9, 2010 · Viewed 9k times · Source

I'm putting together a maven archetype that has a bunch of custom properties that are used to filter the various archetype resources. I have these specified with defaults in the archetype-metadata.xml e.g.

<requiredProperties>
  <requiredProperty key="application-name">
    <defaultValue>Some Application</defaultValue>
  </requiredProperty>>  
</requiredProperties>

However when I try to create a project with the archetype, it does not allow me to change these interactively. For instance, it asks for the version with default as follows

Define value for property 'version': 1.0-SNAPSHOT: 

allowing a version to be entered, but defaulting to 1.0-SNAPSHOT if nothing is entered. For my custom properties, it merely displays them prior to creating the new project

[INFO] Using property: application-name = Some Application

If I omit the default value from the archetype-metadata.xml then it will prompt me for a value, but there is no default.

Is it possible to supply a default and still get prompted?

Answer

Ed Staub picture Ed Staub · Apr 13, 2011

In short, no, it isn't possible. There's a JIRA issue on this. If it is a problem for you, you may want to vote for it.