当前位置: 首页 > 知识库问答 >
问题:

尝试在maven插件中执行jar

秦禄
2023-03-14

我正在使用org.codehaus.mojo exec-maven-plugin通过我的pom.xml项目执行一个可执行的。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>
Unrecognized option: -action

共有1个答案

林弘壮
2023-03-14

我误用了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>
 类似资料:
  • 问题内容: 我有一个安装程序,其中我的大多数项目都需要同时运行xtend插件才能实现compile和testCompile目标。我在pluginManagement部分中对其进行描述: 现在,有些项目不需要一个目标或另一个目标。我尝试了继承的标签,使用了随机属性,但是没有用。如何覆盖执行以仅包含所需目标? 更新 :这个故事的结论是,个人目标不能残废。可以管理的最小范围是。 问题答案: 通常,您只能

  • 我正在尝试使用shade插件创建一个可执行JAR的简单示例。我逐行浏览了这里的示例,在我的机器上似乎根本没有执行shade插件。 我的阴影POM代码是: 运行“mvn包”后,创建的JAR不包含任何项目依赖项。从调试跟踪来看,似乎从未调用过shade插件。要让shade发挥其魔力,是否还需要一些额外的步骤? 编辑:示例的完整代码位于https://github.com/hutch31/maven-s

  • 问题内容: 我试图在Java中实现一个非常简单的Trie,该Trie支持3种操作。我希望它具有一个insert方法,一个has方法(即trie中的某个单词)和一个toString方法以字符串形式返回trie。我相信我的插入工作正常,但是has和toString证明很困难。到目前为止,这就是我所拥有的。 特里类。 和节点类 因此,基本上,在创建Trie时,将创建一个TrieNode作为具有26个子级

  • 我是maven的新手,学习如何以及何时在插件中执行阶段/目标 假设我的pom中有以下代码片段 现在,如果我执行mvn安装,安装之前的modello的所有阶段(以及每个阶段对应的所有目标)都将执行。正当 但是,如果进行以下修改以引入特定目标,则只会执行一个目标,即java目标(因为它位于安装阶段之前的生成源代码阶段)。对吗?

  • 在我当前的项目设置中,maven shade插件的执行非常不稳定。这个插件看起来像是在我构建父模块之后执行的,但是在那个实例中执行之后,它在独立构建子模块时无法执行。 我的父母是 还有孩子pom 以及在具有上述pom的子模块上运行“安装”目标时的构建输出 如您所见,尽管在< code >中定义了执行,maven shade插件并没有执行

  • 当我进行插入时,在traduction(idMot references mot)中的外键为null,在前面发送正确的外键。我最终出现了这个错误:not-null属性引用了一个空值或临时值:com.virtual.expertise.mydico.model.traduction.mot 我想我在我的模型中做错了什么,但仍然不知道是什么。 下面是交易表: 下面是我的WebService:(其中id