Hi,

here's an issue I've been fighting for the last 5 business days with
every approach taken hitting the same wall. I checked the
documentation, did the googling, asked friends and didn't get any
further. I sincerely hope to get some help here.

I have a set of Eclipse plugin projects, which are to be moved to
Maven-managed building and packaging. Initially the future looked
bright as I found a perfectly suited article at eclipse.org:

  Building Eclipse Plugins with Maven 2
  
http://www.eclipse.org/articles/article.php?file=Article-Eclipse-and-Maven2/index.html

Took a day or two to actually find out how to put the scraps of
information there together and install the custom MOJOs. Once I did
that, Eclipse project files were perfectly generated by 'mvn
eclipse:eclipse', all projects built in Eclipse but... not in Maven.
Even though Maven knew that the project depends on the org.eclipse.ui
package in the MANIFEST file (and complained if that package was not
in the repository), it still reported missing dependencies once the
packages were available to it in its repo.

Back at the drawing board, I found an existing MOJO for Maven:

  Eclipse PDE Maven Plugin
  http://mojo.codehaus.org/pde-maven-plugin/

and I also found out about the PDE option for the eclipse:eclipse goal:

  http://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html#pde

This brought me to the following situation:

/plugins/
    /eclipse-rcp-common/
        /src/
        /build.properties
        /META-INF/
        /...
        /pom.xml
    /vnc-client/
        /...
        /pom.xml
    /pom.xml

The "super pom" in the 'plugins' directory looks as follows:

<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/maven-v4_0_0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>nl.collaboratory.client</groupId>
  <artifactId>client-plugin-container</artifactId>
  <packaging>pom</packaging>
  <name>Collaboratory Client Container</name>
  <version>1.0-SNAPSHOT</version>
  <description>A Simple Plugin PDE Example</description>
  <build>
    <resources>
      <resource>
        <directory>${basedir}</directory>
        <includes>
          <include>plugin.xml</include>
          <include>plugin.properties</include>
        </includes>
        <targetPath>/</targetPath>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-eclipse-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>synchronise-eclipse</id>
            <phase>validate</phase>
            <goals>
              <goal>eclipse</goal>
            </goals>
            <inherited>true</inherited>
            <configuration>
              <pde>true</pde>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <pde>true</pde>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>pde-maven-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <buildProperties>
              <javacSource>1.6</javacSource>
              <javacTarget>1.6</javacTarget>
          </buildProperties>
          <eclipseInstall>/home/sonic/tmp/eclipse</eclipseInstall>
        </configuration>
        <executions>
          <execution>
            <id>clean-pde</id>
            <phase>clean</phase>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <dependencies>
      <dependency>
          <groupId>org.eclipse.ecf</groupId>
          <artifactId>core</artifactId>
          <version>0.8.8</version>
          <scope>compile</scope>
      </dependency>
      <dependency>
        <groupId>org.eclipse.ecf</groupId>
        <artifactId>discovery</artifactId>
        <version>0.8.8</version>
        <scope>compile</scope>
      </dependency>
      <dependency>
        <groupId>org.eclipse.ecf</groupId>
        <artifactId>presence</artifactId>
        <version>0.8.8</version>
        <scope>compile</scope>
      </dependency>
      <dependency>
        <groupId>org.eclipse.ecf</groupId>
        <artifactId>provider</artifactId>
        <version>0.8.8</version>
        <scope>compile</scope>
      </dependency>
      <dependency>
        <groupId>org.eclipse.ecf</groupId>
        <artifactId>ui</artifactId>
        <version>0.8.8</version>
        <scope>compile</scope>
      </dependency>
      <dependency>
        <groupId>nl.collaboratory</groupId>
        <artifactId>admininterface</artifactId>
        <version>1.0.0</version>
        <scope>compile</scope>
      </dependency>
  </dependencies>
  <modules>
    <module>eclipse-rcp-common</module>
    <module>vnc-client</module>
  </modules>
</project>

While the pom for the eclipse-rcp-common plugin is:

<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/maven-v4_0_0.xsd";>
  <parent>
    <artifactId>client-plugin-container</artifactId>
    <groupId>nl.collaboratory.client</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>nl.collaboratory.client</groupId>
  <artifactId>eclipse-rcp-common</artifactId>
  <packaging>zip</packaging>
  <name>Common Elements Plugin</name>
  <version>1.0-SNAPSHOT</version>
  <description>A Simple Plugin PDE Example</description>
  <dependencies>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring</artifactId>
      <version>2.0.7</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.acegisecurity</groupId>
      <artifactId>acegi-security</artifactId>
      <version>1.0.5</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <version>2.3</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>

Running "mvn eclipse:eclipse" in the eclipse-rcp-common directory
generates appropriate eclipse project files with all required
dependencies:

.classpath

...
  <classpathentry kind="lib" path="spring-context-1.2.9.jar"/>
  <classpathentry kind="lib" path="spring-remoting-1.2.9.jar"/>
  <classpathentry kind="lib" path="spring-core-1.2.9.jar"/>
...

.project

...
<link>
      <name>spring-remoting-1.2.9.jar</name>
      <type>1</type>
      
<location>/home/sonic/.m2/repository/org/springframework/spring-remoting/1.2.9/spring-remoting-1.2.9.jar</location>
    </link>
...

(/home/sonic/.m2/repository/ is the folder with the Maven repository
and all libraries are there)

The MANIFEST.MF also contains all required dependencies:

...
Bundle-ClassPath: .,
 commons-codec-1.3.jar,
 commons-collections-3.1.jar,
 commons-lang-2.3.jar,
 commons-logging-1.0.4.jar,
 log4j-1.2.9.jar,
 admininterface-1.0.0.jar,
 acegi-security-1.0.5.jar,
 core-0.8.8.jar,
...

As a result, the project builds perfectly within Eclipse. Not so with
Maven. The PDE plugin for Maven works by generating a build.xml file
and running Ant against it. The appropriate path part of the build.xml
file reads:

....
    <pathelement
path="${build.result.folder}/../eclipse-rcp-common_1.0.0.SNAPSHOT/commons-logging-1.0.4.jar"/>
    <pathelement path="log4j-1.2.9.jar"/>
    <pathelement
path="${build.result.folder}/../eclipse-rcp-common_1.0.0.SNAPSHOT/log4j-1.2.9.jar"/>
    <pathelement path="admininterface-1.0.0.jar"/>
...

Which results in the following absolute paths (excerpt from Ant verbose):

dropping 
/home/sonic/tmp/test-plugin-development/plugins/eclipse-rcp-common/acegi-security-1.0.5.jar
from path as it doesn't exist
dropping 
/home/sonic/tmp/test-plugin-development/plugins/eclipse-rcp-common/target/pdeTemp/plugins/eclipse-rcp-common_1.0.0.SNAPSHOT/acegi-security-1.0.5.jar
from path as it doesn't exist
dropping 
/home/sonic/tmp/test-plugin-development/plugins/eclipse-rcp-common/core-0.8.8.jar
from path as it doesn't exist
dropping 
/home/sonic/tmp/test-plugin-development/plugins/eclipse-rcp-common/target/pdeTemp/plugins/eclipse-rcp-common_1.0.0.SNAPSHOT/core-0.8.8.jar
from path as it doesn't exist

The path:

  /home/sonic/tmp/test-plugin-development/plugins/...

is the correct path to the 'plugins' directory I mentioned in the
beginnig. All's well until this point. The 'target' folder is there as
well, but inside it there is NO pdeTemp folder, let alone any jars in
it. It seems that the ant script expects the jars to be copied locally
into the projects folder, while they're not!

The documentation for the "pde" option of the "eclipse:eclipse" goal reads:

  Additionally it copies all libraries to a project local directory
and references them instead of referencing the files in the local
Maven repository.

NO! There are no jars being copied to a "project local directory",
they're referenced from the repository as excerpts of eclipse related
files above show. Is that an "eclipse:eclipse" bug? Does anyone have a
working setup of Maven + Eclipse PDE and could share some expertise
with me?

-- 
 Michael Paluchowski [sonic|redmagic]
   [EMAIL PROTECTED]
_________________________________ www.nethut.pl _ www.buggybrain.com _

 I do not fear computers. I fear the lack of them. / Isaac Asimov

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to