How to get eclipse to recognize the new Bukkit version through maven?

Discussion in 'Plugin Development' started by varesa, Mar 6, 2012.

Thread Status:
Not open for further replies.
  1. I started to fix my broken plugins (new Listeners), but I cant get eclipse to work with the new version of Bukkit. I told git to fetch/pull/... , then "maven clean", and "maven install" Bukkit/target show Bukkit-1.2.3... .jar, so I can confirm that it has downloaded the new version, and built it fine.

    The problem is that my plugins still do not recognize PluginManager.registerEvents(). Code completion tries to offer .registerEvent(Arg1, Arg2, ...). I have tried to tell my plugin to "update dependencies", "update configuration", and even disabled "maven nature", and re-enabled it. Still doesn't work.

    I am still pretty much a maven noob, though (atleast I thought) I have mastered (some of) the basics. Last time I tried to update to new Bukkit API, I remember having had the exactly same problem. Tried everything, and got it to work at last. Not this time(I guess I have tried everything, but what I should do).

    Can somebody with a bit bigger knowledge of maven give me some help?
     
  2. Offline

    Njol

    I never used Maven, but when I want to update to the newest RB I simply download the new CraftBukkit.jar and change the build path to reference to it. So you might want to check your build path.
     
  3. "My build-path is automatically generated by maven". In my maven xml-file, that describes my plugin, I have added "Maven module: Bukkit" as a dependency. It should be able to automatically solve these dependencies and do some fancy stuff :D
    I am not sure why I started to use maven, because in my scale it seems to be very much of a overkill, and many times I might have been easier without. But now that I have started, I decided to give it a go. I'd like to know what I am doing wrong, and maybe someday I know maven good enough, so that it helps me, rather than slowing me down :D.
     
  4. Offline

    desht

    "mvn eclipse:eclipse" will regenerate your Eclipse .classpath & .project files. Then just refresh your project in Eclipse, and you should see the new Bukkit version in your build path.

    Maven does seem like overkill sometimes, but I wouldn't go back to life without it now.
     
  5. Where should I put that command?
     
  6. Offline

    desht

    On the command-line. If you're running Unix/Linux, just type it into your shell prompt. If you're running Windows, I guess it'll be the same but I don't know :)
     
  7. I don't have the standalone version of maven installed, only the eclipse package. My system does not recognize command "mvn" (And yes I'm running on Linux).
     
  8. I installed the standalone version of maven, and ran the command you gave. Still doesn't work.

    I started searching for the problem once again, and noticed that in my ~/.m2/repository/... are folders 1.2.3-...-SNAPSHOT and 0.0.1-SNAPSHOT. I think bukkit has changed the maven artifacts version, and that is what causes my problems. Currently I have added 0.0.1-SNAPSHOT as the dependency in my project's pom.xml. In the past the versions were always 0.0.1, but now they have started to follow the corresponding Minecraft-version? Does that mean I have to now change my pom.xmls too when there is a new update?
     
  9. Offline

    desht

    Yes, the versioning has changed. You will want to change the version you're building against in your pom.xml whenever you want to start building against a new version (yes, a bit more work, but you have more control over exactly what you're building against now). If you browse http://repo.bukkit.org/content/groups/public/org/bukkit/bukkit you can see at a glance what versions are available for your build.

    Oh, one other thing - you do need Maven 3 to build Bukkit/Craftbukkit. Depending on your Linux distro, you might only have Maven 2 available through official channels, in which case you need to install Maven 3 yourself - there is a PPA here for Ubuntu.
     
    varesa likes this.
  10. Do you know which version the m2eclipse plugin uses? I am on CentOS 6, and could not find any version of maven through the packaging-system. I installed the newest version from maven-project's page, but I think my eclipse uses its own. Of course I could transfer to doing the whole building from command-line out of eclipse, if the eclipse plugin starts to make trouble.
     
  11. Offline

    desht

  12. Maybe that way I would learn to understand it better. Those guis often hide lot of what a cli-user would usually have to learn. It sometimes makes it hard to understand what everything does.
     
    desht likes this.
Thread Status:
Not open for further replies.

Share This Page