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?
the default archetype number now is 1092 1092: remote -> org. apache. maven. archetypes:maven-archetype-quickstart (An archetype which contains a sample Maven project.)
The archetype descriptor is a file called archetype-metadata. xml which must be located in the src/main/resources/META-INF/maven/ directory.
Archetype configurationYou can see the packaging maven-archetype . You can customize build of your archetype here as with any other pom. However, there is another pom. xml file located under src\main\resources\archetype-resources which is the pom file of the generated project.
The metadata about an archetype is stored in the archetype-metadata. xml file located in the directory META-INF/maven of its JAR file, see the reference documentation. The metadata file stores the additional properties, with corresponding default values. It also stores the project's generated files in filesets.
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.
please look for a final question to commit the settings. In my case there is a final question:
:
Confirm properties configuration:
groupId: ....
Y: :
If i enter n then all properties will be re-ask interactive with my defaults from archetype-metadata.xml.
Here is my console part:
Choose archetype:
1: file:///C:\Aktentasche\_daten\m3 -> maven-dsl-project-archet...
Choose a number: : 1
Downloading: file:///C:\Aktentasche\_daten\m3/net/sf/maven/plug...
data.xml
[INFO] Using property: groupId = net.sf.maven.plugins
[INFO] Using property: artifactId = dslexample
[INFO] Using property: version = 1.0.0-SNAPSHOT
[INFO] Using property: package = net.sf.maven.plugins
[INFO] Using property: eclipse_platform = helios
[INFO] Using property: tycho_version = 0.8.0
Confirm properties configuration:
groupId: net.sf.maven.plugins
artifactId: dslexample
version: 1.0.0-SNAPSHOT
package: net.sf.maven.plugins
eclipse_platform: helios
tycho_version: 0.8.0
Y: :
Here i must enter n for interactive dialog with defaults.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With