Maven modules

Discussion in 'Spigot Plugin Development' started by bys1, Apr 27, 2017.

  1. Hi,
    I am trying to get abstraction to work with Maven modules (https://bukkit.org/threads/support-multiple-minecraft-versions-with-abstraction-maven.115810/).
    I keep getting these errors:
    https://s14.postimg.org/udb22w29t/image.jpg
    https://s8.postimg.org/kbfdn8k6t/image.jpg

    I've tried solving them myself with some stackoverflow topics but I couln't figure it out. I have the sollowing set up:
    https://s17.postimg.org/qqdqfa68f/image.jpg
    https://s12.postimg.org/evqjam68t/image.jpg

    How can I properly create Maven modules without getting these annoying errors?
    Thanks in advance.
     
  2. Not a maven Issue. Your classes are in the root src folder (not in a package) and you have a package declaration. You need to move the classes to the package.
     
  3. My classes are in a package. View the screens please...
     
  4. electronicboy

    IRC Staff

    You've probably misconfigured your directory roots in your IDE or something, this isn't a maven issue but an IDE issue, specifically in how it's seeing the roots of maven modules
     
    • Like Like x 1
  5. I think it's an issue with Eclipse indeed. Eclipse does not see folders as a source folder properly.
    How can I solve this?
     
    • Like Like x 1
  6. electronicboy

    IRC Staff

    Well, the IDEs maven plugin should handle that properly, might need to re-import the project(s);
    You might also be able to manually mark them if that doesn't work, however, I've never really used eclipse due to my woes with it.
     
  7. After adding core/Plugin/src/main/java to the Java Build Path -> Source the package declarations etc work fine. Now I keep getting errors like "The import org.bukkit.craftbukkit cannot be resolved".

    I have found the problem. Eclipse searches for the dependencies in the main pom.xml instead of the pom.xml in the module which causes it to be unable to resolve imports. How can I fix that?
     
  8. You can also define multiple Spigot / Bukkit versions in the main pom.xml if you want to use multiple method versions in your plugin.
     
  9. Lol. You can't. Maven will just select one version
     
  10. If you use lets say a bukkit method that is not implemented anymore in the newest Spigot version you get from maven. You can define a older/second version from Spigot via maven that will then used from Bukkit to get the method.
     
  11. I need craftbukkit and I can only define one version of craftbukkit
     
  12. Its eclipse. Create a new project and move your classes over.
     
  13. A new project per module?
     
  14. For eclipse a new project, in intellij it would be a module