This has nothing to do with jacoco-maven-plugin - please refer to the documentation about Maven itself: You can not use properties to override configuration explicitly specified in your pom.xml file, i.e. everything here behaves as expected - "<skip>true</skip>" can not be overridden by "-Djacoco.skip=false" because this is how Maven works.
To achieve what you want, instead of <configuration> <skip>true</skip> </configuration> you can specify <properties> <jacoco.skip>true</jacoco.skip> </properties> Regards, Evgeny On Mon, Jun 29, 2020 at 11:13 AM <[email protected]> wrote: > Hi All, > > I have a requirement to Skip the Jacoco execution by default and have to > execute the same on demand by overriding -Djacoco.skip=false in Jenkins > build. > > I have this in my base-pom. which is working fine by default. > > <plugin> > <groupId>org.jacoco</groupId> > <artifactId>jacoco-maven-plugin</artifactId> > <version>0.8.3</version> > <executions> > <execution> > <id>pre-unit-test</id> > <goals> > <goal>prepare-agent</goal> > </goals> > <configuration combine.self="override"> > <skip>true</skip> > > <destFile>${project.build.directory}/jacoco.exec</destFile> > > <propertyName>surefireArgLine</propertyName> > </configuration> > </execution> > <execution> > <id>post-unit-test</id> > <phase>test</phase> > <goals> > <goal>report</goal> > </goals> > <configuration combine.self="override"> > <skip>true</skip> > > <dataFile>${project.build.directory}/jacoco.exec</dataFile> > > <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory> > </configuration> > </execution> > </executions> > </plugin> > > overriding the same in mvn install -Djacoco.skip=false , but getting > this message. > > > [INFO] Skipping JaCoCo execution because property jacoco.skip is set. > [INFO] surefireArgLine set to empty > > -- > You received this message because you are subscribed to the Google Groups > "JaCoCo and EclEmma Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jacoco/e2906d07-4167-4e7c-b13c-bbdcbd0b5402o%40googlegroups.com > <https://groups.google.com/d/msgid/jacoco/e2906d07-4167-4e7c-b13c-bbdcbd0b5402o%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/CAEPFu6-ermkAcM0uVe0mdinBd_6w6m22FHnXd18djXBaTF2XAw%40mail.gmail.com.
