Skip to content

Instantly share code, notes, and snippets.

@JOPHESTUS
Created May 3, 2014 10:54
Show Gist options
  • Save JOPHESTUS/11495719 to your computer and use it in GitHub Desktop.
Save JOPHESTUS/11495719 to your computer and use it in GitHub Desktop.
<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>us.jophest.bukkitstaff</groupId>
<artifactId>bstest</artifactId>
<version>0.1</version>
<name>BukkitStaff</name>
<url>https://github.com/jophestus/bukkitstaff</url>
<build>
<finalName>BukkitStaff</finalName>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources/</directory>
<includes>
<include>*.yml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId>
<version>2.2</version>
</extension>
</extensions>
</build>
<repositories>
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>LATEST</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
@DSH105
Copy link

DSH105 commented May 3, 2014

            <!-- SHADE -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <minimizeJar>true</minimizeJar> <!-- make sure to only copy the stuff we need -->
                            <createDependencyReducedPom>false</createDependencyReducedPom> <!-- we don't need this -->
                            <artifactSet>
                                <includes>
                                    <artifact>org.jsoup:jsoup</artifact> <!-- include jsoup in our final jar -->
                                </includes>
                            </artifactSet>
                            <relocations>
                                <relocation>
                                    <!-- relocate jsoup to an appropriate package -->
                                    <pattern>org.jsoup</pattern>
                                    <shadedPattern>us.jophest.libs</shadedPattern>
                                </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

@DSH105
Copy link

DSH105 commented May 3, 2014

Final pom should look something like this (ignore my attempt at formatting):

<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>us.jophest.bukkitstaff</groupId>
    <artifactId>bstest</artifactId>
    <version>0.1</version>
    <name>BukkitStaff</name>
    <url>https://github.com/jophestus/bukkitstaff</url>
    <build>
        <finalName>BukkitStaff</finalName>
        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
        <resources>
            <resource>
                <targetPath>.</targetPath>
                <filtering>true</filtering>
                <directory>${basedir}/src/main/resources/</directory>
                <includes>
                    <include>*.yml</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <!-- SHADE -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <minimizeJar>true</minimizeJar> <!-- make sure to only copy the stuff we need -->
                            <createDependencyReducedPom>false</createDependencyReducedPom> <!-- we don't need this -->
                            <artifactSet>
                                <includes>
                                    <artifact>org.jsoup:jsoup</artifact> <!-- include jsoup in our final jar -->
                                </includes>
                            </artifactSet>
                            <relocations>
                                <relocation>
                                    <!-- relocate jsoup to an appropriate package -->
                                    <pattern>org.jsoup</pattern>
                                    <shadedPattern>us.jophest.libs</shadedPattern>
                                </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-file</artifactId>
                <version>2.2</version>
            </extension>
        </extensions>
    </build>
    <repositories>
        <repository>
            <id>bukkit-repo</id>
            <url>http://repo.bukkit.org/content/groups/public/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.7.2</version>
        </dependency>

        <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>bukkit</artifactId>
            <version>LATEST</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
    </dependencies>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment