Search code examples
javamavenmaven-plugin

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


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?

 <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>

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


Solution

  • Did you, by accident, put the plugin into <pluginManagement>?

    Then it will not be executed and you need to move it to <plugins>.