Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从混合了Java和Kotlin的项目中使用maven创建runnable/uber jar_Java_Maven_Kotlin - Fatal编程技术网

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

从混合了Java和Kotlin的项目中使用maven创建runnable/uber jar,java,maven,kotlin,Java,Maven,Kotlin,我有一个Java项目,我使用maven解决依赖关系,并构建自包含、可运行的/uber jar(目前通过maven shade插件),我想开始尝试将Kotlin混合到项目中,以获得一些新功能 使用maven创建一个由Java(主要)和Kotlin组成的可运行/uber jar是否相对简单,并且/或者受支持?或者我是在看一个把一堆东西粘在一起的黑客工作,如果做得好的话,这些东西可能会起作用?Kotlin不是一个需求,但因为它应该能够自由地与Java混合,所以我一直想在这个项目上试用它。真的想知道这是

我有一个Java项目,我使用maven解决依赖关系,并构建自包含、可运行的/uber jar(目前通过maven shade插件),我想开始尝试将Kotlin混合到项目中,以获得一些新功能

使用maven创建一个由Java(主要)和Kotlin组成的可运行/uber jar是否相对简单,并且/或者受支持?或者我是在看一个把一堆东西粘在一起的黑客工作,如果做得好的话,这些东西可能会起作用?Kotlin不是一个需求,但因为它应该能够自由地与Java混合,所以我一直想在这个项目上试用它。真的想知道这是一罐虫子,还是没什么大不了的(如果是nbd,最好的研究方向?)

这里是我的pom.xml的build部分,您可以看到我目前是如何创建它的

<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>

我的服务器
src/main/resources
真的
org.apache.maven.plugins
maven jar插件
3.0.0
org.apache.maven.plugins
maven阴影插件
2.4.3
包裹
阴凉处
*:*
META-INF/*.SF
META-INF/*.DSA
META-INF/*.RSA
com.mycompany.myproject.mymainclass
org.apache.maven.plugins
maven编译器插件
3.6.0
1.8
1.8
有人做过这样的事吗?简单?还是离我远点?