Question Maven pom.xml help

BlackPoison357

New member
Mar 5, 2023
4
0
1
I recently converted my plugin to maven, before doing so the size was roughly 120KB but now it is 7.24MB. I can see that's included extra stuff but I can't seem to figure out what I'm doing that making it include so much stuff. I'm only trying to shade bstats into the jar but for some reason it's shading so much more than that. I'm using Eclipse. Building it with run as > 4 Maven build... Maven build console log

XML:
<?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>io.github.xBlackPoison357x</groupId>
    <artifactId>UltimatePlugin</artifactId>
    <version>1.1</version>
    <repositories>
        <repository>
            <id>papermc</id>
            <url>https://repo.papermc.io/repository/maven-public/</url>
        </repository>
        <repository>
            <id>dustplanet-releases</id>
            <url>https://repo.dustplanet.de/artifactory/libs-release-local</url>
        </repository>
    </repositories>
    <dependencies>
        <!-- Paper as an example -->
        <dependency>
            <groupId>io.papermc.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.19.3-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <!-- bStats -->
        <dependency>
            <groupId>org.bstats</groupId>
            <artifactId>bstats-bukkit</artifactId>
            <version>3.0.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>net.gravitydevelopment.updater</groupId>
            <artifactId>updater</artifactId>
            <version>4.2.2</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.4.1</version>
                <configuration>
                    <relocations>
                        <relocation>
                            <pattern>org.bstats</pattern>
                            <shadedPattern>io.github.xBlackPoison357x.bstats</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <release>17</release>
                </configuration>
            </plugin>
        </plugins>
        <defaultGoal>clean package</defaultGoal>
    </build>
</project>
 

Attachments

  • after maven.png
    after maven.png
    29.7 KB · Views: 1
  • before maven.png
    before maven.png
    19.1 KB · Views: 1
Last edited:

SkytAsul

New member
Dec 20, 2022
6
1
3
Bretagne, France
linktr.ee
You are shading
Code:
net.gravitydevelopment.updater:updater:4.2.2
(see pom.xml) which has as parent maven module
Code:
de.dustplanet:bukkit-plugin:6.3.0
(see pom.xml) which itself contains spigot, the kotlin std lib, and other things as compiled dependencies. Hence, by transitivity, you are shading a lot of libraries into your plugin.
This "updater" seems really badly designed, you should consider using something else.