以下是我的 pom.xml 在多模块项目中的结构
模块 A pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
当我通过以下方式在构建阶段添加 maven jar 插件时
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<extensions>false</extensions>
<inherited>true</inherited>
<configuration>
<classifier>project-classifier</classifier>
</configuration>
这给出了一个错误:
无法创建阴影工件,项目主要工件不存在。将这些插件一起使用的正确方法是什么?jar 插件应该是父 pom 的一部分吗?