Solved Intellij Issues with plugin.yml

Discussion in 'Spigot Plugin Development' started by FiXed, May 24, 2016.

Thread Status:
Not open for further replies.
  1. So I'm trying to output my plugin using this artifact stuff here:
    [​IMG]
    and it's still saying it can't find the plugin.yml, I even have it include using maven and I don't know my error, please help. Thanks, I know there's a simple answer and fix to this.
     
  2. Are you putting it in the resources directory?
     
  3. [​IMG]
    yes
     
  4. Can you post your pom.xml? I don't see why you should have to put the yml files in the output like that.
     
  5. 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>us.battleaxe.bounce</groupId>
        <artifactId>Bounce</artifactId>
        <version>1.0.0.0</version>
        <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>
                <type>jar</type>
                <scope>provided</scope>
            </dependency>
        </dependencies>
        <build>
            <sourceDirectory>src</sourceDirectory>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.3</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
            </plugins>
            <resources>
                <resource>
                    <filtering>true</filtering>
                    <directory>/src/main/resources/</directory>
                    <includes>
                        <include>plugin.yml</include>
                        <include>messages.yml</include>
                        <include>config.yml</include>
                    </includes>
                </resource>
            </resources>
        </build>

    </project>
     
  6. This is my pom, Try something like this and let me know how you go.

    Code (Text):
    <build>
            <sourceDirectory>src/main/java</sourceDirectory>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>true</filtering>
                    <includes>
                        <include>plugin.yml</include>
                    </includes>
                </resource>
            </resources>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.3</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <configuration>
                        <archive>
                            <manifest>
                                <mainClass>
                                    your.package.here.MainClass
                                </mainClass>
                            </manifest>
                        </archive>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                    </configuration>
                </plugin>
            </plugins>
        </build>

        <properties>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
        </properties>
     
  7. Same thing, still doesn't work, is there a certain way you built your artifact?
     
  8. Why are you making an artifact when you have maven all set up? Just run the maven task for building your project.
     
  9. How would I do that?
     
  10. Mark the resources folder as a resource directory?
     
  11. I did
     
  12. https://www.jetbrains.com/help/idea/2016.1/executing-maven-goal.html There should be a blue "m" on the right side of your screen. It has a bunch of your maven buttons on there. There should be a bunch of goals in there which are basically gui buttons for running various "mvn" sub commands. You want to use the goals for building your project (I'm sorry but I don't know which of the goals you will need, I use gradle but the process is similar to this).
     
  13. [​IMG]
    I don't see the blue m
     
  14. Click that little gray box in the far bottom left. That toggles a lot of the toolbars along the sides/bottom.
     
  15. So I've figured it out but it's not working because one of my dependencies isn't done through maven
    I used it through just importing it manually so it throws a compilation error and doesn't work.
     
  16. Yeah you kinda have to commit to maven or intellij's build system. Things go wrong when you are in between :p Either way, you should be able to just add it to your pom and you are good to go :)
     
  17. The dependency I have isn't available with maven, or how do I manually add it to maven as a local jar?
     
  18. You can either install it into your local maven repo with the following command and then just use the group, artifact etc that you installed it under in your pom:
    Code (Text):
    mvn install:install-file
      -Dfile=<path-to-file>
      -DgroupId=<group-id>
      -DartifactId=<artifact-id>
      -Dversion=<version>
      -Dpackaging=<packaging>
      -DgeneratePom=true
    Where: <path-to-file>  the path to the file to load
           <group-id>      the group that the file should be registered under
           <artifact-id>   the artifact name for the file
           <version>       the version of the file
           <packaging>     the packaging of the file e.g. jar
    Source: http://maven.apache.org/general.html#importing-jars

    Or you can add a local dependency directly:
    HTML:
    <dependency>
        <groupId>groupId</groupId>
        <artifactId>artifactId</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>${basedir}/directoryForMyLibs/dependencyName.jar</systemPath>
      </dependency>
     
  19. Thanks for all your help, I got it working.
     
    • Like Like x 2
  20. Pwease mark swolved :3
     
Thread Status:
Not open for further replies.