Maven 2 使用默认值询问maven原型属性

Maven 2 使用默认值询问maven原型属性,maven-2,maven-archetype,Maven 2,Maven Archetype,我正在构建一个maven原型,它有一组自定义属性,用于过滤各种原型资源。我在archetype-metadata.xml中用默认值指定了这些 <requiredProperties> <requiredProperty key="application-name"> <defaultValue>Some Application</defaultValue> </requiredProperty>> </r

我正在构建一个maven原型,它有一组自定义属性,用于过滤各种原型资源。我在archetype-metadata.xml中用默认值指定了这些

<requiredProperties>
  <requiredProperty key="application-name">
    <defaultValue>Some Application</defaultValue>
  </requiredProperty>>  
</requiredProperties>
允许输入版本,但如果未输入任何内容,则默认为1.0-SNAPSHOT。对于我的自定义属性,它仅在创建新项目之前显示它们

[INFO] Using property: application-name = Some Application
如果我省略了archetype-metadata.xml中的默认值,那么它将提示我输入一个值,但没有默认值


是否可以提供一个默认值并仍然得到提示?

我在Maven邮件列表中提出了这个问题,但没有得到回复。同时,作为一种变通方法,当运行原型时,可以使用系统属性在命令行重写它们

e.g. -Dapplication-name="Some Application"

请查找最后一个问题以提交设置。就我而言,还有最后一个问题:

:
Confirm properties configuration:
groupId: ....
 Y: :
如果我输入n,则所有属性都将与archetype-metadata.xml中的默认值进行重新询问交互

这是我的控制台部分:

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: :

在这里,我必须输入n以使用默认值进行交互式对话。

简而言之,不,这是不可能的。 这有个问题。
如果这对您来说是一个问题,您可能想投票支持它。

我知道这远不理想,但如果您为所有必需属性(包括groupId、artifactId、version和package)提供默认值你将得到简历的支持,然后通过输入n你将实现你的目标

你是否尝试过从结尾
requiredProperty
上取下第二克拉

更改为

看起来可能是XML格式不正确的问题

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: :