Maven 2.x Eclipse Plugin

Automatic reference of dependee projects

Details

  • Patch Submitted:
    Yes
  • Number of attachments :
    1

Description

It would very useful to have the ability to automatically reference dependee project for which the project source code is locally found.

Let's assume that module y depends on module x. The project description of module y will contain directly or indirectly - i.e. transitively - a dependency to module x.

The execution of the goal "eclipse:eclipse" on the module y would normally generate an eclipse project with a jar dependency to module x.

Often it is convenient to directly reference the module x as eclipse project to allow concurrent modification and compilation of both module x and y.

The attached patch allows to automatically reference projects if the dependee project's source code is found in same directory as the dependent project. A project is a candidate match if the group-id and artifact-id properties of the two project equal and the two version equal or the dependee's version is the requested version but SNAPSHOT tagged.

Example of directory structure:

/usr/src/product/com.company.product.x/pom.xml
/usr/src/product/com.company.product.y/pom.xml

The feature can be enabled via the maven's boolean property

eclipse.referenceDependeeProjects

The property default value is false and therefore the feature is disabled per default.

The following is an example of execution with the feature enabled:

  1. mvn eclipse:eclipse -Declipse.referenceDependeeProjects=true

Currently it is assumed that the dependee project sources are within a directory named after the project's artifact-id.

Future extensions could consider the more general maven's version matching strategy - is this coded anywhere specific in maven's source code? - and possibly allowing for locating the dependee source in directories with generic names or paths.

Issue Links

Activity

Hide
Andrea Aime added a comment -

I would be very interested in a behaviour that's quite similar to this.
I have two open source projects, GeoTools and GeoServer, both using maven, and GeoServer depending on GeoTools.

Now, what I would like very much would be the ability to load both project modules into Eclipse so that GeoServer project refer directly GeoTools modules, instead of depending on the jars.
GeoTools is a complex library made up of 90+ modules, organised in a tree hierarchy, so I guess to make this possible mvn eclipse:eclipse would have to actually scan the
GeoTools poms.

Show
Andrea Aime added a comment - I would be very interested in a behaviour that's quite similar to this. I have two open source projects, GeoTools and GeoServer, both using maven, and GeoServer depending on GeoTools. Now, what I would like very much would be the ability to load both project modules into Eclipse so that GeoServer project refer directly GeoTools modules, instead of depending on the jars. GeoTools is a complex library made up of 90+ modules, organised in a tree hierarchy, so I guess to make this possible mvn eclipse:eclipse would have to actually scan the GeoTools poms.
Hide
Andrea Aime added a comment -

Oh, an easier way would be to just be able to specify groups whose artifact references should be generated as project names, assuming something or someone already loaded those projects in the workspace. Something like:
<forceProjectReferences>
<groupId>org.geotools</groupId>
</forceProjectReferences>

or like:

<forceProjectReferences>
<forceGroup>
<groupId>org.geotools</groupId>
</forceGroup>
<forceArtifact>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils-core</artifactId>
</forceArtifact>
</forceProjectReferences>

Show
Andrea Aime added a comment - Oh, an easier way would be to just be able to specify groups whose artifact references should be generated as project names, assuming something or someone already loaded those projects in the workspace. Something like: <forceProjectReferences> <groupId>org.geotools</groupId> </forceProjectReferences> or like: <forceProjectReferences> <forceGroup> <groupId>org.geotools</groupId> </forceGroup> <forceArtifact> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils-core</artifactId> </forceArtifact> </forceProjectReferences>
Hide
Alex added a comment -

This feature is also useful when debugging 3rd-party libraries. I would not limit the capability to "project reference" to projects within the same group.

Show
Alex added a comment - This feature is also useful when debugging 3rd-party libraries. I would not limit the capability to "project reference" to projects within the same group.
Hide
Richard van Nieuwenhoven added a comment -

MECLIPSE-344 automatically connects workspace projects / artefacts as project references.

Show
Richard van Nieuwenhoven added a comment - MECLIPSE-344 automatically connects workspace projects / artefacts as project references.
Hide
Arnaud Heritier added a comment -

This issue is considered as fixed with MECLIPSE-344.
To try the latest SNAPSHOT (2.5-20080131.135640-18) of the incoming version you have to define and activate this profile :

<profile>
      <id>apache.snapshots</id>
      <repositories>
        <repository>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots/>
          <id>apache.snapshots</id>
          <name>Maven Snapshots</name>
          <url>http://people.apache.org/maven-snapshot-repository</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots/>
          <id>apache.plugin.snapshots</id>
          <name>Maven Plugin Snapshots</name>
          <url>http://people.apache.org/maven-snapshot-repository</url>
        </pluginRepository>
      </pluginRepositories>
    </profile>

Then you have to call this command :

mvn org.apache.maven.plugins:maven-eclipse-plugin:2.5-SNAPSHOT:eclipse

If you think that your problem isn't resolved, please give us your feedback and we'll reopen the issue.

Show
Arnaud Heritier added a comment - This issue is considered as fixed with MECLIPSE-344. To try the latest SNAPSHOT (2.5-20080131.135640-18) of the incoming version you have to define and activate this profile :
<profile>
      <id>apache.snapshots</id>
      <repositories>
        <repository>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots/>
          <id>apache.snapshots</id>
          <name>Maven Snapshots</name>
          <url>http://people.apache.org/maven-snapshot-repository</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots/>
          <id>apache.plugin.snapshots</id>
          <name>Maven Plugin Snapshots</name>
          <url>http://people.apache.org/maven-snapshot-repository</url>
        </pluginRepository>
      </pluginRepositories>
    </profile>
Then you have to call this command :
mvn org.apache.maven.plugins:maven-eclipse-plugin:2.5-SNAPSHOT:eclipse
If you think that your problem isn't resolved, please give us your feedback and we'll reopen the issue.

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
1d
Original Estimate - 1 day
Remaining:
1d
Remaining Estimate - 1 day
Logged:
Not Specified
Time Spent - Not Specified