User:Sagacious Zed/Maven Plugin Tutorial/Eclipse

From BukkitWiki
Jump to: navigation, search

Creating a Maven Project

In eclipse you can create a new project by selecting File > New > Project... from the toolbar.

File:EclipseNewProject.png

It will open a New Project dialog. Select the Maven Project wizard and continue.

File:EclipseNewProjectDialog.png

It will open a New Maven Project dialog. We will check Create a simple project (skip archetype selection) and continue

File:EclipseNewMavenProject.png

The New Maven Project dialog will continue to configuring the project. Fill in the group id, artifact id, version, name, and description. Finish the wizard.

Lightbulb.png Note: By convention the group id and artifact id should combine to form your base package name.

File:EclipseNewMavenProjectConfigure.png

Creating a New Package

You can create a new package in eclipse by right clicking on the src/main/java folder and selecting New %gt; Package from the context menu.

File:EclipseNewPackage.png

Package Names

By convention package names should be the reverse of fully qualified domain names. If you owned example.com your packages will start with com.example.

If you don't have a domain, here are some common conventions

    1. Create an account on a source control site such as github or sourceforge
      • For github, follow the instructions here and you will have a sub-domain, so your package would be com.github.<username>
    2. Use your email. Ex: <username>@gmail.com would be com.gmail.<username>
    3. This is the least preferred method. Simply use any unique package naming, again, use this as your last resort.

There are several things that your package must not begin with and those are:

  • org.bukkit
  • net.bukkit
  • com.bukkit
  • net.minecraft

After getting the base package name, by convention the next name is the plugin name. If you owned example.com and was making the plugin HelloWord, the classes would be located in com.example.helloworld