Maven插件尽管绑定到构建阶段,但未执行

huangapple go评论69阅读模式
英文:

Maven plugin not executing even though it is bound to a build phase

问题

<inherited>false</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>ant-execute</id>
<phase>package</phase>
<configuration>
<target name="UploadAndScan" description="Turns on debug symbols, logging. Cleans, builds, uploads binaries. Starts scan">
<!-- Call the Veracode wrapper to upload and scan -->
<java jar="${settings.localRepository}/com/veracode/vosp/api/wrappers/vosp-api-wrappers-java/20.7.7.0/vosp-api-wrappers-java-20.7.7.0.jar" fork="true">
<arg line=" -action UploadAndScan -vid <vid> -vkey <vkey> -criticality High -createprofile false -createsandbox false -version ${project.artifactId}-${project.version} -appname <appname> -sandboxname <sandboxname> -filepath <fpath>"/>
</java>
</target>
</configuration>
<goals>
<goal>run</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>

这是定义插件的代码,位于顶层 pom 文件中。

英文:

I am new to maven, and am having trouble executing a plugin. Currently I have bound it to the package phase, but when I do mvn clean package, or mvn clean install, it is not being executed. However, when I call the plugin by name, it executes as it should. What have I misunderstood/what is wrong with my code?

 &lt;inherited&gt;false&lt;/inherited&gt;
           &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
           &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
           &lt;version&gt;1.8&lt;/version&gt;
           &lt;executions&gt;
              &lt;execution&gt;
                 &lt;id&gt;ant-execute&lt;/id&gt;
                 &lt;phase&gt;package&lt;/phase&gt;
                 &lt;configuration&gt;
                    &lt;target name=&quot;UploadAndScan&quot; description=&quot;Turns on debug symbols, logging. Cleans, builds, uploads binaries. Starts scan&quot;&gt;
                       &lt;!-- Call the Veracode wrapper to upload and scan --&gt;
                       &lt;java jar=&quot;${settings.localRepository}/com/veracode/vosp/api/wrappers/vosp-api-wrappers-java/20.7.7.0/vosp-api-wrappers-java-20.7.7.0.jar&quot; fork=&quot;true&quot;&gt;
                          &lt;arg line=&quot; -action UploadAndScan -vid &lt;vid&gt; -vkey &lt;vkey&gt; -criticality High -createprofile false -createsandbox false -version ${project.artifactId}-${project.version} -appname &lt;appname&gt; -sandboxname &lt;sandboxname&gt; -filepath &lt;fpath&gt;&quot;/&gt;
                       &lt;/java&gt;
                    &lt;/target&gt;
                 &lt;/configuration&gt;
                 &lt;goals&gt;
                    &lt;goal&gt;run&lt;/goal&gt;
                 &lt;/goals&gt;
              &lt;/execution&gt;
           &lt;/executions&gt;
           &lt;dependencies&gt;
              &lt;dependency&gt;
                 &lt;groupId&gt;com.veracode.vosp.api.wrappers&lt;/groupId&gt;
                 &lt;artifactId&gt;vosp-api-wrappers-java&lt;/artifactId&gt;
                 &lt;version&gt;20.7.7.0&lt;/version&gt;
              &lt;/dependency&gt;
           &lt;/dependencies&gt;

This is the code that defines the plugin, located in the top-level pom.

答案1

得分: 0

你是否意外地将插件放入了<pluginManagement>中?

那么它将不会被执行,你需要将它移动到<plugins>中。

英文:

Did you, by accident, put the plugin into &lt;pluginManagement&gt;?

Then it will not be executed and you need to move it to &lt;plugins&gt;.

huangapple
  • 本文由 发表于 2020年8月31日 16:02:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/63666997.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定