Have you looked at combine.children="append" or combine.self="override" attributes to the <configuration> element?
http://blog.sonatype.com/2011/01/maven-how-to-merging-plugin-configuration-in-complex-projects/ https://maven.apache.org/pom.html -----Original Message----- From: KARR, DAVID [mailto:[email protected]] Sent: Monday, February 20, 2017 10:33 AM To: Maven Users List <[email protected]> Subject: [EXTERNAL] Strategies for overriding parent plugin configuration in some modules without duplicating config code? External Sender: Use caution with links/attachments. Although my issue is about configuring the "jacoco-maven-plugin", I think it's really more of a pure Maven configuration issue, as I don't think this situation is unique to JaCoCo. I have a somewhat large multi-module project. Each of the child modules has a parent pom that configures the "jacoco-maven-plugin" to do offline instrumentation (at present, all the modules having unit tests using PowerMock, which doesn't work with online instrumentation). I've designed a change that I'll have to make in a few classes in each module that will allow the unit tests to use Mockito, and for JaCoCo to use online instrumentation. I'll eventually fix all of them to work this way, but it will take a little while. In the meantime, I just want to override the configuration in the "fixed" modules with online instrumentation and let the other modules use the default of offline instrumentation. The simple-minded way to do this is just to define the same configuration using online instrumentation in each "fixed" module, so it will override the parent pom. Copying that block to every "fixed" module is not a great idea. I'd like a solution that requires less code duplication. I suppose I could define ANOTHER parent pom, that specifies the existing parent as its parent, and have that second parent use online instrumentation, and have the fixed modules use that second parent instead. I will eventually delete this second parent pom once all of the modules are "fixed". Note that I have a separate aggregator pom that is not a parent pom. Are there other reasonable strategies for this "use original parent for some, override in same way for others" situation? --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] ---------------------------------------------------------------------- This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
