metlos / jmh-maven-plugin

A maven plugin capable or running the JMH benchmarks found in the test sources.
Apache License 2.0
22 stars 2 forks source link

Use a separate source directory #1

Open JanecekPetr opened 4 years ago

JanecekPetr commented 4 years ago

Hello, this is a great plugin, thank you. One thing I'd like to see is a different project structure supported by default. Something like:

/src
    /main/java/...
    /test/java......
    /perf/jmh/...

or something similar (perf/jmh? perf/java? benchmark/java? benchmark/jmh?) by default, and ideally for the plugin to add the expected source directory as a project test directory.

In other words, I'd like the benchmarks to be in a separate directory outside test/. Yes, it is possible for me to use the build-helper-maven-plugin to achieve my effect, but that feels like an unnecessary workaround.

Is this something you'd consider?

Edit: The https://github.com/melix/jmh-gradle-plugin plugin mentioned in the prior art section uses /src/jmh/java. I'd honestly rather see a more generic dir name before the impl-specific jmh dir. Of course, this should be configurable with whatever default you prefer :)

metlos commented 4 years ago

I would like to keep the default pointing to the test sources in a similar fashion as failsafe maven plugin does, but for sure seems like a nice enhancement idea.

PRs welcome btw :wink:

JanecekPetr commented 4 years ago

in a similar fashion as failsafe maven plugin does

That's exactly where I'm forced to use the build-helper-maven-plugin and that sucks, especially because the standard directory layout has src/it, grrr. (Also, why can't we specify multiple Source and Test Source directories, grrr!)
Um, sorry, just venting. :)

I'll consider creating a PR, thank you. I'll also consider having unit tests, integration tests and benchmarks in the same directory. With feature-based packages it might actually be practical afterall. Feel free to close this if you want.

micycle1 commented 2 years ago

Yes, something like a <sourceDirectory> config argument would be very nice.