This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-rng.git
The following commit(s) were added to refs/heads/master by this push: new 0bdda55 Add a profile to build a shaded jar to run the JMH benchmarks. 0bdda55 is described below commit 0bdda5506ab4ed0a59dad8e0497f19f0f2b25efe Author: aherbert <aherb...@apache.org> AuthorDate: Thu Apr 11 10:58:16 2019 +0100 Add a profile to build a shaded jar to run the JMH benchmarks. --- commons-rng-examples/examples-jmh/pom.xml | 64 ++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/commons-rng-examples/examples-jmh/pom.xml b/commons-rng-examples/examples-jmh/pom.xml index ead43af..4d9fec7 100644 --- a/commons-rng-examples/examples-jmh/pom.xml +++ b/commons-rng-examples/examples-jmh/pom.xml @@ -69,11 +69,16 @@ <!-- JMH Benchmark related properties: version, name of the benchmarking uber jar. --> <jmh.version>1.21</jmh.version> - <uberjar.name>benchmarks</uberjar.name> + <uberjar.name>examples-jmh</uberjar.name> + <project.mainClass>org.openjdk.jmh.Main</project.mainClass> </properties> <profiles> <profile> + <!-- Run a named benchmark from maven. The class to run can be specified as a property + using -Dbenchmark=[XXX], for example: + mvn test -Pbenchmark -Dbenchmark=NextDoubleGenerationPerformance + --> <id>benchmark</id> <properties> <skipTests>true</skipTests> @@ -108,7 +113,7 @@ <arguments> <argument>-classpath</argument> <classpath/> - <argument>org.openjdk.jmh.Main</argument> + <argument>${project.mainClass}</argument> <argument>-rf</argument> <argument>json</argument> <argument>-rff</argument> @@ -122,6 +127,61 @@ </plugins> </build> </profile> + + <profile> + <!-- Build an executable jar that runs JMH: + mvn package -Pexamples-jmh + + java -jar target/examples-jmh.jar -h + java -jar target/examples-jmh.jar NextDoubleGenerationPerformance -rf json -rff out.json + --> + <id>examples-jmh</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <compilerVersion>${maven.compiler.target}</compilerVersion> + <source>${maven.compiler.target}</source> + <target>${maven.compiler.target}</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <finalName>${uberjar.name}</finalName> + <transformers> + <transformer + implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> + <mainClass>${project.mainClass}</mainClass> + </transformer> + </transformers> + <filters> + <filter> + <!-- Shading signed JARs will fail without this. http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar --> + <artifact>*:*</artifact> + <excludes> + <exclude>META-INF/*.SF</exclude> + <exclude>META-INF/*.DSA</exclude> + <exclude>META-INF/*.RSA</exclude> + </excludes> + </filter> + </filters> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> </profiles> </project>