Skip to content

Commit

Permalink
Facilitate JMH benchmarking from the Maven CLI
Browse files Browse the repository at this point in the history
- Add profile benchmark for JMH benchmarks
- Add JMH to dependency management section
  • Loading branch information
garydgregory committed Apr 20, 2024
1 parent 9fa2aaa commit 9637b97
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 5 deletions.
46 changes: 41 additions & 5 deletions pom.xml
Expand Up @@ -167,7 +167,7 @@
<!-- Warning: org.apache.felix:maven-bundle-plugin does not yet support bndlib 7 -->
<commons.biz.aQute.bndlib.version>6.4.1</commons.biz.aQute.bndlib.version>
<commons.junit.version>5.10.2</commons.junit.version>

<commons.jmh.version>1.37</commons.jmh.version>
<!--
Note: Maven site plugin 3.5.1 is the latest version but is not a direct replacement:
Expand Down Expand Up @@ -1845,7 +1845,6 @@
</plugins>
</build>
</profile>

<profile>
<!-- Java 11 and up -->
<id>java-11-up</id>
Expand All @@ -1856,7 +1855,6 @@
<commons.checkstyle.version>10.15.0</commons.checkstyle.version>
</properties>
</profile>

<profile>
<!-- Java 17 and up -->
<id>java-17-up</id>
Expand All @@ -1870,7 +1868,45 @@
-->
</properties>
</profile>

<profile>
<!-- JMH benchmarking -->
<id>benchmark</id>
<properties>
<skipTests>true</skipTests>
<benchmark>org.apache</benchmark>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>benchmark</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<classpathScope>test</classpathScope>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>org.openjdk.jmh.Main</argument>
<argument>-rf</argument>
<argument>json</argument>
<argument>-rff</argument>
<argument>target/jmh-result.${benchmark}.json</argument>
<argument>${benchmark}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
3 changes: 3 additions & 0 deletions src/changes/changes.xml
Expand Up @@ -58,6 +58,9 @@ The <action> type attribute can be add,update,fix,remove.
-->
<body>
<release version="70" date="YYYY-MM-DD" description="Version 70: Maintenance and update dependencies">
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary Gregory">Add profile benchmark for JMH benchmarks.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add JMH to dependency management section.</action>
<!-- FIX -->
<action type="fix" dev="ggregory" due-to="Gary Gregory">Set Javadoc link to latest Java API LTS version.</action>
<!-- UPDATE -->
Expand Down

0 comments on commit 9637b97

Please sign in to comment.