WesJD / AnvilGUI

Capture user input in Minecraft through an anvil GUI in under 20 lines of code
MIT License
466 stars 111 forks source link

Relocating breaks 1.8 java compatibility #299

Closed Nubebuster closed 8 months ago

Nubebuster commented 8 months ago

When I add this project to my project and I try to compile, I get "Unsupported class file major version 60".

Am I doing something wrong?

Nubebuster commented 8 months ago

Pom:

`<?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">

4.0.0
<groupId>me.cockram</groupId>
<artifactId>TheHub</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>thehub</name>

<properties>
    <java.version>1.8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>${java.version}</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <relocations>
                            <relocation>
                                <pattern>net.wesjd.anvilgui</pattern>
                                <shadedPattern>me.cockram.thehub.anvilgui</shadedPattern>
                            </relocation>
                        </relocations>
                        <createDependencyReducedPom>false</createDependencyReducedPom>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target>
                            <copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
                                  todir="../TheHub/hub/plugins" />
                        </target>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>

<repositories>
    <repository>
        <id>dmulloy2-repo</id>
        <url>https://repo.dmulloy2.net/repository/public/</url>
    </repository>
    <repository>
        <id>papermc-repo</id>
        <url>https://repo.papermc.io/repository/maven-public/</url>
    </repository>
    <repository>
        <id>sonatype</id>
        <url>https://oss.sonatype.org/content/groups/public/</url>
    </repository>
    <repository>
        <id>codemc-snapshots</id>
        <url>https://repo.codemc.io/repository/maven-snapshots/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.github.paperspigot</groupId>
        <artifactId>paperspigot-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.3-SNAPSHOT</version>
        <systemPath>${user.home}/IdeaProjects/TheFeast/lib/patched_1.8.8.jar</systemPath>
        <type>jar</type>
        <scope>system</scope>
    </dependency>
    <dependency>
        <groupId>com.antarescraft.kloudy</groupId>
        <artifactId>signguilib</artifactId>
        <version>1</version>
        <systemPath>${user.home}/IdeaProjects/TheFeast/TheHub/hub/plugins/SignGUI.jar</systemPath>
        <type>jar</type>
        <scope>system</scope>
    </dependency>
    <dependency>
        <groupId>me.cockram</groupId>
        <artifactId>TheFeastData</artifactId>
        <version>${project.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.ipvp</groupId>
        <artifactId>canvas</artifactId>
        <version>1.7.0-SNAPSHOT</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>com.comphenix.protocol</groupId>
        <artifactId>ProtocolLib</artifactId>
        <version>4.8.0</version>
    </dependency>
    <dependency>
        <groupId>net.wesjd</groupId>
        <artifactId>anvilgui</artifactId>
        <version>1.9.0-SNAPSHOT</version>
    </dependency>
</dependencies>

`

Nubebuster commented 8 months ago

By removing the relocation from my pom it now works. How do I correctly relocate without breaking it?

joestr commented 8 months ago

The version of maven-shade-plugin is lower than 3.3.0 and the filter section is missing.