"Jar does not contain plugin.yml" when jar contains plugin.yml

Discussion in 'Plugin Development' started by Thom1729, Sep 26, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Thom1729

    My first plugin. Doing something minimal (adding a chiseled stone recipe) for a first project. The error:

    Code:
    2012-09-26 22:21:49 [SEVERE] Could not load 'plugins/ChiseledStoneBlockRecipe.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:198)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:132)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:222)
        at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:198)
        at net.minecraft.server.ServerConfigurationManagerAbstract.<init>(ServerConfigurationManagerAbstract.java:50)
        at net.minecraft.server.ServerConfigurationManager.<init>(SourceFile:11)
        at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:105)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:378)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
    Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
        ... 9 more
    
    The structure of the jar:

    Code:
    ChiseledStoneBlockRecipe.jar
        Main.class
        plugin.yml
    Plugin.yml:

    Code:
    name: ChiseledStoneBlockRecipe
    main: net.sarpathia.ChiseledStoneBlockRecipe.Main
    version: 1.0
    
    Main.java:

    Code:
    package net.sarpathia.ChiseledStoneBlockRecipe;
     
    import org.bukkit.Material;
    import org.bukkit.inventory.*;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin {
     
        @Override
        public void onEnable() {
            getLogger().info("Loading Chiseled Stone Block Recipe.");
           
            ShapedRecipe recipe = new ShapedRecipe(new ItemStack(Material.SMOOTH_BRICK, 8, (short)3));
            recipe.shape("AAA", "A A", "AAA");
            recipe.setIngredient('A', Material.SMOOTH_BRICK, 0);
            getServer().addRecipe(recipe);
        }
    }
    
     
  2. Offline

    JayzaSapphire

    Refresh the file in your IDE
     
  3. Offline

    Officialjake

    A couple things.... Change the plugin name PLEASE! Your plugin's code will look MUCH better if you follow standard convention of naming programs and use short names! (not required just recommended)

    2nd: What IDE are you using?

    If(IDE == Eclipse){
    System.out.println("Make sure the plugin.yml folder is inside the SRC folder and NOT outside of it. This happened to me one time before.");
    }else{
    System.out.println("What IDE are you useing");
    }

    (yes i was bored and a pun was intended by putting my reply in a snippet of code.)
     
  4. Offline

    Shockwave317

    make sure the plugin.yml is located in the first folder of the project so you right click project then new file then plugin.yml then edit it right click on project refresh then right click export!
     
  5. Offline

    Drkmaster83

    It tells you what's wrong at the beginning and the end.
    Code:
    [SEVERE] Could not load 'plugins/ChiseledStoneBlockRecipe.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
    Code:
    Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
    Make sure that your plugin.yml is located at the same place where your net folder would be in the .jar file.
    Your .jar structure should be:
    net(folder)
    plugin.yml
    *sarpanthia
    **ChiseledStoneBlockRecipe
    ***Main.class
    The asterisks represent how many levels in the .jar file they are.
     
  6. Offline

    Muddr

    Umm.. none of my plugin.yml's are in the src folder of my plugins..
     
  7. Offline

    Lolmewn

    Problem is that the plugin.yml doesn't have a plugin description.
     
  8. Offline

    Kodfod

    here is how i always get it right:
    Code:
    Project name:
      src:
      package:
        MainClass
      plugin.yml
    I have never had any luck with putting it in a package so i always put it in side src.

    Some Steps you should take:

    1. Save the plugin.yml
    2. Refresh The IDE (right click in the project explorer and click refresh or hit F5)
    3. ???
    4. Profit
     
  9. Offline

    Drkmaster83

    The description for a plugin is not necessary.
     
  10. Offline

    Lolmewn

    Oh yeah, you're right. Never mind!
     
  11. Offline

    Thom1729

    The test I posted is from the 'plugin.yml' in the jar itself.

    Eclipse, although what should matter is the jar itself.

    There is no 'src' folder in the jar. Should there be?

    That's where it was, which is why it ended up at the root level of the jar.

    That's where my 'plugin.yml' is. I tried the structure you suggest for the class file, but received the same error.
     
  12. Offline

    Officialjake

    Im sorry I was tired the plugin.yml folder should be inside the package. Also are you coding this plugin or installing it? If you are installing it then contact the developer unless you know how to decompile the code. (No its not illegal to decompile code unless you claim its yours.)

    I see whats wrong now! move plugin.yml to the same level as your main class!
     
  13. Offline

    Drkmaster83

    I coded exactly the way you did. With the plugin.yml file exactly where I said it should be. Works perfectly for me.
     
  14. Offline

    krazytraynz

    Double check to make sure that there are no indents in the plugin.yml file.
    EDIT: I noticed you said there is no src folder. When you go to compile the plugin, it should look like this: http://gyazo.com/3d8c2fd6267765f99e4882ab4cbb06c2
    Of course the names of projects/packages don't matter, this is just what I could I open at the time.
     
Thread Status:
Not open for further replies.

Share This Page