I have a parent pom with a few plugins. In my child pom, I want to exclude one plugin.
How can I do this?
Plugins declared outside of <pluginManagement> are inherited by child POMs, by default. Their settings can be overridden by each child if desired.
You can put the clean plugin inside the execution tag in pom. xml file. How to stop the propagation of plugins to child POMs? set <inherited> to false.
pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one.
I had a similar requirement to run some plugins in the child but not the parent POM. i achieved this by stating <skip>true</skip>
in the parent POM.
the parent pom entry is below
<plugin> <groupId>eviware</groupId> <artifactId>maven-soapui-plugin</artifactId> <version>4.0.0</version> <inherited>false</inherited> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.2</version> </dependency> </dependencies> <configuration> <skip>true</skip> </configuration> </plugin>
The child project pom entry is below
<plugins> <plugin> <groupId>eviware</groupId> <artifactId>maven-soapui-plugin</artifactId> <version>4.0.0</version> <configuration> <settingsFile>site-service-web/src/test/soapui/soapui-settings.xml</settingsFile> <projectFile>site-service-web/src/test/soapui/PodifiSite-soapui-project.xml</projectFile> <outputFolder>site-service-web/target/surefire-reports</outputFolder> <junitReport>true</junitReport> <exportwAll>true</exportwAll> <printReport>true</printReport> </configuration> </plugin> </plugins>
You can define all plugins in parent pom in pluginManagement section
<pluginManagement> <plugins> ... <plugin> <artifactId>maven-dependency-plugin</artifactId> <version>2.8</version> <executions> <execution> <id>unpack-dependencies</id> <phase>generate-sources</phase> <goals> <goal>unpack-dependencies</goal> </goals> <configuration> <includeTypes>tar.bz2</includeTypes> <outputDirectory>${project.basedir}/target/dependencies</outputDirectory> </configuration> </execution> </executions> </plugin> ... </plugins> </pluginManagement>
And after in parent and child poms you can control the execution phase of this plugin
<plugins> <plugin> <artifactId>maven-dependency-plugin</artifactId> <inherited>false</inherited> <executions> <execution> <id>unpack-dependencies</id> <phase>none</phase> </execution> </executions> </plugin> </plugins>
If you paste this in parent pom do not forget option <inherited>false</inherited>
, its disable execution inheritance in child pom.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With