简体   繁体   中英

Maven executing configured plugin

Under Maven version 3.0.4 I have the problem to specify the execution of a single configured plugin. Say I have two different configured maven-antrun-plugins. Both are in the same lifecycle. How can I target the plugin I want to execute without using different lifecycles? Since version 3.3.1 it's possible to do it in this form: mvn groupid:artifactid:goal@id Is there a way to do this in a similar way in version 3.0.4 or lower?

You can use the "default-" in your pom to have the first plugin running during the default lifecycle (since Maven 2.2.0), and use a classifier for the second plugin, for example with the maven jar plugin, you can see the example below:

<plugin>
   <artifactId>maven-jar-plugin</artifactId>
      <executions>
       <execution>
        <id>default-jar</id>
        <configuration>
           <excludes>
              <exclude>**/somepackage/*</exclude>
            </excludes>
        </configuration>
     </execution>
     <execution>
        <id>special-jar</id>
           <phase>package</phase>
           <goals>
              <goal>jar</goal>
           </goals>
        <configuration>
          <includes>
             <include>**/sompackage/*</include>
           </includes>
           <classifier>somepackage</classifier>
         </configuration>
      </execution>
    </executions>
</plugin>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM