Documentation for Confluence 2.5.4 - 2.5.8.
Documentation for [Confluence Cloud] and the latest Confluence Server is available too.

How to use Eclipse for Confluence plugin development

Eclipse can be used to make Confluence plugin development easier.

General setup

Plugin specific

The following assumes you have a somewhat standard plugin directory structure that you created or checked out from Subversion. For example:

xxx-plugin
   trunk
      src
         etc
         java
      target
  • Edit the project.xml file to make sure it contains all the dependencies needed
    • This must be done before generating the Eclipse project files
    • If the dependencies need to be changed later, the Eclipse project files will need to be re-generated and then in Eclipse, refresh your project using right click -> Refresh
  • Generate the Eclipse project and classpath files
    • From a command line, cd to the trunk directory
      cd .../xxx-plugin/trunk
      maven eclipse
      
  • Move the .project and .classfile files to the xxx-plugin directory
  • Import the project by pointing at the plugin directory (that now contains a .project file!)
    • Right click Import
    • Choose Existing Projects into Workspace
    • Customize the build path source using right click on project -> Build Path -> Configure Build Path
      • removing the default location
      • adding /trunk/src/etc
      • adding /trunk/src/java
      • adding /trunk (last)
  • Add MAVEN_REPO classpath variable to Eclipse
    • This only needs to be done for the first plugin you setup
    • MAVEN_REPO is used in the Maven generated .classpath file that contains references to all the dependencies defined to Maven in the project.xml and related files
    • Customize the build path libraries using right click on project -> Build Path -> Configure Build Path
    • Add a new variable that points to your maven repository directory

Summary

  • Eclipse should now analyse the plugin code and report errors
  • Once all errors are fixed in Eclipse, a maven build (run outside Eclipse) should be clean
  • No labels