Solved Spigot can't find my Main class

Discussion in 'Spigot Plugin Development' started by Enta12, Nov 25, 2021.

  1. Hello everyone,

    I have added a pipeline CI/CD to make the development easier.
    My project can be build on eclipse and works normally but when I try to build on my server test (on linux) with this command (when I am in the project directory) : jar cf plugin.jar . I have this following error when I launch my server : "org.bukkit.plugin.InvalidPluginException: Cannot find main class `fr.pepintrie.pepintrieplugin.Main"

    Thanks
     
  2. is your path to main class inside plugin.yml is correct?
     
  3. Check case in letters.
     
  4. Yes I have already checked.
    And I can build the same version from eclipse without problem.
     
  5. I add agrument "v" to my command and I have this output :


    added manifest
    adding: README.md(in = 38) (out= 35)(deflated 7%)
    adding: bin/(in = 0) (out= 0)(stored 0%)
    adding: bin/fr/(in = 0) (out= 0)(stored 0%)
    adding: bin/fr/pepintrie/(in = 0) (out= 0)(stored 0%)
    adding: bin/fr/pepintrie/pepintrie_plugin/(in = 0) (out= 0)(stored 0%)
    adding: bin/fr/pepintrie/pepintrie_plugin/command/(in = 0) (out= 0)(stored 0%)
    adding: bin/fr/pepintrie/pepintrie_plugin/command/LicenceCommand.class(in = 3399) (out= 1760)(deflated 48%)
    adding: bin/fr/pepintrie/pepintrie_plugin/Main.class(in = 946) (out= 511)(deflated 45%)
    adding: plugin.yml(in = 188) (out= 127)(deflated 32%)
    adding: src/(in = 0) (out= 0)(stored 0%)
    adding: src/fr/(in = 0) (out= 0)(stored 0%)
    adding: src/fr/pepintrie/(in = 0) (out= 0)(stored 0%)
    adding: src/fr/pepintrie/pepintrie_plugin/(in = 0) (out= 0)(stored 0%)
    adding: src/fr/pepintrie/pepintrie_plugin/command/(in = 0) (out= 0)(stored 0%)
    adding: src/fr/pepintrie/pepintrie_plugin/command/LicenceCommand.java(in = 2103) (out= 806)(deflated 61%)
    adding: src/fr/pepintrie/pepintrie_plugin/Main.java(in = 432) (out= 219)(deflated 49%)
     
  6. That's why you should use a build tool like Gradle or Maven.
     
  7. Normal Eclipse doesnt read your plugin.yml
    .
    Verify your path in your plugin.yml
     
  8. From what i see, its seems to be fr.pepintrie.pepintrie_plugin.Main
     
  9. Sorry I tried with an old version of my plugin which have "_" in pepintrie_plugin, but the path is correct in this version (and in the current version).
    I going to use gradle
     
  10. With gradle I can build the plugin. Thanks for the help ! :)