1
我試圖使用exec-maven-plugin和java
目標。不過,我對兩個選項之間的區別感到困惑:exec-maven-plugin參數和commandlineArgs之間的區別
- 參數
- commandlineArgs
如果我嘗試使用參數,調用我的java類失敗。
我班被稱爲簽名是:
public static void main(String[] args)
{
VeracodeParser parser = new VeracodeParser();
parser.parse(args);
}
我POM:
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>Zip packaging and deployment</id>
<phase>process-sources</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.veracode.apiwrapper.cli.VeracodeCommand</mainClass>
<arguments>
<argument>-action GetAppList</argument>
<argument>-vuser ${veracode.username}</argument>
<argument>-vpassword ${veracode.password}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
不過,我得到錯誤信息從我VeracodeCommand類中用於表示,我很想念我的-action
,-vuser
和-vpassword
參數。
然而,當我把它切換到使用一個字符串參數commandlineArgs
,它按預期工作:
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>Zip packaging and deployment</id>
<phase>process-sources</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.veracode.apiwrapper.cli.VeracodeCommand</mainClass>
<commandlineArgs>-action UploadFile -vuser ${veracode.username} -vpassword ${veracode.password} -appid ${veracode.appId} -filepath ${project.build.directory}/dependency/sbip_ear_pres.ear</commandlineArgs>
</configuration>
</execution>
</executions>
</plugin>
的問題是,<commandlineArgs>
將變得笨拙長。這就是爲什麼我更願意使用<arguments>
參數。
任何人都可以向我解釋兩者之間的差異和/或如果/如何使用arguments
參數?
後貌似這也正是它。我正要在源代碼中進行一些挖掘並運行一些測試後自己發佈答案。 –