[ https://issues.apache.org/jira/browse/MSHADE-154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16438867#comment-16438867 ]
Igor Dvorzhak commented on MSHADE-154: -------------------------------------- I found workaround, you need to package both main jar and jar with classifier and then detach main jar from project after shading: {code:xml} <!-- Package both main jar and jar with classifier --> <plugin> <artifactId>maven-jar-plugin</artifactId> <goals> <goal>jar</goal> </goals> <executions> <execution> <id>classifier-jar</id> <goals> <goal>jar</goal> </goals> <configuration> <classifier>${classifier}</classifier> </configuration> </execution> </executions> </plugin> <!-- Shade main jar --> <plugin> <artifactId>maven-shade-plugin</artifactId> . . . </plugin> <!-- Remove main jar from project after shading --> <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> <executions> <execution> <id>remove-primary-artifact</id> <phase>package</phase> <goals> <goal>execute</goal> </goals> <configuration> <source>project.getArtifact().setFile(null)</source> </configuration> </execution> </executions> </plugin> {code} > Add ability for shade to find primary artifact from attached artifacts > (similar to assembly-plugin) > --------------------------------------------------------------------------------------------------- > > Key: MSHADE-154 > URL: https://issues.apache.org/jira/browse/MSHADE-154 > Project: Maven Shade Plugin > Issue Type: New Feature > Affects Versions: 2.0 > Environment: all > Reporter: Richard Sand > Priority: Major > Attachments: patch.txt, patch139and154.txt > > > When switching from assembly-plugin to shade-plugin for a given project, I > discovered that the shade plugin did not have the capability of using an > attached artifact as the primary artifact - only the project's main artifact > was supported. > I've attached changes to add a configuration parameter > "alternativeInputClassifier", which, when specified, tells the plugin to look > for an artifact with the specified classifier in the project attachments, and > to use that as the primary artifact. This makes shade behave similar to > assembly-plugin, and allows shade to recognize attached artifacts generated > by previous plugins in a maven execution. > This was a trivial change, but required modifying several other classes and > methods to accept the "primary" artifact as a parameter instead of a global > variable. IMHO these changes are good for the plugin as a whole, as it will > allow for future flexibility and logic for determining the entrypoint for the > plugin (e.g. being able to run as a standalone goal with a specific artifact > as input). -- This message was sent by Atlassian JIRA (v7.6.3#76005)