0

I'm trying to generate eclipse-project files using Maven2 eclipse-plugin for RAD7.5. All is going well except for the dependencies in the EAR's .project file.

When I run mvn eclipse:eclipse on a clean maven project, I come up with an EAR such as this:

<projectDescription>
  <name>MyEAR</name>
  <comment>The .project file of MyEAR</comment>
  <projects/>
  <buildSpec>
    <buildCommand>
      <name>org.eclipse.wst.common.project.facet.core.builder</name>
    </buildCommand>
    <buildCommand>
      <name>org.eclipse.wst.validation.validationbuilder</name>
    </buildCommand>
    <buildCommand>
      <name>org.eclipse.jdt.core.javabuilder</name>
    </buildCommand>
    <buildCommand>
      <name>com.ibm.etools.validation.validationbuilder</name>
    </buildCommand>
    <buildCommand>
      <name>com.ibm.sse.model.structuredbuilder</name>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
    <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
    <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
    <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
  </natures>
</projectDescription>

BUT I want to be coming out with something like this:

<projectDescription>
  <name>MyEAR</name>
  <comment>The .project file of MyEAR</comment>
    <projects>
        <project>MyProjectConnector</project>
        <project>MYProjectEJB</project>
        <project>MyProjectDependents</project>
        <project>MyProjectLOG</project>
    </projects>
...
</projectDescription>

RAD7.5 don't understand the project structure unless the dependent projects are listed in the < projects >. But how do I do that with the eclipse-plugin? Where in the pom do I list the dependent projects, so they appear in the .project-file as < projects >?

Edit>> Here's the maven-eclipse-plugin config of my pom-file

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>false</downloadJavadocs>
                    <wtpversion>1.5</wtpversion>
                    <packaging>ear</packaging>
                </configuration>
            </plugin>
        </plugins>
        <finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName>
</build>

<

EDIT2: I must add that the projects builds ok, i.e. mvn clean install works fine, so basically the problem is with the eclipse plugin configuration.

EDIT3: The maven-project is built in the following fashion:

MyEAR-reactor-build
|-- pom.xml
|-- MyEAR
|   |-- pom.xml
|-- MYProjectEJB
|   |-- pom.xml
`-- . . .

ALL HELP GREATLY APPRECIATED!!! (thanks for reading this far :)

user594883
  • 1,329
  • 2
  • 17
  • 36

3 Answers3

1

Have you declared your modules and dependent projects as dependencies in your EAR's POM?

<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>
    <packaging>ear</packaging>
    <groupId>so.com</groupId>
    <artifactId>MyEAR</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>so.com</groupId>
            <artifactId>MYProjectEJB</artifactId>
            <scope>runtime</scope>
            <type>ejb</type>
        </dependency>
        . . .
    </dependencies>

    . . .
shelley
  • 7,206
  • 4
  • 36
  • 63
  • Yes, the dependencies are there. I must add that the projects builds ok, i.e. mvn clean install works fine, so basically the problem is with the eclipse plugin configuration. – user594883 Sep 26 '11 at 06:13
1

You may need to create a module reactor build -

MyEAR-reactor-build
|-- pom.xml
|-- MyEAR
|   |-- pom.xml
|-- MYProjectEJB
|   |-- pom.xml
`-- . . .

The reactor build POM would look something like this -

<?xml version="1.0" encoding="UTF-8"?>
<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>so.com</groupId>
    <version>1.0-SNAPSHOT</version>
    <artifactId>MyEAR-reactor-build</artifactId>
    <packaging>pom</packaging>
    . . .
    <modules>
        <module>MyEAR</module>
        <module>MYProjectEJB</module>
        . . .
    </modules>
</project>
shelley
  • 7,206
  • 4
  • 36
  • 63
  • I guess I need to clarify my project structure better as I do have a reactor build or "parent-POM of the application" as I like to call it. The maven-project is pretty much built exactly like you describe above. I think the problem is with Eclipse-plugins settings, but I find them pretty shallowly documented, so it's up to trial and error to find the right parameters... – user594883 Sep 28 '11 at 06:33
  • Your eclipse plugin configuration looks fine to me. I copied it exactly as-is and included it in one of my Java EE EAR projects and the EAR's `.project` was generated as expected with the module dependencies listed as projects. – shelley Sep 28 '11 at 13:59
  • What in a bloody hell is wrong with my build then...I'll try deleting the local repo. Perhaps downloading all the necessary stuff again will help. Thanks for your trouble Shelley. – user594883 Oct 06 '11 at 05:39
0

Ahh...thanks everybody for the help. The problem turned out to be that higher in the pom hierarchy, another developer had introduced the eclipse-plugin with the element:

<useProjectReferences>false</useProjectReferences>

For some reason having set this to true in my pom didn't override the parent setting. A bug at the eclipse-plugin, perhaps? Anyway, after setting this to true at the parent pom, all worked out. Thanks everybody for help!

user594883
  • 1,329
  • 2
  • 17
  • 36