Solved Spigot Maven

Discussion in 'Spigot Plugin Development' started by The_Red_Freak, Jun 12, 2016.

Thread Status:
Not open for further replies.
  1. I hate maven, eeerr *love maven*

    I dont know but as you can see it cannot find the POM file for bukkit and spigot.

    (Internet Okay, No Proxy)

    Code (Text):

    [INFO] Scanning for projects...
    [INFO]                                                                        
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Herobrine 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] >>> maven-assembly-plugin:2.2-beta-5:assembly (default-cli) > package @ Herobrine >>>
    [WARNING] The POM for org.bukkit:bukkit:jar:1.9.4-R1.0-SNAPSHOT is missing, no dependency information available
    [WARNING] The POM for org.spigotmc:spigot-api:jar:1.9.4-R1.0-SNAPSHOT is missing, no dependency information available
    [WARNING] The POM for org.spigotmc:spigot:jar:1.9.4-R0.1-SNAPSHOT is missing, no dependency information available
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.032 s
    [INFO] Finished at: 2016-06-12T20:15:30+02:00
    [INFO] Final Memory: 6M/123M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal on project Herobrine: Could not resolve dependencies for project Herobrine-fake-trf:Herobrine:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.bukkit:bukkit:jar:1.9.4-R1.0-SNAPSHOT, org.spigotmc:spigot-api:jar:1.9.4-R1.0-SNAPSHOT, com.google.code.gson:gson:jar:2.6: Cannot access spigot-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/) in offline mode and the artifact org.bukkit:bukkit:jar:1.9.4-R1.0-SNAPSHOT has not been downloaded from it before. -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
     
     
  2. Do you have the spigot repository in your pom?
     
  3. Post your pom file. Probably the best thing you can do.
     
  4. Code (Text):
    <?xml version="1.0"?>
    <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <modelVersion>4.0.0</modelVersion>
      <groupId>Herobrine-fake-trf</groupId>
      <artifactId>Herobrine</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <dependencies>
        <dependency>
          <groupId>org.spigotmc</groupId>
          <artifactId>spigot-api</artifactId>
          <version>1.9.4-R0.1-SNAPSHOT</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.bukkit</groupId>
          <artifactId>bukkit</artifactId>
          <version>1.9.4-R0.1-SNAPSHOT</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.inventivetalent.nicknamer</groupId>
          <artifactId>api</artifactId>
          <version>3.9.0</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
      <repositories>
        <repository>
          <id>spigot-repo</id>
          <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
          <id>inventive-repo</id>
          <url>https://repo.inventivetalent.org/content/groups/public/</url>
        </repository>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>Central Repository</name>
          <url>https://repo.maven.apache.org/maven2</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <releases>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>Central Repository</name>
          <url>https://repo.maven.apache.org/maven2</url>
        </pluginRepository>
      </pluginRepositories>
      <build>
        <sourceDirectory>A:\Herobrine\src</sourceDirectory>
        <scriptSourceDirectory>A:\Herobrine\src\main\scripts</scriptSourceDirectory>
        <testSourceDirectory>A:\Herobrine\src\test\java</testSourceDirectory>
        <outputDirectory>A:\Herobrine\target\classes</outputDirectory>
        <testOutputDirectory>A:\Herobrine\target\test-classes</testOutputDirectory>
        <resources>
          <resource>
            <directory>A:\Herobrine\src\main\resources</directory>
          </resource>
        </resources>
        <testResources>
          <testResource>
            <directory>A:\Herobrine\src\test\resources</directory>
          </testResource>
        </testResources>
        <directory>A:\Herobrine\target</directory>
        <finalName>Herobrine-0.0.1-SNAPSHOT</finalName>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-antrun-plugin</artifactId>
              <version>1.3</version>
            </plugin>
            <plugin>
              <artifactId>maven-assembly-plugin</artifactId>
              <version>2.2-beta-5</version>
            </plugin>
            <plugin>
              <artifactId>maven-dependency-plugin</artifactId>
              <version>2.8</version>
            </plugin>
            <plugin>
              <artifactId>maven-release-plugin</artifactId>
              <version>2.3.2</version>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <executions>
              <execution>
                <id>default-compile</id>
                <phase>compile</phase>
                <goals>
                  <goal>compile</goal>
                </goals>
                <configuration>
                  <source>1.8</source>
                  <target>1.8</target>
                </configuration>
              </execution>
              <execution>
                <id>default-testCompile</id>
                <phase>test-compile</phase>
                <goals>
                  <goal>testCompile</goal>
                </goals>
                <configuration>
                  <source>1.8</source>
                  <target>1.8</target>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.5</version>
            <executions>
              <execution>
                <id>default-clean</id>
                <phase>clean</phase>
                <goals>
                  <goal>clean</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.6</version>
            <executions>
              <execution>
                <id>default-testResources</id>
                <phase>process-test-resources</phase>
                <goals>
                  <goal>testResources</goal>
                </goals>
              </execution>
              <execution>
                <id>default-resources</id>
                <phase>process-resources</phase>
                <goals>
                  <goal>resources</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <executions>
              <execution>
                <id>default-jar</id>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.12.4</version>
            <executions>
              <execution>
                <id>default-test</id>
                <phase>test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.4</version>
            <executions>
              <execution>
                <id>default-install</id>
                <phase>install</phase>
                <goals>
                  <goal>install</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.7</version>
            <executions>
              <execution>
                <id>default-deploy</id>
                <phase>deploy</phase>
                <goals>
                  <goal>deploy</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.3</version>
            <executions>
              <execution>
                <id>default-site</id>
                <phase>site</phase>
                <goals>
                  <goal>site</goal>
                </goals>
                <configuration>
                  <outputDirectory>A:\Herobrine\target\site</outputDirectory>
                  <reportPlugins>
                    <reportPlugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-project-info-reports-plugin</artifactId>
                    </reportPlugin>
                  </reportPlugins>
                </configuration>
              </execution>
              <execution>
                <id>default-deploy</id>
                <phase>site-deploy</phase>
                <goals>
                  <goal>deploy</goal>
                </goals>
                <configuration>
                  <outputDirectory>A:\Herobrine\target\site</outputDirectory>
                  <reportPlugins>
                    <reportPlugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-project-info-reports-plugin</artifactId>
                    </reportPlugin>
                  </reportPlugins>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <outputDirectory>A:\Herobrine\target\site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <reporting>
        <outputDirectory>A:\Herobrine\target\site</outputDirectory>
      </reporting>
    </project>
     


    EDIT:

    Thx 4 dat fast respond
     
  5. Are the files in your .m2 repository?
     
  6. You're using both spigot-api and bukkit as a dependency. (I assume for NMS?)
    If you're doing it for NMS, you need to install it locally (ie, run BuildTools), if not then just stick to spigot-api and remove the bukkit dependency.

    EDIT: Also, don't define bukkit and spigot-api's "scope" as compile. Your plugin will include all of spigot/bukkit which not only is illegal, but also makes unnecessarily large files. Set their scope to "provided".
     
  7. I did not planned to use NMS but i basically put it in nearly every Maven Project.

    The scope compile was just for testing reasons.

    Is just spigot-api neccessary? Are the bukkit files included?


    You're rockin'!

    Edit:

    I will test it tomorrow
     
  8. spigot-api is all you need if you're not using NMS, yes. Spigot is built on top of Bukkit meaning it's Bukkit plus extra.
     
  9. i saw in eclipse's dependency Manager that there are spigot and spigot-api?
    Do you know why there are two of (i think) the identical jars?
     
  10. The are 4 main artifacts:
    bukkit
    bukkit-api
    spigot
    spigit-api

    bukkit and spigot have the actual server files whereas *-api just have the api needed for development.

    Using either is fine, but you need spigot or bukkit for NMS. The downside is that they can't be downloaded from the repo and have to be locally installed.
     
Thread Status:
Not open for further replies.