problem running mixed java/scala jmh project
Alex Averbuch
alex.averbuch at neotechnology.com
Sun Dec 18 21:01:53 UTC 2016
Thanks Claes,
The project already uses shade plugin already. I'll get to that in a sec.
First I'd like to share where I'm currently at.
Instead of using a mixed java/scala maven archetype I tried the Scala one,
and everything works perfectly when building with maven+terminal.
But when building from IntelliJ code generation doesn't seem to work for
the Scala classes.
Please see attached files. They're screen captures of target/ directory,
after building with (1) maven+terminal (2) IntelliJ
The only Scala package right now is "cypher", all other packages are Java;
notice how no code is generated for "cypher" in the IntelliJ case.
This makes me think it's simply an IntelliJ configuration problem...
unfortunately I haven't yet found the solution.
Can you think of anything that might cause this behavior?
Regarding shade plugin... the current project structure is:
jmh-benchmarks/
benchmark-results-store/
jmh-benchmarks/
If all else fails and I need to break things out into separate modules I
think I would need to do something like:
jmh-benchmarks/
benchmark-results-store/
jmh-benchmarks/
jmh-benchmarks-java/
jmh-benchmarks-scala/
The reason for needing jmh-benchmarks/jmh-benchmarks/ is that both Java &
Scala benchmarks would share logic for runner, data generation, result
reporting, etc.
On Sat, Dec 17, 2016 at 1:11 AM, Claes Redestad <claes.redestad at oracle.com>
wrote:
> 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.mav
> en.plugins.shade.resource.ManifestResourceTransformer">
> <mainClass>org.openjdk.jmh.Main</mainClass>
> </transformer>
> <transformer implementation="org.apache.mav
> en.plugins.shade.resource.AppendingTransformer">
> <resource>META-INF/BenchmarkList</resource>
> </transformer>
> <transformer implementation="org.apache.mav
> en.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/MyBenchma
>> rk_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