All Downloads are FREE. Search and download functionalities are using the official Maven repository.

archetype-resources.pom.xml Maven / Gradle / Ivy

There is a newer version: 1.37
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>\${groupId}</groupId>
    <artifactId>\${artifactId}</artifactId>
    <version>\${version}</version>
    <packaging>jar</packaging>

    <name>JMH benchmark sample: Kotlin</name>

    <!--
       This is the example build script for building Kotlin benchmarks with JMH.
       It needs a proper dependency on Kotlin library to compile, as well as
       the plugin version set to most recent Kotlin compiler.
     -->

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <prerequisites>
        <maven>3.0.4</maven>
    </prerequisites>

    <dependencies>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-generator-bytecode</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!--
          Put the dependency on Kotlin stdlib here:
            org.jetbrains.kotlin:kotlin-stdlib:0.6.2517 is one of the choices
         -->
    </dependencies>

    <build>
        <plugins>
            <!--
                1. Compile Kotlin sources first.
            -->

            <plugin>
                <artifactId>kotlin-maven-plugin</artifactId>
                <groupId>org.jetbrains.kotlin</groupId>
                <!--
                   Put an approriate Kotlin compiler version here.
                 -->
                <version>PUT_THE_VERSION_HERE</version>

                <executions>
                    <execution>
                        <id>process-sources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>src/main/kotlin</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>

                    <execution>
                        <id>process-test-sources</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!--
                2. Invoke JMH generators to produce benchmark code
            -->

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>org.openjdk.jmh.generators.bytecode.JmhBytecodeGenerator</mainClass>
                            <arguments>
                                <argument>target/classes/</argument>
                                <argument>target/generated-sources/jmh/</argument>
                                <argument>target/classes/</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!--
                3. Add JMH generated code to the compile session.
            -->

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>target/generated-sources/jmh</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!--
                4. Compile JMH generated code.
             -->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <compilerVersion>1.6</compilerVersion>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-proc:none</compilerArgument>
                </configuration>
            </plugin>

            <!--
                5. Package all the dependencies into the JAR
             -->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <finalName>microbenchmarks</finalName>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>org.openjdk.jmh.Main</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

</project>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy