2010-10-09 65 views
13

我正在放置一個maven原型,其中有一堆用於過濾各種原型資源的自定義屬性。我在archetype-metadata.xml中指定了默認值,例如要求具有默認值的maven原型屬性

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

然而,當我嘗試創建與原型的一個項目,它不會讓我來交互改變這些。例如,它要求與默認版本如下

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

,允許輸入一個版本,但是,如果不輸入任何默認爲1.0快照。對於我的自定義屬性,它只是顯示他們創建新的項目

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

如果我省略了從原型-metadata.xml中的默認值,然後它會提示我輸入值之前,但沒有默認。

是否有可能提供一個默認並仍然得到提示?

回答

0

我在Maven郵件列表中提出了這個問題,但沒有回覆。由於在此期間解決方法,系統屬性可以在原型運行

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

請認準最後一個問題提交設置就能使用在命令行覆蓋它們。在我的情況下,有一個最後的問題:

: 
Confirm properties configuration: 
groupId: .... 
Y: : 

如果我進入ň然後所有屬性將重新詢問與原型-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: : 

在這裏,我必須爲具有默認交互式對話框中輸入ñ

6

總之,不,這是不可能的。 這裏有一個JIRA問題。 如果對您而言存在問題,您可能需要爲此投票。

1

我知道這是很不理想,但如果你提供的所有requiredProperty(包括的groupId,artifactId的,版本和包),你會用簡歷來propted,然後通過輸入ň你會實現的默認值的目標

-2

你試過第二個克拉結束requiredProperty

變化</requiredProperty>></requiredProperty>

看起來可能是畸形XML問題。