shade plugin not wanting to work

Discussion in 'Spigot Plugin Development' started by bys1, Jun 4, 2017.

  1. Code (Text):

    MBA-10-09:core bys1$ mvn -e
    [INFO] Error stacktraces are turned on.
    [INFO] Scanning for projects...
    [INFO]                                                                        
    [INFO] ------------------------------------------------------------------------
    [INFO] Building core 1.0
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ core ---
    [INFO] Deleting /Users/bys1/Desktop/Plugins/core/target
    [INFO]
    [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ core ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 1 resource to .
    [INFO]
    [INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ core ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 25 source files to /Users/bys1/Desktop/Plugins/core/target/classes
    [INFO]
    [INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ core ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory /Users/bys1/Desktop/Plugins/core/src/test/resources
    [INFO]
    [INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) @ core ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 1 source file to /Users/bys1/Desktop/Plugins/core/target/test-classes
    [INFO]
    [INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ core ---
    [INFO] Surefire report directory: /Users/bys1/Desktop/Plugins/core/target/surefire-reports

    -------------------------------------------------------
     T E S T S
    -------------------------------------------------------
    Running eu.taigacraft.core.AppTest
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.038 sec

    Results :

    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

    [INFO]
    [INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ core ---
    [INFO] Building jar: /Users/bys1/Desktop/Plugins/core/target/TaigaCore_v1.0.jar
    [INFO]
    [INFO] --- maven-shade-plugin:1.4:shade (default) @ core ---
    [INFO] Including com.github.InventivetalentDev:SpigetDownloader:jar:10cd5e8 in the shaded jar.
    [INFO] Including commons-io:commons-io:jar:2.5 in the shaded jar.
    [INFO] Including eu.taigacraft:core-api:jar:api in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_8_R1:jar:1_8_R1 in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_8_R2:jar:1_8_R2 in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_8_R3:jar:1_8_R3 in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_9_R1:jar:1_9_R1 in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_9_R2:jar:1_9_R2 in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_10_R1:jar:1_10_R1 in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_11_R1:jar:1_11_R1 in the shaded jar.
    [INFO] Including mysql:mysql-connector-java:jar:6.0.6 in the shaded jar.
    [INFO] Including org.xerial:sqlite-jdbc:jar:3.16.1 in the shaded jar.
    [INFO] Including org.mariadb.jdbc:mariadb-java-client:jar:1.5.9 in the shaded jar.
    [INFO] Including redis.clients:jedis:jar:2.6.2 in the shaded jar.
    [INFO] Including org.apache.commons:commons-pool2:jar:2.3 in the shaded jar.
    [INFO] Minimizing jar eu.taigacraft:core:jar:1.0
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 22.014s
    [INFO] Finished at: Sun Jun 04 11:03:22 CEST 2017
    [INFO] Final Memory: 20M/198M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:1.4:shade (default) on project core: Error creating shaded jar: 26368 -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:1.4:shade (default) on project core: Error creating shaded jar: 26368
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating shaded jar: 26368
        at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:503)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
    Caused by: java.lang.ArrayIndexOutOfBoundsException: 26368
        at org.objectweb.asm.ClassReader.readClass(Unknown Source)
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at org.vafer.jdependency.Clazzpath.addClazzpathUnit(Clazzpath.java:94)
        at org.apache.maven.plugins.shade.filter.MinijarFilter.<init>(MinijarFilter.java:73)
        at org.apache.maven.plugins.shade.mojo.ShadeMojo.getFilters(ShadeMojo.java:696)
        at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:438)
        ... 21 more
    [ERROR]
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
     
    Code (Text):

    <?xml version="1.0" encoding="UTF-8"?>
    <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>eu.taigacraft</groupId>
      <artifactId>core</artifactId>
      <version>1.0</version>
      <packaging>jar</packaging>
      <name>core</name>
      <url>http://maven.apache.org</url>
      <parent>
        <groupId>eu.taigacraft</groupId>
        <artifactId>core-parent</artifactId>
        <version>parent</version>
        <relativePath>../core-parent/pom.xml</relativePath>
      </parent>
      <build>
        <finalName>${project.name}_v${project.version}</finalName>
        <defaultGoal>clean package install</defaultGoal>
        <resources>
          <resource>
            <targetPath>.</targetPath>
            <filtering>true</filtering>
            <directory>src/main/resources</directory>
            <includes>
              <include>plugin.yml</include>
            </includes>
          </resource>
        </resources>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.1</version>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>1.4</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <finalName>${project.name}_${project.version}</finalName>
                  <minimizeJar>true</minimizeJar>
                  <artifactSet>
                    <includes>
                      <include>eu.taigacraft:core-api</include>
                      <include>eu.taigacraft:core-1_8_R1</include>
                      <include>eu.taigacraft:core-1_8_R2</include>
                      <include>eu.taigacraft:core-1_8_R3</include>
                      <include>eu.taigacraft:core-1_9_R1</include>
                      <include>eu.taigacraft:core-1_9_R2</include>
                      <include>eu.taigacraft:core-1_10_R1</include>
                      <include>eu.taigacraft:core-1_11_R1</include>
                      <include>com.github.InventivetalentDev:SpigetDownloader</include>
                      <include>commons-io:commons-io</include>
                      <include>mysql:mysql-connector-java</include>
                      <include>org.xerial:sqlite-jdbc</include>
                      <include>org.mariadb.jdbc:mariadb-java-client</include>
                      <include>redis.clients:jedis</include>
                      <include>org.apache.commons:commons-pool2</include>
                    </includes>
                  </artifactSet>
                  <relocations>
                    <relocation>
                      <pattern>org.inventivetalent.spiget.downloader</pattern>
                      <shadedPattern>eu.taigacraft.org.inventivetalent.spiget.downloader</shadedPattern>
                    </relocation>
                    <relocation>
                      <pattern>org.apache.commons.io</pattern>
                      <shadedPattern>eu.taigacraft.org.apache.commons.io</shadedPattern>
                    </relocation>
                    <relocation>
                      <pattern>com.mysql.jdbc</pattern>
                      <shadedPattern>eu.taigacraft.com.mysql.jdbc</shadedPattern>
                    </relocation>
                    <relocation>
                      <pattern>org.sqlite</pattern>
                      <shadedPattern>eu.taigacraft.org.sqlite</shadedPattern>
                    </relocation>
                    <relocation>
                      <pattern>org.mariadb.jdbc</pattern>
                      <shadedPattern>eu.taigacraft.org.mariadb.jdbc</shadedPattern>
                    </relocation>
                    <relocation>
                      <pattern>redis.clients</pattern>
                      <shadedPattern>eu.taigacraft.redis.clients</shadedPattern>
                    </relocation>
                    <relocation>
                      <pattern>org.apache.commons.pool2</pattern>
                      <shadedPattern>eu.taigacraft.org.apache.commons.pool2</shadedPattern>
                    </relocation>
                  </relocations>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <spigot.groupId>org.spigotmc</spigot.groupId>
        <spigot.artifactId>spigot-api</spigot.artifactId>
        <spigot.version>1.11.2-R0.1-SNAPSHOT</spigot.version>
      </properties>
      <dependencies>
        <dependency>
          <groupId>${spigot.groupId}</groupId>
          <artifactId>${spigot.artifactId}</artifactId>
          <version>${spigot.version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>${spigot.groupId}</groupId>
          <artifactId>${spigot.artifactId}</artifactId>
          <version>${spigot.version}</version>
          <classifier>javadoc</classifier>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>com.github.bys1</groupId>
          <artifactId>importer</artifactId>
          <version>0.5-Beta</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>com.github.InventivetalentDev</groupId>
          <artifactId>SpigetDownloader</artifactId>
          <version>10cd5e8</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>commons-io</groupId>
          <artifactId>commons-io</artifactId>
          <version>2.5</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>eu.taigacraft</groupId>
          <artifactId>core-api</artifactId>
          <version>api</version>
          <scope>compile</scope>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>eu.taigacraft</groupId>
          <artifactId>core-1_8_R1</artifactId>
          <version>1_8_R1</version>
          <scope>compile</scope>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>eu.taigacraft</groupId>
          <artifactId>core-1_8_R2</artifactId>
          <version>1_8_R2</version>
          <scope>compile</scope>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>eu.taigacraft</groupId>
          <artifactId>core-1_8_R3</artifactId>
          <version>1_8_R3</version>
          <scope>compile</scope>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>eu.taigacraft</groupId>
          <artifactId>core-1_9_R1</artifactId>
          <version>1_9_R1</version>
          <scope>compile</scope>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>eu.taigacraft</groupId>
          <artifactId>core-1_9_R2</artifactId>
          <version>1_9_R2</version>
          <scope>compile</scope>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>eu.taigacraft</groupId>
          <artifactId>core-1_10_R1</artifactId>
          <version>1_10_R1</version>
          <scope>compile</scope>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>eu.taigacraft</groupId>
          <artifactId>core-1_11_R1</artifactId>
          <version>1_11_R1</version>
          <scope>compile</scope>
          <optional>true</optional>
        </dependency>
        <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <version>6.0.6</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.xerial</groupId>
          <artifactId>sqlite-jdbc</artifactId>
          <version>3.16.1</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.mariadb.jdbc</groupId>
          <artifactId>mariadb-java-client</artifactId>
          <version>1.5.9</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>redis.clients</groupId>
          <artifactId>jedis</artifactId>
          <version>2.6.2</version>
          <type>jar</type>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.commons</groupId>
          <artifactId>commons-pool2</artifactId>
          <version>2.3</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </project>
     
     
  2. electronicboy

    IRC Staff

    update your pom file to use maven shade 2.4.3
     
  3. oops, that worked. Thanks!

    Next problem: I'm getting a 16mb file now... What am I doing wrong?
     
  4. electronicboy

    IRC Staff

    Code (Text):

    [INFO] --- maven-shade-plugin:1.4:shade (default) @ core ---
    [INFO] Including com.github.InventivetalentDev:SpigetDownloader:jar:10cd5e8 in the shaded jar.
    [INFO] Including commons-io:commons-io:jar:2.5 in the shaded jar.
    [INFO] Including eu.taigacraft:core-api:jar:api in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_8_R1:jar:1_8_R1 in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_8_R2:jar:1_8_R2 in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_8_R3:jar:1_8_R3 in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_9_R1:jar:1_9_R1 in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_9_R2:jar:1_9_R2 in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_10_R1:jar:1_10_R1 in the shaded jar.
    [INFO] Including eu.taigacraft:core-1_11_R1:jar:1_11_R1 in the shaded jar.
    [INFO] Including mysql:mysql-connector-java:jar:6.0.6 in the shaded jar.
    [INFO] Including org.xerial:sqlite-jdbc:jar:3.16.1 in the shaded jar.
    [INFO] Including org.mariadb.jdbc:mariadb-java-client:jar:1.5.9 in the shaded jar.
    [INFO] Including redis.clients:jedis:jar:2.6.2 in the shaded jar.
    [INFO] Including org.apache.commons:commons-pool2:jar:2.3 in the shaded jar.
     
    including all of that.

    might wanna check the individual sizes and that you've not done something stupid like shade something you shouldn't have into your other components
     
  5. scr01.jpg It seems to contain eclipse shit...

    edit. the SpigetDownloader seems to be 16,1mb. Will look into it
     
    #5 bys1, Jun 4, 2017
    Last edited: Jun 4, 2017