1.8.8 Bukkit-API isn't working with Maven

Discussion in 'Spigot Plugin Development' started by Prixix, Feb 6, 2020.

  1. Hello,
    I'm creating a Minecraft plugin and I have to use classes like CraftPlayer for example and IntelliJ doesn't show me suggestions for the auto-import system.

    Here is my pom.xml
    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>de.vaccum</groupId>
        <artifactId>vorbausystem</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>jar</packaging>

        <name>VorbauSystem</name>

        <properties>
            <java.version>1.8</java.version>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
        <url>https://www.vaccum.de</url>

        <build>
            <defaultGoal>clean package</defaultGoal>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.7.0</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.1.0</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                            <configuration>
                                <createDependencyReducedPom>false</createDependencyReducedPom>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>true</filtering>
                </resource>
            </resources>
        </build>

        <repositories>
            <repository>
                <id>spigot-repo</id>
                <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
            </repository>
            <repository>
                <id>sonatype</id>
                <url>https://oss.sonatype.org/content/groups/public/</url>
            </repository>
        </repositories>

        <dependencies>
            <dependency>
                <groupId>org.spigotmc</groupId>
                <artifactId>spigot-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.1-SNAPSHOT</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </project>
    The're aren't any error messages or something. I hope someone can help me.

    Have a nice day!
     
  2. Remove the dependency for bukkit and change "spigot-api" to "spigot"
     
  3. Nope, didn't fixed that
     
  4. Show your new pom.xml
     
  5. Half right. spigot-api is right as dependency.
     
  6. CraftPlayer isn't included in spigot-api
     
  7. Bukkit is not CraftBukkit, also there's no official CraftBukkit repo. Build it from BuildTools and use .jar itself or try to search for unofficial repo.
     
    • Like Like x 1
  8. Ah thanks overlooked that. Yes spigot the the way to go after running buildTools.
     
  9. Use this after running buildtools:
    Code (Text):
    <dependency>
       <groupId>org.bukkit</groupId>
       <artifactId>craftbukkit</artifactId>
       <version>1.8.8-R0.1-SNAPSHOT</version>
       <scope>provided</scope>
    </dependency>
     
    • Like Like x 1
  10. Where do I have to run BuildTools?
     
  11. Anywhere. You just need to run it once and the repo will become available to you
     
  12. dont depend on craftbukkit.. the spigot server might have made internal changes that would not accurately reflect craftbukkit functionality. use spigot.