![](/img/trans.png)
[英]Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar
[英]Trying to execute jar in maven plugin
我正在使用 org.codehaus.mojo exec-maven-plugin 通過我的項目 pom.xml 執行一個 executable.jar 文件。 目前這不起作用,我不確定為什么。 當我指定 commandlineArgs 時發生錯誤。
我的插件看起來像這樣:
<plugin>
<inherited>false</inherited>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<param>${VID}</param>
<param>${VKEY}</param>
<executable>java</executable>
</configuration>
<executions>
<execution>
<id>veracode</id>
<configuration>
<arguments>
<argument>-jar</argument>
<argument>${settings.localRepository}/com/veracode/vosp/api/wrappers/vosp-api-wrappers-java/20.7.7.0/vosp-api-wrappers-java-20.7.7.0.jar</argument>
</arguments>
<classpathScope>run</classpathScope>
<includePluginDependencies>true</includePluginDependencies>
<commandlineArgs>-action UploadAndScan -vid ${VID} -vkey ${VKEY} -criticality High -createprofile false -createsandbox false -version ${project.artifactId}-${project.version} -appname <appname> -sandboxname <proxy-standard> -filepath proxy-service/target/lib</commandlineArgs>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.veracode.vosp.api.wrappers</groupId>
<artifactId>vosp-api-wrappers-java</artifactId>
<version>20.7.7.0</version>
</dependency>
</dependencies>
</plugin>
我以前使用 antrun 獲得了相同的功能。
Unrecognized option: -action
錯誤:無法創建 Java 虛擬機。 錯誤:發生致命異常。 程序將會退出。 [錯誤] 命令執行失敗。 org.apache.commons.exec.ExecuteException:進程因錯誤退出:1(退出值:1)
我誤用了 commandlineArgs。 我實際上應該使用指定的選項:我這樣做解決了它:
<arguments>
<argument>-jar</argument>
<argument>${settings.localRepository}/com/veracode/vosp/api/wrappers/vosp-api-wrappers-java/20.7.7.0/vosp-api-wrappers-java-20.7.7.0.jar</argument>
<argument>-action</argument>
<argument>UploadAndScan</argument>
<argument>-vid</argument>
<argument>${VID}</argument>
<argument>-vkey</argument>
<argument>${VKEY}</argument>
<argument>-criticality</argument>
<argument>High</argument>
<argument>-createprofile</argument>
<argument>false</argument>
<argument>-createprofile</argument>
<argument>false</argument>
<argument>-version</argument>
<argument>${BUILD_NUMBER}</argument>
<argument>-appname</argument>
<argument>PULSE-DELIVERY</argument>
<argument>-sandboxname</argument>
<argument>proxy-standard</argument>
<argument>-filepath</argument>
<argument>proxy-service/target/lib</argument>
</arguments>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.