How To: Beginning with Eclipse

Discussion in 'Plugin Development' started by Nohup, Feb 25, 2011.

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

    Nohup

    Based on numerous posts I have read, there are many folks struggling with how to set up their plugins and manage their dependencies/code. So, with this in mind I have put together a basic template for a plugin project and will use this post as a "how to" entry to help folks get started.

    First, a few disclaimers...
    • I already have all of this set up on my machine so I haven't tested the steps as I have them written here. I believe that I remember everything, but I am an old man and could have forgotten something. Please let me know if you hit an issue and I can a) help you through it and b) correct this document.
    • I have created a Maven2 Repository on my personal domain to house "versioned" jars of the Bukkit releases. Basically, rather than 0.0.1-snapshot all the time I am renaming them 0.0.1-n where n is the jenkins build number. I haven't asked the Bukkit folks what they think of this, so if they come back and tell me they hate me I will have to take it down. In that case I can update this example to use their repository, but that will just mean you will have to delete files out of your local repository any time you want an update, and you will have to figure out what version you truly have.
    • I program Java for a living and have done so for over a decade. As with any programmer, I have my way of doing things and everyone else's sucks (j/k). Just remember that because I do something one way doesn't mean it HAS to be that way, but I am trying to provide a baseline for you to work with.
    Part 1 - Getting the project set up

    Tools Needed:
    Java JDK - http://www.oracle.com/technetwork/java/javase/downloads/index.html
    (note: make sure to choose Download JDK, not Download JRE. Also, I have the compiler configured in the project to use version 5 since that is what Bukkit has in their configuration. You can find version 5 under the "Previous Releases" section.)
    Eclipse IDE for Java Devlopers - http://eclipse.org/downloads/
    Maven - http://maven.apache.org/download.html
    (note: I am using 2.2.1 but I believe the Bukkit team is using a 3.x version. This example *SHOULD* work with either.)

    Project Files: Download Files

    System Configuration Steps:
    (note: Sorry, I am a windows guy and dont know the Mac steps. If someone wants to contribute them they can!)
    1. Open Control Panel.
    2. Navigate to System Security and choose the overall System link.
    3. Select the Advanced system settings link on the left hand panel.
    4. In the dialog that shows, choose the Environment Variables button in the bottom-right corner.
    5. Create a new variable and name it JAVA_HOME. For the value you will need the installation path from your JDK installation (typically c:\program files\java\jdk... where the final directory is based on the version number you installed).
    6. Create a new variable and name it MAVEN_HOME. Again the value will be where you installed/extracted Maven previously (this is specific to how you extracted the file, but as an example mine is at c:\program files\apache-maven-2.2.1).
    7. Edit the Path variable entry and append the directory for your maven installation with /bin on the end (so c:\program files\apache-maven-2.2.1\bin). This is necessary to allow your system to understand what mvn means in the steps below.
    8. Click OK on the Environment Variables dialog, then again on the System Properties dialog.
    (note: Steps 6 and 7 can be done for either the user or the system, I leave that up to your discretion based on how your computer is used)

    Eclipse Configuration Steps:
    1. After installing Eclipse, open it. The first thing that will be asked of you is to specify a workspace for Eclipse to work out of. For the sake of this document I will use the workspace of c:\proj but you can place the workspace wherever makes sense to you.
    2. Eclipse will then present you with a welcome screen that you can go over when you want, but for now proceed to the workbench.
    3. On the menu, open Window/Preferences.
    4. Choose the General option and expand the Editors options. Choose the File Associates option under Editors.
    5. Under the File Types, check for an association for *.yml. * This will most likely not exist. *
      1. If the association does not exist, click the Add button.
      2. For file type use *.yml and click okay.
      3. Choose the *.yml entry under File types (should be chosen by default).
      4. Under Associated editors click the Add button.
      5. Select the Text Editor entry for Internal editors and click OK.
    6. Now, under preferences, select the Java option and go to Installed JREs.
      1. If the version you downloaded is not already present here, you need to add it.
      2. Click the add button and choose "Standard VM".
      3. In the JRE Home field, browse to the directory where you installed the java JDK (i.e. c:\program files\java\jdk...). If you choose the file correctly, everything else will fill in and the defaults are fine.
      4. Click Finish.
    7. Make sure the right version of the JDK is checked in the Installed JREs list.
    8. Still in Preferences, under the Java option choose the Build Path option and expand it.
    9. Under the Build Path option choose Classpath Variables.
    10. Create a new variable for M2_REPO.
      1. Check for the repository folder. * This folder is likely not to exist yet if you have never used Maven repositories before. * The folder, by default, will be in your user profile directory (i.e. c:\users\username or c:\documents and settings\username) and is named .m2.
      2. If the local repository does not exist, create the folder .m2. In the new folder .m2, create a sub-folder named repository.
      3. Use the path to the newly created repository folder as the M2_REPO value (i.e. c:\users\username\.m2\repository).
    Eclipse should now be set up to a) use the JDK you specified, b) use a local maven repository (more on this later), and c) open the YML files without going to an external text editor. I know, that seemed like a lot, but it is a one-time thing and now you are ready to rock and roll!

    Now you are ready to start your project. Take the zip folder downloaded above from Project Files and expand it under your workspace directory (example c:\proj), this will result in a folder such as c:\proj\BasicBukkitLayout.

    To get this project ready for use in Eclipse you will need to do the following steps:
    1. Open the command shell (it's DOS folks...). The program is under the Start/Accessories menu as Command Prompt.
    2. Change the directory to where you extracted the project (cd c:\proj\BasicBukkitLayout).
    3. Run the command mvn eclipse:eclipse (see note below)
    4. Exit the command shell (or leave it open if you want, doesn't matter... you will need it again when it is time to build your plugin).
    Now the project has built the configurations for Eclipse AND downloaded your dependencies. By default this should download the bukkit versioned jar that was in the default configuration to your local repository. You should now see a org folder under your .m2/repository path if you go look at it. The full path created would be org/bukkit/bukkit/0.0.1-412/ as of the writing of this article, and in that directory you should see a jar file named bukkit-0.0.1-412.jar.

    To get the file into Eclipse so that you can work on it, go back to the Eclipse IDE and follow these steps:
    1. Choose the File menu option and then the Import sub-option.
    2. A dialog will appear asking you to select the import source. Choose "Existing Project into Workspace" (this should be the default).
    3. For root directory, choose the path where you extracted the zip file. For example, c:\proj\BasicBukkitLayout.
    4. You should see the entry BasicBukkitLayout and it will be checked (as long as you don't already have one in your workspace).
    5. Click the Finish button.
    And now you have a project to work with, organized and with the basic pieces (and more really) you will need to get started. So now you are ready to create your own plugin and join the ranks. Let's venture on to Part 2 of this tutorial and get your plugin named and coded!

    Part 2 - Fun with plugins!

    This assumes at some point you have followed Part 1 - Getting the project setup and are now ready to create your plugin. All examples herein follow that assumption, so don't make an ASS out of U and ME.

    So we are in Eclipse, you should have a project in your workspace named BasicBukkitLayout. Under this project you should see:
    • Two source folders: src/main/java and src/main/resources
    • Under src/main/java there should be packages for
      • my.packagename
      • my.packagename.listener.block
      • my.packagename.listener.entity
      • my.packagename.listener.player
      • my.packagename.listener.server
      • my.packagename.listener.vehicle
      • my.packagename.listener.world
      • Each of these packages should have a class file name MyXXXListener where XXX corresponds to the type (i.e. block, entity, etc.)
    • Under src/main/resources is your plugin.yml.
    • A pom.xml
    First things first, you don't want your plugin named "BasicBukkitLayout", so let's take care of that. Come up with a cool name, search Bukkit.org and make sure it isn't already used. I'll wait...

    Now, let's rename this puppy. Don't worry, while EVERYTHING in this project has a fake name right now, Eclipse will take care of renaming the files and references as needed. So first, let's say your plugin name is "MyCoolPlugin".
    To rename your project highlight the top-level of the BasicBukkitLayout project and choose Refactor then Rename from the menu. Type in "MyCoolPlugin" and click okay. This will rename your plugin AND move it on the underlying file system so you are now working in c:\proj\MyCoolPlugin.

    Now let's rename your packages. Choose the my.packagename package and then choose the Refactor and Rename options from the menu. Notice that the dialog is different as it is context-sensitive. Type in a package name but * do NOT use org.bukkit *. For this example I will use my.cool.plugin. If you need help coming up with a package name see this post. Before clicking OK, make sure the "Update references" and the "Rename subpackages" option is checked (Rename... will not be by default). This will keep you from having to rename all of your packages individually!

    Now, we have our packages ready, so let's rename our plugin. The steps are all the same, under the new my.cool.plugin package is the class MyPlugin. Choose that file and then use the Refactor/Rename options. Enter MyCoolPlugin as the class name, make sure that the "Update references" option is checked (it should be by default) and click OK. This updates not only the base plugin class file, but all of the listener files as well since they each have a reference to the plugin within them.

    Finally we need to update the plugin.yml to use the new references, and to put in the basic information. Open the plugin.yml file that is under the src/main/resources folder. Thanks to configuration changes made in part 1 this should open in your main eclipse window and not in an external program like notepad. You will need to update each of the entries in this file and they are:
    • name - the name of your plugin, so in this case MyCoolPlugin
    • main - this is your main plugin class, in this example my.cool.plugin.MyCoolPlugin
    • version - whatever version you are going to call it, let's say 1.0
    • description - that's all you man, keep it short and sweet
    • author - again, all you, put in a name
    Save the file and now your settings are good. Many other options, including commands, can be stored in this file. As this is meant to be a basic "let's get you started" walkthrough I will not go over those here.

    Okay, I am sure by now after your TLDR syndrome is starting to kick in you are ready to get this plugin to DO something. Depending on what you are doing will determine what you need to keep in the project and what can go. If you want to make a block change it's type every time they try to mine it (hmm, I just came up with another fun plugin idea, don't steal that!) then you obviously don't need to listen to server and world events (or anything but block really). So think about what you are going to be doing, and the listeners you need will need to be renamed if they are going to remain in the plugin. So if we need the block listener, rename the class to reflect your plugin, i.e. MyCoolPluginBlockListener. This will help to keep class names unique and prevent code collisions down the road. I GUARANTEE that if this tutorial is used there will be one where there are two projects using MyBlockListener :)

    You can leave the other listeners for now just in case you need them and don't want to have to set them up again, but in the end if you aren't using them you can delete the class and the package from your plugin.

    -- INSERT CODE HERE --

    I don't think I need to go through coding examples here, there are already sample projects out there to look at and plenty of plugins (including the ones in my signature) have made their sources available. Read up on them, look at style as well as code examples since well-styled code will help in the long run.

    -- CODE COMPLETE HERE --

    Next I want to discuss the pom.xml file that is in the source directory. You probably won't have to touch it much, but it is the glue that helps hold a project together in Maven. POM stands for Project Object Model, and it is a structured file that basically tells Maven what to do with your project. Lets go through the basic one I have included line by line for your understanding:

    Code:
      <modelVersion>4.0.0</modelVersion>
      <name>Minecraft - BasicBukkitLayout</name>
      <groupId>my.packagename</groupId>
      <artifactId>BasicBukkitLayout</artifactId>
      <version>0.1</version>
      <packaging>jar</packaging>
    
    • modelVersion - set and forget, no need to touch this right now really
    • name - an overall name for your project, this does not affect your file or project names in eclipse and is more descriptive
    • groupId - this is your main package, so in the example my.cool.plugin and it can come in handy if you ever want to store your plugins in a repository for others to use
    • artifactId - this is your plugin name in this case, and will ultimately be the name of your jar file based on the configurations I passed in this file.
    • version - normal projects would use this in their jar file name for versioning purposes, for example bukkit would have 0.0.1-SNAPSHOT here and that is how their jar comes out. In our case, it is just a pretty little entry for you to keep up with so that it is in synch with your plugin.yml.
    • packaging - this is what Maven is looking to build the source code into, just leave it as jar.
    Code:
      <repositories>
        <repository>
          <id>nohups</id>
          <url>http://nohupgaming.com/m2repo</url>
        </repository>
      </repositories>
    
    This is the configuration pointing to the repository I set up with the "versioned" bukkit jars. You can add other repositories here, including the bukkit repository if you choose/need. What this does is that it will automatically download your dependencies for you from the repositories specified if it can find them. So if we go from version 432 to 440 then you update the dependency entry that we will go over next, run the mvn eclipse:eclipse command, refresh your project in Eclipse and now you will be pointing to the new bukkit jar file and it will be located in your local repository. Lots of benefit, little effort.

    Code:
      <dependencies>
        <dependency>
          <groupId>org.bukkit</groupId>
          <artifactId>bukkit</artifactId>
          <version>0.0.1-412</version>
          <scope>compile</scope>
        </dependency>
    <!--
        <dependency>
          <groupId>org.bukkit</groupId>
          <artifactId>craftbukkit</artifactId>
          <version>0.0.1-432</version>
          <scope>compile</scope>
        </dependency>
     -->
      </dependencies>
    
    Here is the specification to the bukkit version so that you can reference bukkit functionality within your plugin. As you need later versions, update the version entry to the appropriate one and as mentioned above when you run the appropriate commands the dependencies will download and update within your project. Notice that I have the craftbukkit dependency listed but it is commented out (the <!-- and --> block around it ) so it isn't being used in the project right now. There ARE times when you may need it, so I have the entry here if you do and you just need to remove the comment specifiers.

    Code:
      <build>
        <directory>target</directory>
        <outputDirectory>target/classes</outputDirectory>
        <finalName>${artifactId}</finalName>
        <sourceDirectory>src/main/java</sourceDirectory>
        <plugins>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <source>1.5</source>
              <target>1.5</target>
            </configuration>
          </plugin>
        </plugins>
      </build>
    
    This is the rest of the file. Basically it tells Maven where you want your jar built to, what you want it named, what you want built, and what version of java to use. The only entries you would ever need to maintain are:
    • finalName - if you wanted to make a static name or add the version into the final jar name dynamically you can do that here.
    • source/target - these are referring to the java source. If minecraft and bukkit go to a Java 6 standard and you want to make sure your plugin is compatible then you would need to update these to 1.6
    So there it is, the pom file demystified, at least this tiny one for a plugin project :) Again, this really drives how the project is used, what it uses, and what it results in. It is small but powerful.
    Finally, there are a few Maven commands you will want to know. Maven commands, as mentioned in the examples above, are called using the command mvn and then parameters. The commands of interest to you at this point would be:
    • mvn eclipse:eclipse - this command basically gets the project built/updated for viewing in the Eclipse IDE. It will update your dependencies and build the .classpath file based on the pom.
    • mvn clean package - this is really two commands chained together. Clean tells maven to remove your output directory so that you don't have conflicts with files that are already sitting there. Package tells maven to build your project into its ultimate format, in this case a jar file. Once this command has built successfully you should have a file at c:\proj\MyCoolPlugin\target called MyCoolPlugin.jar.
    So that's it, I think... This should be everything you need to know to get your foot in the door programming basic Bukkit plugins with Eclipse. Again, I have probably forgotten something or made a mistake along the line here, and I will update these posts based on feedback but it should get you going. I hope this is useful to those that need it and that it results in lots of cool plugins to come!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 10, 2016
    spiral6 likes this.
  2. Offline

    Osuka_

    Yep, here am I again. But, what exactly were you doing on System configuration? I'm a mac user, but if you tell me what were you doing, I might actually find the equivalent on OSX. And, if you find out by yourself (not asking it) it would be of great help. Thanks in advance.

    EDIT: BTW, what happens if I don't actually configure the system? Just for the sake of curiosity...

    EDIT2: LOL, I was distracted, and I could swear pom.xml was actually porn.xml. LOL again.
     
  3. Offline

    Nohup

    In the system configuration you have to set a system variable for JAVA_HOME and MAVEN_HOME so that when you run the commands in the shell it knows where the actual executables are. So later on when I say mvn eclipse:eclipse it know that mvn is the mvn program that is in c:\program files\... (wherever you installed Maven)
     
  4. Offline

    Osuka_

    Thanks, I got it. So yeah, now, starting the plugin... I'll keep you updated as I progress. (expect SEVERAL edits. Seriously.)

    EDIT: Cannot name the folder .m2. Generates an error.

    EDIT2: LOL, pretty easy with command prompt. Seriously. I don't know Java, but I spend entire evenings with PCs since I was three. Seriously. Again.

    EDIT3: " 'mvn' is not recognised as an internal or external command, an operable program or a batch file." Self-explainable. Now checking the Maven variable.

    EDIT4: Variables are OK, I don't know where the mistake is. BTW, is mvn.bat supposed to be under \bin?

    EDIT5: Variables were NOT OK. Found it out on the README file. README, FTW!!!

    EDIT6: Forgot to add what you missed; you need to add the user variable (Not system, it conflicts with the current PATH - Windows Vista x86)
    Code:
    PATH = C:\apache-maven-3.0x\bin
    (As of the writing of this edit)
     
  5. Offline

    Nohup

    So are you up and running now? I couldn't really follow your previous post...
     
  6. Offline

    Daniel Heppner

    I'm not! I can't get the environment variables to work, Windows 7 64 bit.
     
  7. Offline

    SunShe

    Is it a message error at Eclipse starting?
    If then, go install there : it will be fixed.
     
  8. Offline

    Daniel Heppner

    No, I'm can't use mve from the command line.
     
  9. Offline

    Nohup

    so when you type mvn at the command line it says cant find the executable or is it saying something else? Do you have MAVEN_HOME set? and JAVA_HOME? MAVEN_HOME should NOT include the bin folder.
     
  10. Offline

    Osuka_

    @Daniel Heppner
    @Nohup
    Yes it should. Mine only worked when I set MAVEN_HOME to C:\ApacheMaven\bin. Otherwise, says that " 'mvn' is not recognised as an internal or external command, an operable program or a batch file."
     
  11. Offline

    Nohup

    I think you are confusing MAVEN_HOME with what needs to be in PATH which I apparently left out of my post [​IMG]
     
  12. Offline

    phondeux

    I love this, thank you for creating it!

    A couple of questions though;
    • Is there a way to globally change the file names from MyPlugin to PhondeuxPlugin or whatever?
    • Most plugins have a com.path.author.Plugin path name but this just creates files called MyPluginWhatever; how do you change it to com.my.phondeux.Plugin - do you have to visit each one individually and refactor them?
    Thanks again for making this, I'll probably convert my couple of projects over to this once I understand it completely!
     
  13. Offline

    Nohup

    if you use Eclipse's refactor option (under Source/Refactor on the menus) on the plugin file itself, there is the update references checkbox that will update all of the references in your project. Same with the package name, refactor the top-level one and make sure the checkboxes are marked and it will cascade to all the others.
     
  14. Offline

    phondeux

    That worked, thanks!

    One final question - this one's been killing me for a couple of weeks now ... how do you get Eclipse to use the MANIFEST.MF you've created and not the one it generates? [​IMG]
     
  15. Offline

    Daniel Hix

    Hey do you possibly know the config for windows xp?
     
  16. Offline

    Nohup

    Are you talking about the one that ultimately ends up in the jar file? I know if you are using maven there are directives you can give to the archiver plugin to to it. If you are talking about the Eclipse export path, then I found this article on how you can define your own
     
  17. Offline

    SoulOfAngel

    It says you must type a file name when i create a .m2 folder. any help? thanks

    ok..i found a solution..use cmd, cd to ur username folder, type "md .m2" without quotes
     
  18. Offline

    Nohup

    yah, explorer freaks a bit on it. i was telling Daniel in PM that when you run mvn eclipse:eclipse it will also create the directory if it doesnt exist when it downloads the dependency jars.
     
  19. Offline

    SoulOfAngel

    nohup..do u have any sample plugin? cos from what i see from bukkit it is like different kind of style.
     
  20. Offline

    Nohup

    all of my plugins have their source available on GitHub. When you say different style how do you mean? Everyone has a coding style, I use this shell to start each of my plugins. Basically I copy and paste it, rename what I need and go from there. What is different from Bukkit's tutorial and what is here is that this uses maven for dependency management so that you don't have to manually add them as in their tutorial. The funny thing is if you look at Bukkit's source they use maven too lol. There are lots of ways to set up your environment, I was just offering an alternative to manually doing it all.
     
  21. Offline

    phondeux

    I set the build to use bukkit 493 - it's the new recommended, but I get the following error in maven;

    Code:
    [WARNING] Workspace defines a VM that does not contain a valid jre/lib/rt.jar: C
    :\Program Files\Java\jre6
    [WARNING] could not read workspace project:C:\Users\Glenn\workspace\.metadata\.p
    lugins\org.eclipse.core.resources\.projects\Borders
    org.codehaus.plexus.util.xml.pull.XmlPullParserException: only whitespace conten
    t allowed before start tag and not \uef (position: START_DOCUMENT seen \uef... @
    1:1)
            at org.codehaus.plexus.util.xml.pull.MXParser.parseProlog(MXParser.java:
    1519)
            at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl(MXParser.java:139
    5)
            at org.codehaus.plexus.util.xml.pull.MXParser.next(MXParser.java:1093)
            at org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java
    :187)
            at org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java
    :83)
            at org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java
    :48)
            at org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations.readArt
    efact(ReadWorkspaceLocations.java:335)
            at org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations.readWor
    kspace(ReadWorkspaceLocations.java:536)
            at org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations.init(Re
    adWorkspaceLocations.java:94)
            at org.apache.maven.plugin.eclipse.EclipsePlugin.getWorkspaceConfigurati
    on(EclipsePlugin.java:1902)
            at org.apache.maven.plugin.eclipse.EclipsePlugin.fillDefaultClasspathCon
    tainers(EclipsePlugin.java:1438)
            at org.apache.maven.plugin.eclipse.EclipsePlugin.setup(EclipsePlugin.jav
    a:885)
            at org.apache.maven.plugin.ide.AbstractIdeSupportMojo.execute(AbstractId
    eSupportMojo.java:500)
            at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
    BuildPluginManager.java:101)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:209)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:153)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:145)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
    ct(LifecycleModuleBuilder.java:84)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
    ct(LifecycleModuleBuilder.java:59)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
    ild(LifecycleStarter.java:183)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
    eStarter.java:161)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
    cher.java:290)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
    a:230)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
    uncher.java:409)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
    352)
    [INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAIN
    ER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5
    [WARNING] Missing POM for org.bukkit:bukkit:jar:0.0.1-493
    [WARNING] An error occurred during dependency resolution.
        Failed to retrieve org.bukkit:bukkit-0.0.1-493
    Caused by: Failure to find org.bukkit:bukkit:jar:0.0.1-493 in http://nohupgaming
    .com/m2repo was cached in the local repository, resolution will not be reattempt
    ed until the update interval of nohups has elapsed or updates are forced
    
    Try downloading the file manually from the project website.
    
    Then, install it using the command:
        mvn install:install-file -DgroupId=org.bukkit -DartifactId=bukkit -Dversion=
    0.0.1-493 -Dpackaging=jar -Dfile=/path/to/file
    
    Alternatively, if you host your own repository you can deploy the file there:
        mvn deploy:deploy-file -DgroupId=org.bukkit -DartifactId=bukkit -Dversion=0.
    0.1-493 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
    
    Path to dependency:
            1) my.teamphondeux:BasicBukkitLayout:jar:0.1
            2) org.bukkit:bukkit:jar:0.0.1-493
     
      org.bukkit:bukkit:jar:0.0.1-493
    
    from the specified remote repositories:
      nohups (http://nohupgaming.com/m2repo, releases=true, snapshots=true),
      central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
    
    [INFO] Unable to read jar manifest from C:\Users\Glenn\.m2\repository\org\bukkit
    \bukkit\0.0.1-493\bukkit-0.0.1-493.jar
    [INFO] File C:\Users\Glenn\workspace\TeamPhondeux\.project already exists.
           Additional settings will be preserved, run mvn eclipse:clean if you want
    old settings to be removed.
    I know one of the errors means you don't have the 493 build on your repository, how would i point it to ci.bukkit.org so I can just grab from there?

    No idea what the "[WARNING] could not read workspace project:C:\Users\Glenn\workspace\.metadata\.p
    lugins\org.eclipse.core.resources\.projects\Borders" means ... is it looking at another one of my projects? I don't want it to! I ran the mvn eclipse:eclipse command in the directory of my mvn project, why is it circling out to my other project?
     
  22. Offline

    Nohup

    Actually I do have 493 in my repository, but 493 is the CraftBukkit version, where 432 is the latest Bukkit version I have in my repo.

    Maven should never spiral outside of the current project unless something tells it to. It sounds like the issue you are hitting relates to POM files being saved in UTF-8. You may want to open your POM in Notepad, and save it with ANSI encoding. I've never run across this issue and just had to google it to see what it was.
     
  23. Offline

    phondeux

    Ah, that's what the issue is. I want to build against CraftBukkit and get the latest onCommand references.
    Right at the top of the pom it says;
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
     
  24. Offline

    Nohup

    Yah, like I said, just going on what was said in a post I found googling it. I have the same starting my POM and have no issues with it. Unfortunately when it is maven hosing up we are into the "black box" area lol. Try removing that line and saving as see what happens, I have to assume it is something with your config versus mine so it is kind of a shot in the dark.

    -- EDIT --

    Did more reading, it is basically a BOM in your file that needs to be removed. I see where patches have been applied in later maven versions, so you could either try one of those or strip the BOM. I found this utility on a quick google search but I am sure there are others out there that could help. I just can't speak to what one is good and what isnt...
     
  25. Offline

    phondeux

    Well, when i tried to set the dependency to craftbukkit i just edited the POM and changed 'bukkit' to 'craftbukkit' in the dependency artifact id and then changed the version in the same area. Should I have done it a different way?

    [edit] Switched it back to how it was and still get the same stupid error. How does one delete everything and start over? Time to google ...
     
  26. Offline

    Nohup

    I had the craftbukkit dependency in the original pom, just commented out:

    Code:
        <dependency>
          <groupId>org.bukkit</groupId>
          <artifactId>craftbukkit</artifactId>
          <version>0.0.1-493</version>
          <scope>compile</scope>
        </dependency>
    
     
  27. Offline

    phondeux

    I uncommented it out, ran mvn eclipse:clean and then ran eclipse:eclipse but am still chock full of errors. :(
     
  28. Offline

    Eddie plays mc

    I'm running vista 64 bit, I can't find system security there's no option in my control panel, can I have a picture please?
    (I've taken a course in Java, just this always happened when I start new stuff.
     
  29. Offline

    Nohup

    Start, Control Panel, System and Security, System, Advanced settings. Keep in mind, in Vista the section titles are links :)
     
  30. Offline

    Eddie plays mc

    Hey me again, I've set JDK and Maven up but when I try to run eclipse it's searching it it's own file for the JDK, I made 2 system variables one JAVA_HOME and MAVEN_HOME but I'm not sure.
     
Thread Status:
Not open for further replies.

Share This Page