1
我正在使用maven-release-plugin來釋放一些工件。在release:perform
目標期間,我想運行一個內聯的Groovy腳本,它使用我的SCM憑證來執行一些任務。如何將maven命令行參數傳遞給內聯Groovy腳本
這是一個片段我pom.xml
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4</version>
<configuration>
<goals>
clean
deploy
org.codehaus.gmaven:gmaven-plugin:execute
</goals>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
log.info "Username: ${project.properties.username} account"
</source>
</configuration>
</execution>
</executions>
</plugin>
...
我調用Maven作爲跟隨
mvn -B release:prepare release:perform -Dusername=foo -Dpassword=bar
我GETE以下的輸出:
Username: null account
我想看看在官方GMaven頁面,但似乎有一些片段丟失...
有什麼想法?
EDIT
我完成通過將憑證在goals
部
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4</version>
<configuration>
<goals>
clean
deploy
org.codehaus.gmaven:gmaven-plugin:execute -Dusername=${username} -Dpassword=${password}
</goals>
</configuration>
</plugin>
...
的命令行是直到相同的: mvn -B release:prepare release:perform -Dusername=foo -Dpassword=bar
如所述通過@khmarbaise它看起來像Maven的發佈週期rked。我不確定它是否將所有命令行參數傳遞給了分叉進程。所以這就像我迫使CLI參數的前進一樣。
這個必須與你有的其他配置有關,因爲當我使用與你所顯示的相同的語法時,它適用於我。 – Renato 2013-02-10 15:38:08