Setting Up Eclipse
This article describes how to configure your Eclipse workspace for plugin development with SpongeAPI and a build system such as Maven or Gradle.
Nota
A tutorial by Mumfrey showing the setup of a Sponge workspace in Eclipse, using the new features in Buildship and ForgeGradle, can be viewed here.
Gradle
Preparing Gradle
Nota
Gradle is automatically included in Eclipse starting from the Neon release (June 22, 2016) and later. These steps are only required for earlier versions.
Tu devi prima installare la Integrazione Plugin Gradle prima di cominciare a usare Gradle in Eclipe. Questo deve solo essere fatto al momento della creazione del primo progetto.
Suggerimento
Typically, you do not need the optional Spring modules distributed with this plugin, so you can uncheck them during installation.
Apri Eclipse.
Clicca
Aiuto > Mercato Eclipse
.Cerca per
Gradle Integration Plugin
.Installa la Gradle Integration Plugin.
Creating your project
Apri Eclipse.
Clicca
File > New > Other
.Select
Gradle > Gradle Project
.Clicca
Next
.Metti il nome del progetto, poi clicca
Finish
.
Editing the build script
Open
build.gradle
in the navigator.Edit the build script according to the instructions at Setting Up Gradle.
Right-click your project, and select
Gradle > Refresh Gradle Project
.
Importing your project
If you’ve already started with your project and want to import it again at a later point you need to import it instead of re-creating it inside your IDE:
Click
File > Import
Select
Gradle > Gradle Project
Navigate to the root folder of the project
Click Finish
Maven
Creating your project
Apri Eclipse.
Clicca
File > New > Other
.Select
Maven
on the left side of the popup, and selectMaven Project
on the right side.Clicca
Next
.Select
Create a simple project
, unless you require a more advanced setup.Enter your Group ID, Artifact ID, Version, project name, and project description.
Your Group ID should usually correspond to your Java package name. See Classe principale del plugin for details.
Your Artifact ID should usually correspond to your plugin ID you chose earlier, e.g.
myplugin
.La tua Version è aggiornata.
Click
Finish
.
Suggerimento
Eclipse often does not open new projects after creating them. If this happens, try closing the Eclipse welcome screen; your project should be open behind it.
Editing the project configuration
Open
pom.xml
in the navigator.Edit the build configuration according to the instructions at Setting Up Maven.
Refresh your Maven project.
Importing your project
If you’ve already started with your project and want to import it again at a later point you need to import it instead of re-creating it inside your IDE:
Click
File > Import
Select
Maven > Existing Maven Projects
Navigate to the root folder of the project
Click Finish
Git Integration
The Eclipse Foundation offers documentation on using Eclipse’s EGit plugin: