我一直在尝试将服务迁移到Java 9,尽管我可以编译并运行脂肪。库的拆分软件包问题vertx-hk2和vertx.jersey,因为两个库都有完全相同的软件包 com.englishtown.ervertx.hk2
我试图用诸如(修补模型,不包括(之类的想法解决这个问题,但似乎没有什么作用,我不能仅仅排除其中一个,因为两者对于服务运行都是必不可少的。
当Intellij试图执行服务时,这种情况发生
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Modules vertx.jersey and vertx.hk2 export package com.englishtown.vertx.hk2 to module kryo.serializers
Process finished with exit code 1
,原因很清楚
所以我想向某人寻求帮助,您是如何设法运行的?
P.S:我向项目所有者https://github.com/ef-labs/vertx-hk2/issues/8
我找到了一种克服该问题的方法,我基本上将两个包装的罐子遮蔽成一个罐子,POM看起来很简单,就像
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<!-- put your configurations here -->
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>com.englishtown.vertx:vertx-hk2</include>
<include>com.englishtown.vertx:vertx-jersey</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
没有理想的解决方案,但它起作用,阴影罐合并了包装,两个库都可以在同一模块中共存。