Define bukkit project for craftbukkit project

Discussion in 'Plugin Development' started by xZise, Mar 11, 2011.

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

    xZise

    Hello,
    I don't know how to use maven :/

    I have two projects: Bukkit and CraftBukkit. But CraftBukkit couldn't resolve any Bukkit dependencies because Maven is unable to find the bukkit project. And I have no idea how I could say: “Please maven you search for a bukkit project? Here you got your bukkit project.”

    It is really annoying because before I had two bukkit repositories (the official and my fork) and I couldn't define anywhere which bukkit project now craftbukkit should use.

    Following I get from the console:
    Code:
    11.03.11 22:21:06 MEZ: [WARN] The POM for org.bukkit:bukkit:jar:0.0.1-SNAPSHOT is missing, no dependency information available
    11.03.11 22:21:06 MEZ: Missing artifact org.bukkit:bukkit:jar:0.0.1-SNAPSHOT:compile
    11.03.11 22:21:06 MEZ: Generating sources /CraftBukkit/pom.xml
    11.03.11 22:21:06 MEZ: Adding source folder /CraftBukkit/src/main/java
    11.03.11 22:21:06 MEZ: Project import completed 0 sec
    11.03.11 22:21:06 MEZ: Refreshing [/CraftBukkit/pom.xml]
    11.03.11 22:21:08 MEZ: [WARN] The POM for org.bukkit:bukkit:jar:0.0.1-SNAPSHOT is missing, no dependency information available
    11.03.11 22:21:08 MEZ: Missing artifact org.bukkit:bukkit:jar:0.0.1-SNAPSHOT:compile
    11.03.11 22:21:08 MEZ: Maven Builder: FULL_BUILD requireFullBuild
    11.03.11 22:21:08 MEZ: [WARN] The POM for org.bukkit:bukkit:jar:0.0.1-SNAPSHOT is missing, no dependency information available
    11.03.11 22:21:08 MEZ: Build errors for CraftBukkit; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project craftbukkit: Could not resolve dependencies for project org.bukkit:craftbukkit:jar:0.0.1-SNAPSHOT: Could not find artifact org.bukkit:bukkit:jar:0.0.1-SNAPSHOT
    Fabian
     
  2. Offline

    eltorqiro

    You need to do a maven clean, then a maven install on the craftbukkit project to get its artifact (the jar) into the repository. If you are using the maven eclipse plugin, right click the craftbukkit project and do Run As -> maven clean, then do the same but do maven install. The eclipse console should show you BUILD SUCCESS on both of those.

    You can do the same for bukkit.

    Adding dependencies can be done by opening the pom.xml (double click in eclipse) in your project, clicking on Dependencies tab, clicking Add and typing bukkit into the search box and selecting the right bukkit you want to depend on for your project (in case you have several). "Simple", eh? :)
     
  3. Offline

    xZise

    Okay if you define this as simple. Anyway it doesn't work. I cleaned and installed it again and it get errors because I think it use an outdated version of bukkit (where bukkit returns a worlds array in “getWorlds()” and not the list). Also I want that it uses my project and not any downloaded package (or does it try to use my project?), because I have changes in my bukkit project which I have to test.

    Fabian
    [MERGETIME="1299884008"][/MERGETIME]
    This is the error log I get if I execute maven install (in eclipse):
    Code:
    [/COLOR][/FONT][/COLOR][/FONT][INFO] Scanning for projects...
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building CraftBukkit 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ craftbukkit ---
    [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] skip non existing resourceDirectory /home/xzise/Dokumente/Eclipse Projects/CraftBukkit/src/main/resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ craftbukkit ---
    [INFO] Compiling 156 source files to /home/xzise/Dokumente/Eclipse Projects/CraftBukkit/target/classes
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 8.293s
    [INFO] Finished at: Fri Mar 11 23:44:55 CET 2011
    [INFO] Final Memory: 9M/109M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project craftbukkit: Compilation failure: Compilation failure:
    [ERROR] /home/xzise/Dokumente/Eclipse Projects/CraftBukkit/src/main/java/net/minecraft/server/BlockBloodStone.java:[19,29] cannot find symbol
    [ERROR] symbol  : method getBlockPower()
    [ERROR] location: interface org.bukkit.block.Block
    [ERROR] 
    [ERROR] /home/xzise/Dokumente/Eclipse Projects/CraftBukkit/src/main/java/net/minecraft/server/BlockPumpkin.java:[60,29] cannot find symbol
    [ERROR] symbol  : method getBlockPower()
    [ERROR] location: interface org.bukkit.block.Block
    [ERROR] 
    [ERROR] /home/xzise/Dokumente/Eclipse Projects/CraftBukkit/src/main/java/net/minecraft/server/BlockSign.java:[113,29] cannot find symbol
    [ERROR] symbol  : method getBlockPower()
    [ERROR] location: interface org.bukkit.block.Block
    [ERROR] 
    [ERROR] /home/xzise/Dokumente/Eclipse Projects/CraftBukkit/src/main/java/net/minecraft/server/BlockDoor.java:[179,33] cannot find symbol
    [ERROR] symbol  : method getBlockPower()
    [ERROR] location: interface org.bukkit.block.Block
    [ERROR] 
    [ERROR] /home/xzise/Dokumente/Eclipse Projects/CraftBukkit/src/main/java/net/minecraft/server/BlockDoor.java:[180,39] cannot find symbol
    [ERROR] symbol  : method getBlockPower()
    [ERROR] location: interface org.bukkit.block.Block
    [ERROR] -> [Help 1]
    [ERROR] 
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] 
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
    [/code]
     
  4. Offline

    eltorqiro

    Sorry, was trying to be ironic when I said "simple", as I know it can be very confusing.

    If I understand correctly, you have forked the actual bukkit repository and have made some changes to it (i.e. you aren't writing a regular plugin), and now you are trying to build craftbukkit against your custom bukkit build?

    If so, you will need a version of craftbukkit that is around the same time as you forked bukkit, so that it can be built successfully against your fork. From the above error, it looks as if you are trying to build a new version of craftbukkit against an old version of bukkit (hence the unknown getBlockPower() method). Is the old version of bukkit your fork? I would think you can get a point-in-time version of the craftbukkit source via git, but unfortunately I have no idea how to do that.

    An alternative would be to merge your forked bukkit with the most recent one from git, and manage the conflicts within eclipse's Team Synchronization perspective. Then you can just build the most recent craftbukkit with your modified bukkit.

    If I have misunderstood, and you actually do have a version of craftbukkit that is compatible with your forked bukkit, you can specify the particular dependency by opening the pom.xml in the proper craftbukkit project, going into the Dependencies tab, deleting the bukkit dependency that is there, typing bukk into the search box and when it brings up the list, choose the project that has your forked bukkit, then click OK. Then maven clean and maven install your forked bukkit, then maven clean and maven install craftbukkit and it will use the artifact from your bukkit fork. If that doesn't work, then it may be because you don't have a compatible version of craftbukkit after all, in which case try what I mentioned in last paragraph.
     
  5. Offline

    xZise

    Yep I want to add a simple feature. I'm using a quite new bukkit and craftbukkit which should work together. I think that maven or whatever don't link my craftbukkit project (forked and cloned git repository) with my bukkit project (also forked and cloned git repository). Because when I request the Interface org.bukkit.Server within the Craftbukkit build, it only shows up that the source couldn't found and only shows the class file of a bukkit jar.
    org.bukkit.server-fail.png

    But there doesn't show up any projects.
    select-dependency.png

    Fabian
     
  6. Offline

    l3x

    some of developers also specify path (i saw something like ${project.basedir}/../bukkit-0.0.1.jar) in pom.xml
     
  7. Offline

    xZise

    And to which jar?

    Fabian
    [MERGETIME="1300198034"][/MERGETIME]
    Push… I don't know, but where I should define a path to the jar? And I don't have any jar or does maven create a new one?

    Fabian
     
  8. Offline

    eltorqiro

    In that screenshot of the Add Dependency window, if you expand the bukkit or craftbukkit items you will see the list of artifacts that get produced from those projects (i.e. the jars). That's how you can choose the dependency.

    Also, if you want to explicitly link to your forked versions you need to change some property of them so they can be installed into the repository, e.g. change the version or artifact-id or something you choose in the project properties pom. Then you can have the default craftbukkit/bukkit in your maven repository as well as your custom forked versions and be able to select which to build against using the Add Dependency window.
     
  9. Offline

    xZise

    Hmmm okay, it is now working somehow.

    Fabian
     
Thread Status:
Not open for further replies.

Share This Page