And*_*ite 15 intellij-idea maven
我有两个模块,组件和应用程序.由于构建过程中稍后的依赖性冲突(谷歌协议缓冲区),组件模块被着色.
<!-- snip from Component's pom.xml -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<relocations>
<relocation>
<pattern>com.google.protobuf</pattern>
<shadedPattern>my.package.protocols.shaded.com.google.protobuf</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
应用程序取决于组件模块.但是,Application中的源文件无法引用Component所依赖的着色库.这对于与Component进行交互至关重要.
<-- snip from Application's pom.xml -->
<dependency>
<groupId>my-group</groupId>
<artifactId>component</artifactId>
<version>${project.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
尽管IntelliJ无法找到导入,但Maven构建工作正常.我错过了什么/做错了什么?
太糟糕了,在使用JetBrains打开机票后,此问题先前已报告过,目前在IntelliJ中不受支持.
小智 5
build-helper-maven-plugin 似乎将阴影 jar 添加到 IntelliJ 项目中:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>compile</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${basedir}/target/<YOUR JAR NAME>-SNAPSHOT.jar</file>
<type>jar</type>
<classifier>optional</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请参阅https://www.mojohaus.org/build-helper-maven-plugin/attach-artifact-mojo.html。
| 归档时间: |
|
| 查看次数: |
4500 次 |
| 最近记录: |