Search code examples
javaeclipsemaveneclipse-pde

Continue development of Plugin


There is an Eclipse Plugin managed by Maven containing this configuration:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>wonttellya</groupId>
        <artifactId>wonttellya</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>jar</packaging>
        <dependencies>
            ...
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.10</version>
                <configuration>
                    <pde>true</pde>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

In console I run

C:\Users\user\git\wonttellya\mvn 
         eclipse:eclipse -Declipse.workspace=C:\Users\user\workspace2
...
Using Eclipse Workspace: C:\Users\user\workspace2    
...
BUILD SUCCESS

If I open Eclipse in the workspace there is no project.


Solution

  • First of all, you have to understand that the purpose of the maven-eclipse-plugin is, quoting its documentation:

    to generate Eclipse IDE files (*.classpath, *.project, *.wtpmodules and the .settings folder) for use with a project.

    Its goal is not to create an entire project but the building Eclipse blocks from an existing project.

    This is also true for PDE support. Quoting its documentation:

    Note that the scope of the maven-eclipse-plugin is to synchronise the Eclipse .project and .classpath files with the configuration found in the pom file. Once you have finished configuring the Eclipse plugin as below, and once you have run the eclipse:eclipse goal, you will be in a position to build your plugin code with the Eclipse IDE, or the Eclipse headless PDE build. The Eclipse headless PDE build can be triggered from within Maven using the pde-maven-plugin.

    As such, the configuration you have simply enables the creation of correct .project and .classpath files for an existing project, nothing more. Once this configuration has been made and eclipse:eclipse goal was run, you will need to follow these steps:

    • Open Eclipse and import the existing project, by going to "File > Import... > Existing Projects into Workspace".
    • Right-click the new project and select "Configure > Convert to Plugins Projects...". Confirm this choice.

    You will then be able to build your Eclipse plugin directly in the IDE.

    Note that I do not recommend using this solution and I would suggest you use Tycho instead, this might be an improvement you could make to this plugin (refer to this question).