Maven shade plugin isn't placing dependency class files into jar

deletethis

My Maven project uses an external library as a dependency, com.sk89q.intake:intake, which I'm trying to package into my jar via the maven-shade-plugin. When building the project, the resulting jar does not contain any of the class files of com.sk89q.intake:intake. During the build process, I get this message, but the build continues on and succeeds:

[INFO] --- maven-shade-plugin:2.4.2:shade (default) @ EventManagerPlugin
[INFO] No artifact matching filter com.sk89q.intake:intake

Why is this happening? I'm able to download, access, and use the dependency in my project, so there shouldn't be anything wrong with naming of the artifact.

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>deletethis.eventmanager</groupId>
    <artifactId>EventManagerPlugin</artifactId>
    <version>1.0.0-beta1</version>
    <repositories>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>maven.sk89q.com</id>
            <url>http://maven.sk89q.com/repo/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
           <groupId>org.spigotmc</groupId>
           <artifactId>spigot-api</artifactId>
           <version>1.8.8-R0.1-SNAPSHOT</version>
           <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>bukkit</artifactId>
            <version>1.8.8-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.sk89q.intake</groupId>
            <artifactId>intake</artifactId>
            <version>4.2-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Built-By>deletethis</Built-By>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <filters>
                                <filter>
                                    <artifact>com.sk89q.intake:intake</artifact>
                                    <includes>
                                        <include>com/sk89q/intake/**</include>
                                    </includes>
                                </filter>
                            </filters>
                            <relocations>
                                <relocation>
                                    <pattern>com.sk89q.intake</pattern>
                                    <shadedPattern>deletethis.eventmanager.lib.com.sk89q.intake</shadedPattern>
                                </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

As you can see, I am including the com.sk89q.intake:intake artifact. I have looked through the maven-shade-plugin documentation and don't see what I'm doing wrong. The naming is consistent with everything I have found online; that is, groupId:artifactId.

I have also tried building without the <relocation> class relocation tags to see if they were interfering.

It may be useful to know that I'm using M2Eclipse and building with the clean install goals.

Tunaki

The problem is that your are declaring the com.sk89q.intake:intake dependency with the provided scope.

Provided dependency are expected to be provided by the container at runtime so the maven-shade-plugin will not add it to your shaded jar. As such, you need to remove the provided scope from the dependency declaration:

<dependency>
    <groupId>com.sk89q.intake</groupId>
    <artifactId>intake</artifactId>
    <version>4.2-SNAPSHOT</version>
</dependency>

Relevant build log after this change:

[INFO] --- maven-shade-plugin:2.4.2:shade (default) @ test ---
[INFO] Including com.sk89q.intake:intake:jar:4.2-SNAPSHOT in the shaded jar.
[INFO] Including com.google.guava:guava:jar:18.0 in the shaded jar.
[INFO] Including com.google.code.findbugs:jsr305:jar:3.0.0 in the shaded jar.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Include dependency in maven shade plugin

From Dev

maven-dependency-plugin: exclude .jar files

From Dev

Maven: exclude dependency from shade plugin

From Dev

Preserving timestamps on Clojure .clj files when building shaded jar via Maven Shade Plugin

From Dev

Preserving timestamps on Clojure .clj files when building shaded jar via Maven Shade Plugin

From Dev

Maven jar plugin - Wrong Class-Path entry for SNAPSHOT dependency

From Dev

maven-shade-plugin : exclude a dependency and all its transitive dependencies

From Dev

Maven-shade-plugin, uber-jar and overlapping classes

From Dev

How to add resources to jar using maven shade plugin

From Dev

Maven assembly or shade plugin - How to exclude sources from jar?

From Dev

How to add resources to jar using maven shade plugin

From Dev

Create runnable jar with maven 3.1 using maven-dependency-plugin doesn't create runnable jar

From Dev

Maven Plugin Dependency : class not found

From Dev

maven-shade-plugin class path resource issue

From Dev

maven-shade-plugin class path resource issue

From Dev

Maven dependency plugin copy jar with dependencies

From Dev

Use local jar as artifact in maven dependency plugin?

From Dev

Maven isn't pulling my dependency

From Dev

Maven isn't pulling my dependency

From Dev

maven shade plugin custom transformer

From Dev

Jersey problems with Maven - Shade Plugin

From Dev

Maven shade plugin remove "original"

From Dev

How to include tools.jar into uberjar (using maven-shade-plugin)?

From Dev

How does the Maven shade plugin decide which dependencies to put into the final jar when using the minimizeJar function?

From Dev

use maven shade plugin like assembly plugin

From Dev

Shade Plugin Harcording Dependency For Excluded Artifact also

From Dev

Dependency Error AspectJ Maven Plugin Installation For com:sun:tools:jar

From Dev

How to use maven assembly plugin to exclude a package from dependency jar?

From Dev

Maven dependency plugin - download the jar during packaging phase

Related Related

  1. 1

    Include dependency in maven shade plugin

  2. 2

    maven-dependency-plugin: exclude .jar files

  3. 3

    Maven: exclude dependency from shade plugin

  4. 4

    Preserving timestamps on Clojure .clj files when building shaded jar via Maven Shade Plugin

  5. 5

    Preserving timestamps on Clojure .clj files when building shaded jar via Maven Shade Plugin

  6. 6

    Maven jar plugin - Wrong Class-Path entry for SNAPSHOT dependency

  7. 7

    maven-shade-plugin : exclude a dependency and all its transitive dependencies

  8. 8

    Maven-shade-plugin, uber-jar and overlapping classes

  9. 9

    How to add resources to jar using maven shade plugin

  10. 10

    Maven assembly or shade plugin - How to exclude sources from jar?

  11. 11

    How to add resources to jar using maven shade plugin

  12. 12

    Create runnable jar with maven 3.1 using maven-dependency-plugin doesn't create runnable jar

  13. 13

    Maven Plugin Dependency : class not found

  14. 14

    maven-shade-plugin class path resource issue

  15. 15

    maven-shade-plugin class path resource issue

  16. 16

    Maven dependency plugin copy jar with dependencies

  17. 17

    Use local jar as artifact in maven dependency plugin?

  18. 18

    Maven isn't pulling my dependency

  19. 19

    Maven isn't pulling my dependency

  20. 20

    maven shade plugin custom transformer

  21. 21

    Jersey problems with Maven - Shade Plugin

  22. 22

    Maven shade plugin remove "original"

  23. 23

    How to include tools.jar into uberjar (using maven-shade-plugin)?

  24. 24

    How does the Maven shade plugin decide which dependencies to put into the final jar when using the minimizeJar function?

  25. 25

    use maven shade plugin like assembly plugin

  26. 26

    Shade Plugin Harcording Dependency For Excluded Artifact also

  27. 27

    Dependency Error AspectJ Maven Plugin Installation For com:sun:tools:jar

  28. 28

    How to use maven assembly plugin to exclude a package from dependency jar?

  29. 29

    Maven dependency plugin - download the jar during packaging phase

HotTag

Archive