Maven dependency

Discussion in 'Spigot Plugin Development' started by iryoth, Feb 23, 2018.

Thread Status:
Not open for further replies.
  1. I'm German, so I'm sorry for my bad english.

    I'm trying to code a BedWars plugin, an I want to send Players messages on the Actionbar. But I want to use classes from net.minecraft.server. But I can't import it. 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>net.iryoth</groupId>
        <artifactId>bedwars</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>jar</packaging>

        <name>BedWars</name>

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

        <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>1.8</source>
                        <target>1.8</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>
                                <minimizeJar>true</minimizeJar>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>true</filtering>
                </resource>
            </resources>
        </build>

        <repositories>
            <repository>
                <id>spigotmc-repo</id>
                <url>https://hub.spigotmc.org/nexus/content/groups/public/</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>
            <!--Bukkit API-->
            <dependency>
                <groupId>org.bukkit</groupId>
                <artifactId>bukkit</artifactId>
                <version>1.8.8-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.spigotmc</groupId>
                <artifactId>spigot</artifactId>
                <version>1.8.8-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </project>
     
     
  2. From Spigot Wiki:
     
    • Informative Informative x 1
  3. You have to use your local repo:
    HTML:
    <repositories>
            <repository>
                <id>local-repo</id>
                <url>file://C:/Users/YouName/.m2/repository</url>
            </repository>
        </repositories>

        <dependencies>
            <dependency>
                <groupId>org.spigotmc</groupId>
                <artifactId>spigot</artifactId>
                <version>1.8.8-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
     
     
    • Friendly Friendly x 1
  4. maven infers this
    run buildtools
     
    • Useful Useful x 1
  5. If you have run BuildTools, the full spigot server including NMS will be added to user local m2 repositories.
     
  6. Thank you. It helped me a lot
     
Thread Status:
Not open for further replies.

Share This Page