使用混合了Java和Kotlin的项目创建maven的runnable / uber jar

时间:2017-09-15 18:31:19

标签: java maven kotlin

我有一个Java项目,我使用maven进行依赖项解析并构建自包含的,runnable / uber jar(目前通过maven-shade-plugin),我想开始将Kotlin混合到项目中一些新功能。

使用maven创建一个由Java(主要)和Kotlin组成的可运行/超级jar,这些jar相对简单易用和/或支持?或者,我是否正在寻找将一堆可能有效的东西粘合在一起的黑客工作? Kotlin不是一个要求,但因为它应该能够与Java自由混合,所以我一直想尝试这个项目。真的想要判断它是否是一堆蠕虫,或者没什么大不了的(如果它是nbd,最好的方向来调查?)

这是我的pom.xml的构建部分,因此您可以看到我当前是如何创建的

<build>
    <finalName>my-server</finalName>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.0.0</version>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.4.3</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <!-- exclude signatures -->
                        <filters>
                            <filter>
                                <artifact>*:*</artifact>
                                <excludes>
                                    <exclude>META-INF/*.SF</exclude>
                                    <exclude>META-INF/*.DSA</exclude>
                                    <exclude>META-INF/*.RSA</exclude>
                                </excludes>
                            </filter>
                        </filters>

                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <manifestEntries>
                                    <Main-Class>com.mycompany.myproject.mymainclass</Main-Class>
                                </manifestEntries>
                            </transformer>
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

任何人都有这样的经历吗?简单?或者只是远离?

0 个答案:

没有答案
相关问题