我有一个父项目和一些子项目。一些孩子彼此之间有依赖性。例如:父->子1,父->子2,子1->子2(子1取决于子2)这是我在pom中正在做的事情:
<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级别运行。
我注意到,即使在站点运行时,三叶草也会尝试在target / clover /文件夹中创建带阴影的jar。
任何帮助表示赞赏。
使用配置文件启用/禁用带阴影的插件。
<profiles>
<profile>
<id>shade</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句