Solved maven shade fails to work

Discussion in 'Plugin Help/Development/Requests' started by xize, Dec 25, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    xize

    Hello,

    it seems that my shading isn't working corectly but I don't know why as Im very sure it did worked in the past atleast for the simple json.

    normally you should see in the console when maven builds a project that it includes artifacts or exludes it but for some reason it only shows that it copied the shaded artifact, when I look inside both jar files I don't see the packages are added.

    my pom format:
    Code:
    <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>tv.mineinthebox.essentials</groupId>
    	<artifactId>xEssentials</artifactId>
    	<version>3.8-SNAPSHOT</version>
    	<build>
    		<sourceDirectory>${project.basedir}</sourceDirectory>
    		<resources>
    			<resource>
    				<targetPath>.</targetPath>
    				<filtering>true</filtering>
    				<directory>.</directory>
    				<includes>
    					<include>plugin.yml</include>
    					<include>LICENSE_GPL3.txt</include>
    					<include>LICENSE_MIT.txt</include>
    				</includes>
    			</resource> 
    		</resources>
    		<plugins>
    			<plugin>
    				<artifactId>maven-compiler-plugin</artifactId>
    				<version>3.1</version>
    				<configuration>
    					<encoding>UTF-8</encoding>
    					<source>1.6</source>
    					<target>1.6</target>
    				</configuration>
    			</plugin>
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-shade-plugin</artifactId>
    				<version>1.5</version>
    				<executions>
    					<execution>
    						<phase>package</phase>
    						<goals>
    							<goal>shade</goal>
    						</goals>
    						<configuration>
    							<artifactSet>
    								<includes>
    									<include>com.googlecode.json-simple:json-simple*:jar:*</include>
    									<include>tv.mineinthebox.essentials.minigames*:jar:*</include>
    								</includes>
    							</artifactSet>
    							<relocations>
    								<relocation>
    									<pattern>com.googlecode.json-simple</pattern>
    									<shadedPattern>com.googlecode.json-simple</shadedPattern>
    									<pattern>tv.mineinthebox.essentials.minigames</pattern>
    									<shadedPattern>tv.mineinthebox.essentials.minigames</shadedPattern>
    								</relocation>
    							</relocations>
    							<filters>
    								<filter>
    									<artifact>*</artifact>
    									<excludes>
    										<exclude>META-INF/*.SF</exclude>
    										<exclude>META-INF/*.RSA</exclude>
    										<exclude>META-INF/*.INF</exclude>
    									</excludes>
    								</filter>
    							</filters>
    						</configuration>
    					</execution>
    				</executions>
    			</plugin>
    		</plugins>
    	</build>
    	<repositories>
    		<repository>
    			<id>spigot-repo</id>
    			<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
    		</repository>
    		<repository>
    			<id>sk89q-repo</id>
    			<url>http://maven.sk89q.com/repo/</url>
    		</repository>
    		<repository>
    			<id>comphenix-repo</id>
    			<url>http://repo.comphenix.net/content/groups/public</url>
    		</repository>
    		<repository>
    			<id>lwc</id>
    			<url>http://andune.com/nexus/content/repositories/public/</url>
    		</repository>
    		<repository>
    			<id>vault-repo</id>
    			<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
    		</repository>
    		<repository>
    			<id>mitb-repo</id>
    			<url>http://ci.mineinthebox.tv:8080/plugin/repository/everything/</url>
    		</repository>
    	</repositories>
    	<dependencies>
    		<dependency>
    			<groupId>com.sk89q</groupId>
    			<artifactId>worldedit</artifactId>
    			<scope>provided</scope>
    			<version>LATEST</version>
    		</dependency>
    		<dependency>
    			<groupId>com.sk89q</groupId>
    			<artifactId>worldguard</artifactId>
    			<scope>provided</scope>
    			<version>LATEST</version>
    		</dependency>
    		<dependency>
    			<groupId>com.comphenix.protocol</groupId>
    			<artifactId>ProtocolLib</artifactId>
    			<scope>provided</scope>
    			<version>LATEST</version>
    		</dependency>
    		<dependency>
    			<groupId>com.googlecode.json-simple</groupId>
    			<artifactId>json-simple</artifactId>
    			<scope>provided</scope>
    			<version>LATEST</version>
    		</dependency>
    		<dependency>
    			<groupId>net.milkbowl.vault</groupId>
    			<artifactId>Vault</artifactId>
    			<scope>provided</scope>
    			<version>1.2.30</version>
    		</dependency>
    		<dependency>
    			<groupId>com.griefcraft</groupId>
    			<artifactId>LWC</artifactId>
    			<version>4.2.0</version>
    			<scope>provided</scope>
    		</dependency>
    		<dependency>
    			<artifactId>tv.mineinthebox.manco</artifactId>
    			<groupId>ManCo</groupId>
    			<version>2.0</version>
    			<scope>system</scope>
    			<systemPath>${project.basedir}${file.separator}repo${file.separator}ManCo-2.0.jar</systemPath>
    		</dependency>
    		<dependency>
    			<groupId>com.vexsoftware</groupId>
    			<artifactId>votifier</artifactId>
    			<version>1.9</version>
    			<scope>system</scope>
    			<systemPath>${project.basedir}${file.separator}repo${file.separator}Votifier.jar</systemPath>
    		</dependency>
    		<dependency>
    			<groupId>org.bukkit</groupId>
    			<artifactId>bukkit</artifactId>
    			<version>1.8-R0.1-SNAPSHOT</version>
    			<scope>provided</scope>
    		</dependency>
    		<dependency>
    			<groupId>tv.mineinthebox.essentials.minigames</groupId>
    			<artifactId>xMinigames</artifactId>
    			<version>0.0.1-SNAPSHOT</version>
    			<scope>provided</scope>
    		</dependency>
    	</dependencies>
    	<scm>
    		<url>https://github.com/xize/xEssentials</url>
    		<connection>scm:git:ssh://[email protected]/xize/xEssentials</connection>
    		<developerConnection>scm:git:ssh://[email protected]/xize/xEssentials.git</developerConnection>
    	</scm>
    	<organization>
    		<name>xEssentials</name>
    		<url>https://github.com/xEssentials</url>
    	</organization>
    	<ciManagement>
    		<system>jenkins</system>
    		<url>http://ci.mineinthebox.tv:8080/</url>
    	</ciManagement>
    </project>
    
    and here is my console when it builds the project odd enough it doesn't seem to scan for artifacts when shading process should occur:
    Code:
    [INFO] Scanning for projects...
    [WARNING] 
    [WARNING] Some problems were encountered while building the effective model for tv.mineinthebox.essentials:xEssentials:jar:3.8-SNAPSHOT
    [WARNING] 'dependencies.dependency.systemPath' for ManCo:tv.mineinthebox.manco:jar should not point at files within the project directory, ${project.basedir}${file.separator}repo${file.separator}ManCo-2.0.jar will be unresolvable by dependent projects @ line 140, column 16
    [WARNING] 'dependencies.dependency.systemPath' for com.vexsoftware:votifier:jar should not point at files within the project directory, ${project.basedir}${file.separator}repo${file.separator}Votifier.jar will be unresolvable by dependent projects @ line 147, column 16
    [WARNING] 
    [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
    [WARNING] 
    [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
    [WARNING] 
    [INFO] 
    [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building xEssentials 3.8-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [WARNING] The POM for net.milkbowl.vault:Vault:jar:1.2.30 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
    [INFO] 
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ xEssentials ---
    [INFO] Deleting C:\Java\xEssentials\target
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ xEssentials ---
    [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 3 resources to .
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ xEssentials ---
    [INFO] Changes detected - recompiling the module!
    [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
    [INFO] Compiling 344 source files to C:\Java\xEssentials\target\classes
    [WARNING] Note: Some input files use or override a deprecated API.
    [WARNING] Note: Recompile with -Xlint:deprecation for details.
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ xEssentials ---
    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] skip non existing resourceDirectory C:\Java\xEssentials\src\test\resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ xEssentials ---
    [INFO] No sources to compile
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ xEssentials ---
    [INFO] No tests to run.
    [INFO] 
    [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ xEssentials ---
    [INFO] Building jar: C:\Java\xEssentials\target\xEssentials-3.8-SNAPSHOT.jar
    [INFO] 
    [INFO] --- maven-shade-plugin:1.5:shade (default) @ xEssentials ---
    [INFO] Replacing original artifact with shaded artifact.
    [INFO] Replacing C:\Java\xEssentials\target\xEssentials-3.8-SNAPSHOT.jar with C:\Java\xEssentials\target\xEssentials-3.8-SNAPSHOT-shaded.jar
    [INFO] 
    [INFO] --- maven-install-plugin:2.4:install (default-install) @ xEssentials ---
    [INFO] Installing C:\Java\xEssentials\target\xEssentials-3.8-SNAPSHOT.jar to C:\Users\Guido\.m2\repository\tv\mineinthebox\essentials\xEssentials\3.8-SNAPSHOT\xEssentials-3.8-SNAPSHOT.jar
    [INFO] Installing C:\Java\xEssentials\pom.xml to C:\Users\Guido\.m2\repository\tv\mineinthebox\essentials\xEssentials\3.8-SNAPSHOT\xEssentials-3.8-SNAPSHOT.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 17.769 s
    [INFO] Finished at: 2014-12-25T14:44:47+01:00
    [INFO] Final Memory: 17M/322M
    [INFO] ------------------------------------------------------------------------
    
    I geuss it has todo that I may have to use a JRE rather than a JDK on that point?, or has it todo with the <scope>provided</scope> setting in the dependencies?

    thanks for the help already, this makes me very confusing.

    -edit-

    got it solved, it seems the scope provided setting makes it not to shade for me.
     
    Last edited: Dec 25, 2014
Thread Status:
Not open for further replies.

Share This Page