Why are benchmarks running when i mvn -pl a different module?

Aleksey Shipilev shade at redhat.com
Thu Sep 7 10:51:30 UTC 2017


On 09/07/2017 04:08 AM, Henri Tremblay wrote:
> Just remove lines 155-173 from
> https://github.com/Pr0methean/BetterRandom/blob/master/benchmark/pom.xml.
> 
> Or move them in a maven profile.
> 
> On 6 September 2017 at 16:43, Chris <seahen123 at gmail.com> wrote:
> 
>> I have my benchmarks and the rest of my code in two sibling modules, called
>> benchmark and betterrandom respectively. When I run
>>
>> #!/bin/sh
>> cd betterrandom
>> mvn -pl betterrandom jacoco:prepare-agent test jacoco:report &&\
>> if [ "$TRAVIS" = "true" ]; then
>>   mvn coveralls:report
>> fi
>> cd ..
>>
>> Maven tries to run the benchmarks as well! Why is this happening, and how
>> do I stop it? All my pom.xml's are at
>> https://github.com/Pr0methean/betterrandom.

This is Maven problem, not JMH problem. Seek advice on Maven configuration. I suspect that attaching
org.codehaus.mojo:exec-maven-plugin to <phase>integration-test</phase> is what gets your thing to run.

Incidentally, executing JMH with "java -cp ${cp} org.openjdk.jmh.Main .*" quite probably misses the
important resources. It is much safer to run the benchmarks.jar generated by the build.

-Aleksey



More information about the jmh-dev mailing list