Spigot Maven issues?

Discussion in 'Spigot Plugin Development' started by dogboy60, Jun 18, 2016.

  1. I'm using IntelliJ and I keep getting issues with "<project" and at "<version>". It says the dependency is not found, some problems were encountered while processing the POMs.

    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>com/dogboy602k.gui.main</groupId>
        <artifactId>gui test</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>jar</packaging>
        <name>gui</name>
        <description>test gui</description>

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

        <dependencies>
            <dependency>
                <groupId>org.spigotmc</groupId>
                <artifactId>spigot-api</artifactId>
                <version>1.10-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
        <build>
            <sourceDirectory>src/main/java</sourceDirectory>
            <finalName>gui</finalName>
            <resources>
                <resource>
                    <targetPath>.</targetPath>
                    <directory>src/main/resources</directory>
                    <includes>
                        <include>*.yml</include>
                    </includes>
                    <filtering>true</filtering>
                </resource>
            </resources>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>

    </project>
     
  2. Your groupId and artifactId are incorrect. You don't specify the path your code uses and you don't use spaces.
    Code (Text):
    <groupId>dogboy602k.gui.main</groupId> <!-- this is like a project group name (lowercase), so if you had several projects, they might use the same groupId -->
    <artifactId>guitest</artifactId> <!-- this is usually your project name (lowercase), spaces become dashes or underscores -->
    As for the spigot-api, you should check your maven repository storage area and delete the existing 1.10-R0.1-SNAPSHOT folder, it may have cached a failed result and won't attempt to retry for a while.[/code]
     
  3. Your groupId and projectId settings are messed up. "com/dogboy602k.gui.main" is not valid, and "gui test" is not valid. Spaces and slashes are not allowed.

    Try with:
    Code (Text):
        <groupId>com.dogboy602k.gui.main</groupId>
        <artifactId>gui-test</artifactId>
    Edit: apparently already said. Besides the above, it should work fine.
     
  4. Java 6 has been EOL since 2012...

    Java 7 has been EOL since 2015...

    We're about to get Java 9 early 2017...

    Neither of these older versions are receiving security updates. It is strongly advised you compile your plugins with Java 8 and help push the end users to update. Do not enable them to use outdated software that puts them at risk. Hell, even Mojang started shipping their launcher with its own built in version of 8. Let 6 and 7 die. ;)

    Oh, and what the two before me said will fix your error.
     
  5. so what should i use what version, do i just put in 1.8 instead of 1.6
    ?
     
  6. well in this pl i have no spaces or slash and i still have the error:
    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>CreditCard</groupId>
        <artifactId>CreditCard</artifactId>
        <version>1.0-SNAPSHOT</version>
        <properties>
            <version>1.10-R0.1-SNAPSHOT</version>
        </properties>

        <repositories>
            <repository>
                <id>vault-repo</id>
                <url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
            </repository>
            <repository>
                <id>spigot-repo</id>
                <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
            </repository>
        </repositories>

        <dependencies>
            <dependency>
                <groupId>net.milkbowl.vault</groupId>
                <artifactId>Vault</artifactId>
                <version>1.4.1</version>
                <type>jar</type>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>org.spigotmc</groupId>
                <artifactId>spigot-api</artifactId>
                <version>${spigot.version}</version>
            </dependency>
        </dependencies>

        <build>
            <sourceDirectory>src/main/java</sourceDirectory>
            <finalName>CreditCard</finalName>
            <resources>
                <resource>
                    <targetPath>.</targetPath>
                    <directory>src/main/resources</directory>
                    <includes>
                        <include>*.yml</include>
                    </includes>
                    <filtering>true</filtering>
                </resource>
            </resources>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>

    </project>
     
    #6 dogboy60, Jun 18, 2016
    Last edited: Jun 18, 2016
  7. #7 TeddyDev, Jun 18, 2016
    Last edited: Jun 18, 2016
  8. Try this:

    Code (Text):
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
             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>YourPackage</groupId>
        <artifactId>YourPluginName</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>jar</packaging>
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
        </properties>

        <build>
            <defaultGoal>clean install</defaultGoal>
            <finalName>YourPluginName</finalName>
            <resources>
                <resource>
                    <directory>${project.basedir}/src/main/resources</directory>
                    <filtering>true</filtering>
                </resource>
            </resources>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>

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

        <dependencies>
            <dependency>
                <groupId>org.spigotmc</groupId>
                <artifactId>spigot-api</artifactId>
                <version>1.9.4-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </project>