melix / jmh-gradle-plugin

Integrates the JMH benchmarking framework with Gradle
Apache License 2.0
666 stars 88 forks source link

Dependencies in a multi-project build #141

Open sebersole opened 5 years ago

sebersole commented 5 years ago

I am confused about using this plugin in my particular scenario..

The main gist is that I want to define a single benchmark (a single, common subproject) and be able to run that against more than one version of the Hibernate project (as separate subprojects, one per Hibernate version). Initially I had:

root/
    hql-benchmark-common/
        src/main/java/
            BenchmarkTests.java
            HibernateVersionSuppport.java
    hql-benchmark-orm5/
        src/main/java
            HibernateVersionSupport5.java
    hql-benchmark-orm6/
        src/main/java
            HibernateVersionSupport6.java

I then cd into hql-benchmark-orm5 and attempt to run the jmh task, but in this set-up JMH is not able to find tests to run, presumably because of the src/main and src/jmh split mentioned in the plugin's readme. So I tried the following split instead:

root/
    hql-benchmark-common/
        src/jmh/java/
            BenchmarkTests.java
        src/main/java/
            HibernateVersionSuppport.java
    hql-benchmark-orm5/
        src/main/java
            HibernateVersionSupport5.java
    hql-benchmark-orm6/
        src/main/java
            HibernateVersionSupport6.java

However, it is still unable to find the tests.

Is this kind of set up support? If so, any pointers on how to set up such a project?

Sanne commented 4 years ago

Would need the same. Is @sebersole 's issue too complex? This would seem a natural thing to do for a gradle plugin?

sebersole commented 4 years ago

FWIW the only way I could get this to work was to literally copy/paste the benchmark test class(es) into each sub-project :( Fugly, but works

https://github.com/sebersole/hibernate-hql-benchmark