Solved FileNotFound error, plugin.yml missing from .jar

Discussion in 'Spigot Plugin Development' started by SpiderMonkey_MC, Jul 20, 2021.

  1. Hello. I'm brand new to spigot development (but I know java) and I just followed this tutorial on making a blank plugin basically to the letter --> https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-vs-code/

    Once i've built and installed the plugin on a test server however I get a FileIO Error saying that the plugin .jar doesn't contain a plugin.yml

    This 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>santas.spy.anvilenchant</groupId>
      <artifactId>anvilenchant</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>
      <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.17.1-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
          </dependency>
      </dependencies>
      <build>
        <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
        <resources>
          <resource>
            <directory>${project.basedir}/src/main/resources</directory>
            <includes>
              <include>plugin.yml</include>
            </includes>
          </resource>
        </resources>
      </build>
    </project>
    and my plugin.yml is located in blankplugin/src/main/resources and looks like this

    Code (Text):
    main: santas.spy.blankplugin.App
    name: BlankPlugin
    version: 0.1
     
  2. Maven adds all resources to your jar by default, you shouldn't need to configure it. But if you do need to manually do it, the directory should just be src/main/resources
    No need to set sourceDirectory either.
     
  3. Removed that sourceDirectory part and the part telling maven to include plugin.yml and got a different maven output that said it was trying to look in src/src/main/resources but the file didn't exist. Changed it to just looking in ${project.basedir}/main/resources instead and that worked. Thanks!