我有父项目和一些子项目。有些孩子之间有依赖关系。例如:父母 -> 孩子 1,父母 -> 孩子 2,孩子 1 -> 孩子 2(孩子 1 依赖于孩子 2)这是我在 poms 中所做的事情:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<version>3.1.10.1</version>
<configuration>
<jdk>${compile.source}</jdk>
<generateHtml>true</generateHtml>
<generatePdf>false</generatePdf>
<generateXml>true</generateXml>
</configuration>
<executions>
<execution>
<phase>pre-site</phase>
<goals>
<goal>instrument</goal>
</goals>
</execution>
</executions>
</plugin>
<reportPlugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<version>3.1.10.1</version>
<configuration>
<jdk>${compile.source}</jdk>
<generateHtml>true</generateHtml>
<generatePdf>false</generatePdf>
<generateXml>true</generateXml>
</configuration>
</plugin>
</reportPlugins>
子 pom 看起来像这样:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/LICENSE</exclude>
<exclude>config.properties</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.cerner.pophealth.program.runtime.pipeline.Main</mainClass>
</transformer>
</transformers>
</configuration>
</plugin>
我面临 mvm site-deploy 将失败并出现以下错误的问题:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:1.7.1:shade (default) on project foo: Error creating shaded jar: error in opening zip file /foo/bar/target/classes -> [Help 1]
mvn site-deploy 从 foo-parent 级别运行。
我注意到即使在运行站点时 clover 也会尝试在 target/clover/ 文件夹中创建阴影 jar。
任何帮助表示赞赏。