WestCoastProjects
WestCoastProjects

Reputation: 63032

Maven shade plugin usage

The following section shows the configuration for the shade plugin in my pom.xml:

 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>2.4</version>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>shade</goal>
        </goals>
        <configuration>
          <artifactSet>
            <excludes>
              <exclude>META-INF/*.SF</exclude> 
              <exclude>META-INF/*.DSA</exclude> 
              <exclude>META-INF/*.RSA</exclude> 
              <exclude>META-INF/ECLIPSE*</exclude> 
          </excludes>
          </artifactSet>
        </configuration>
      </execution>
    </executions>
  </plugin>

However some files that were (it seems??) excluded were sneaking into the output jar file:

02:19:43/xt $jar -tvf target/ignitedemo-1.0-SNAPSHOT.jar | grep  META | egrep "RSA|DSA|SF"
  9958 Sun Jul 05 02:19:26 PDT 2015 META-INF/ECLIPSEF.SF
  5639 Sun Jul 05 02:19:26 PDT 2015 META-INF/ECLIPSEF.RSA

So then what is incorrect in the shade plugin configuration?

Upvotes: 0

Views: 315

Answers (2)

Robert Scholte
Robert Scholte

Reputation: 12335

With artifactSet you specify which artifacts should be excluded. You must use filters, see http://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html

(ps. how this you get to your pom configuration?)

Upvotes: 1

Stefan Ferstl
Stefan Ferstl

Reputation: 5255

<artifactSet> is used to include/exclude artifacts but it is not the right place to exclude single files.

You need to use <filters> for that:

<filter>
  <artifact>*:*</artifact>
  <excludes>
    <exclude>META-INF/*.SF</exclude> 
    <exclude>META-INF/*.DSA</exclude> 
    <exclude>META-INF/*.RSA</exclude> 
    <exclude>META-INF/ECLIPSE*</exclude> 
  </excludes>
</filter>

Upvotes: 1

Related Questions