lilalinux
lilalinux

Reputation: 3031

Maven Shade Plugin not including resources of dependency

I'm using the Maven Shade Plugin to include all dependencies during package phase. That works fine for classes, but dependent resources aren't included.

Here's the layout of the dependent jar:

./config.properties <-- this is the missing resource
./META-INF
./META-INF/MANIFEST.MF
./META-INF/maven
./META-INF/maven/com.example
./META-INF/maven/com.example/bar
./META-INF/maven/com.example/bar/pom.properties
./META-INF/maven/com.example/bar/pom.xml

Here's the shade plugin configuration:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>1.6</version>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>shade</goal>
        </goals>
        <configuration>
          <transformers>
            <transformer
              implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
              <manifestEntries>
                <Main-Class>com.example.foo.Foo</Main-Class>
                <!-- <X-Compile-Source-JDK>${maven.compile.source}</X-Compile-Source-JDK>.
                  <X-Compile-Target-JDK>${maven.compile.target}</X-Compile-Target-JDK> -->
              </manifestEntries>
            </transformer>
          </transformers>
          <filters>
            <filter>
              <!--
                Exclude files that sign a jar
                (one or multiple of the dependencies).
                One may not repack a signed jar without
                this, or you will get a
                SecurityException at program start.
              -->
              <artifact>*:*</artifact>
              <excludes>
                <exclude>META-INF/*.SF</exclude>
                <exclude>META-INF/*.RSA</exclude>
                <exclude>META-INF/*.INF</exclude> <!-- This one may not be required -->
              </excludes>
            </filter>
          </filters>
        </configuration>
      </execution>
    </executions>
  </plugin>

Upvotes: 1

Views: 4151

Answers (1)

lilalinux
lilalinux

Reputation: 3031

It's embarrasing, but there was a typo in the version of the dependency and that version didn't have the file.

Upvotes: 2

Related Questions