默认情况下,插件会将项目的主要工件替换为阴影工件。如果原始工件和阴影工件都应安装/部署到存储库,则可以配置插件以将阴影工件附加为辅助工件:
<project> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.2.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <shadedArtifactAttached>true</shadedArtifactAttached> <shadedClassifierName>jackofall</shadedClassifierName> <!-- Any name that makes sense --> </configuration> </execution> </executions> </plugin> </plugins> </build> ... </project>
通过附加分类器将阴影伪影与主要伪影区分开来。