Eri*_* B. 5 java maven exec-maven-plugin
我正在尝试将 exec-maven-plugin 与java目标一起使用。但是,我对这两个选项之间的区别感到困惑:
如果我尝试使用参数,对我的 java 类的调用将失败。
我的班级被调用的签名是:
public static void main(String[] args)
{
VeracodeParser parser = new VeracodeParser();
parser.parse(args);
}
Run Code Online (Sandbox Code Playgroud)
我的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>
Run Code Online (Sandbox Code Playgroud)
但是,我从 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>
Run Code Online (Sandbox Code Playgroud)
问题是这<commandlineArgs>将变得笨重。这就是为什么我更喜欢使用<arguments>参数的原因。
谁能向我解释两者之间的区别和/或是否/如何使用该arguments参数?
也许您必须以这种方式单独提供您的论点?根据Maven 中的帖子- 传递参数以在 exec-maven-plugin 中使用
<arguments>
<argument>-action</argument>
<argument>GetAppList</argument>
<argument>-vuser</argument>
<argument>${veracode.username}</argument>
<argument>-vpassword</argument>
<argument>${veracode.password}</argument>
</arguments>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4513 次 |
| 最近记录: |