problem running mixed java/scala jmh project

Claes Redestad claes.redestad at oracle.com
Sat Dec 17 00:11:17 UTC 2016


Hi,

I don't know about mixing archetypes like that...

An alternative solution, perhaps: while not specifically mixing java
and scala JMH benchmarks, we have cases where there is good reason to
keep different benchmarks in different modules, and then merge it all
together using the shade plugin to create a single benchmark file:

   <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-shade-plugin</artifactId>
       <version>2.3</version>
       <executions>
           <execution>
               <phase>package</phase>
               <goals>
                   <goal>shade</goal>
               </goals>
               <configuration>
                   <transformers>
                       <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                           <mainClass>org.openjdk.jmh.Main</mainClass>
                       </transformer>
                       <transformer 
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                           <resource>META-INF/BenchmarkList</resource>
                       </transformer>
                       <transformer 
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                           <resource>META-INF/CompilerHints</resource>
                       </transformer>
                   </transformers>
               </configuration>
           </execution>
       </executions>
   </plugin>

Hope this helps!

/Claes

On 2016-12-16 18:20, Alex Averbuch wrote:
> Additional info, maybe this is helpful..
> When the "annotation processing" is enabled, if I rebuild from IntelliJ I
> get errors like the following:
>
> Information:Using javac 1.8.0_66 to compile java sources
> Information:java: Benchmark entries for temp.MyBenchmark already exist,
> overwriting
> Information:java: Errors occurred while compiling module 'jmh-benchmarks'
> Information:12/16/16, 6:11 PM - Compilation completed with 100 errors and 0
> warnings in 6s 859ms
> /Users/alexaverbuch/IdeaProjects/jmh-benchmarks/jmh-benchmarks/target/classes/generated/temp/generated/MyBenchmark_jmhType_B1.java
> Error:(3, 8) java: duplicate class: temp.generated.MyBenchmark_jmhType_B1
>
> On Fri, Dec 16, 2016 at 4:44 PM, Alex Averbuch <
> alex.averbuch at neotechnology.com> wrote:
>
>> I have a java-only JMH project that I'd like to add scala benchmarks to.
>> To do that I updated the pom to be a mix of those generated by
>> jmh-java-benchmark-archetype & jmh-scala-benchmark-archetype.
>>
>> Both before (java.xml) and after (java-scala.xml) poms are attached.
>>
>> The following setting is enabled in IntelliJ:
>> Build, Execution, Deployment --> Compiler --> Annotation Processor -->
>> Enable annotation processing
>>
>> But something's going wrong...
>> When I try to run the new Scala benchmark from IntelliJ I get the
>> following error:
>> Caused by: No benchmarks to run; check the include/exclude regexps.
>>
>> However, when running with maven from terminal it works fine.
>> Also, after that successful run with maven I can then run from IntelliJ
>> with no problem.
>>
>> Any know what I need to do to get this working?
>> Thanks
>>


More information about the jmh-dev mailing list