Hi everybody,

Currently I am trying to build up an assembly for our project. I needed a 
filtered output so I came to the shade plugin.
This is what I am doing:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.0</version>
        <executions>
                <execution>
                        <id>api</id>
                        <phase>package</phase>
                        <goals>
                                <goal>shade</goal>
                        </goals>
                        <configuration>
                                <createSourcesJar>true</createSourcesJar>
                                <shadedClassifierName>api</
shadedClassifierName>
                                <shadedArtifactId>myArtifact</
shadedArtifactId>
 
                                <shadedArtifactAttached>true</
shadedArtifactAttached>
                                <archive>
                                        <addMavenDescriptor />
                                        <compress />
                                        <forced />
                                        <index />
                                        <manifest>
                                                <addClasspath />
                                                <
addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                                <addExtensions />
                                                <classpathLayoutType />
                                                <
classpathMavenRepositoryLayout />
                                                <classpathPrefix />
                                                <customClasspathLayout />
                                                <mainClass />
                                                <packageName />
                                        </manifest>
                                        <manifestEntries>
                                                <!-- <key>value</key> -->
                                        </manifestEntries>
                                        <manifestFile />
                                        <pomPropertiesFile />
                                </archive>
                                <artifactSet>
                                        <includes>
                                                <include>*:*</include>
                                        </includes>
                                        <excludes>
                                                <exclude>de.my.company:
myDLL</exclude>
                                        </excludes>
                                </artifactSet>
                                <filters>
                                        <filter>
                                                <artifact>*:*</artifact>
                                                <includes>
                                                        <include>
de/my/company/package1/*</include>
                                                        <include>
de/my/company/package2/*</include>
                                                        <include>
de/my/company/package3/**</include>
                                                        <include>
de/my/company/package4/api/**</include>
                                                </includes>
                                        </filter>
                                </filters>
                        </configuration>
                </execution>
                <execution>
                        <id>full</id>
                        <phase>package</phase>
                        <goals>
                                <goal>shade</goal>
                        </goals>
                        <configuration>
                                <createSourcesJar>true</createSourcesJar>
                                <shadedClassifierName>full</
shadedClassifierName>
                                <shadedArtifactId>myArtifact</
shadedArtifactId>
                                <shadedArtifactAttached>true</
shadedArtifactAttached>
                                <archive>
                                        <addMavenDescriptor />
                                        <compress />
                                        <forced />
                                        <index />
                                        <manifest>
                                                <addClasspath />
                                                <
addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                                <addExtensions />
                                                <classpathLayoutType />
                                                <
classpathMavenRepositoryLayout />
                                                <classpathPrefix />
                                                <customClasspathLayout />
                                                <mainClass />
                                                <packageName />
                                        </manifest>
                                        <manifestEntries>
                                                <!-- <key>value</key> -->
                                        </manifestEntries>
                                        <manifestFile />
                                        <pomPropertiesFile />
                                </archive>
                                <artifactSet>
                                        <includes>
                                                <include>*:*</include>
                                        </includes>
                                        <excludes>
                                                <exclude>
de.my.company:excludedArtifact</exclude>
                                        </excludes>
                                </artifactSet>
                        </configuration>
                </execution>
        </executions>
</plugin>

As you might have seen, I want to have 4 artifacts: api.jar, 
api-sources.jar, full.jar, full-sources.jar.
As this is my assembly project, I would like to have all modules built, 
before distributing. Therefore I inserted the modules. Now I need to have 
packaging:pom (and not packaging:jar) in the pom.xml. The artifacts (api, 
full + sources) are built correctly, but as pom instead of jar. 
<outputFile> does not do the trick, cause I need sources and "normal" jar 
separated.

 Can I override the packaging in the shade plugin? Any other hints?


Mit freundlichen Gr??en / Best regards

Jan Engler
Central Research & Development

SICK AG
Erwin-Sick-Str. 1
79183 Waldkirch, Germany

Phone +49 7681 202-3214
mailto:jan.eng...@sick.de
http://www.sick.com

 
 
SICK AG - Sitz: Waldkirch i. Br. - Handelsregister: Freiburg i. Br. HRB 
280355 
Vorstand: Dr. Robert Bauer (Vorsitzender)  -  Reinhard B?sl  -  Dr. Martin 
Kr?mer  -  Markus Paschmann  -  Markus Vatter 
Aufsichtsrat: Gisela Sick (Ehrenvorsitzende) - Klaus M. Bukenberger 
(Vorsitzender) 

Reply via email to