Maven 2.x Eclipse Plugin

Allow for forcing the creation of direct project references for dependencies

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 2.0
  • Fix Version/s: 2.5
  • Component/s: Core : Multi-projects
  • Labels:
    None
  • Number of attachments :
    0

Description

For some thirdparty dependencies, it is common (for me at least) that an eclipse project for that dependency does/will exist in the workspace. It would be nice if dependencies in eclipse projects can be forced to use a direct project reference. eg:

<dependency>
<groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId>
<version>2.0_01_pd</version>
<scope>runtime</scope>
<properties>
<property name="eclipse.dependencyType" value="XXXX"/>
</properties>
</dependency>

Where XXXX can be:

  • 'project' – always create a project reference
  • 'jar' – always create a jar reference as in MNG-955
  • 'auto' – the behavior prior to MNG-955

Issue Links

Activity

Hide
Brett Porter added a comment -

this should not be done via dependency properites but instead by a configuration filter, if implemented

Show
Brett Porter added a comment - this should not be done via dependency properites but instead by a configuration filter, if implemented
Hide
Barry Kaplan added a comment -

What is a configuration filter? I don't see this in the docs. And how does using a configuration filter relate to MNG-955? Should that also have been implemented with a configuration filter?

Show
Barry Kaplan added a comment - What is a configuration filter? I don't see this in the docs. And how does using a configuration filter relate to MNG-955? Should that also have been implemented with a configuration filter?
Hide
Brett Porter added a comment -

configuration filter is for per dependencies settings, eg in the eclipse plugin, something like:

<configuration>
<references>
<reference>backport-util-concurrent:backport-util-concurrent</reference>
</references>
</configuration>

Show
Brett Porter added a comment - configuration filter is for per dependencies settings, eg in the eclipse plugin, something like: <configuration> <references> <reference>backport-util-concurrent:backport-util-concurrent</reference> </references> </configuration>
Hide
Barry Kaplan added a comment -

Sorry Brett, I'm not following what the meaning of this snippet is. Are configuration filters implemented anywhere? Are there some concrete examples I can study? tx

Show
Barry Kaplan added a comment - Sorry Brett, I'm not following what the meaning of this snippet is. Are configuration filters implemented anywhere? Are there some concrete examples I can study? tx
Hide
Brett Porter added a comment -

they are used in the assembly plugin. This is just a standard technique for managing dependencies.

Show
Brett Porter added a comment - they are used in the assembly plugin. This is just a standard technique for managing dependencies.
Hide
Barrie Treloar added a comment -

Barry, See http://maven.apache.org/ref/2.0.3-SNAPSHOT/maven-model/maven.html

Brett means that the configuration you require would be done inside the eclipse plugin pluginManagement section rather than specifying it within the dependency declaration.

Since only the eclipse plugin cares about the different types of project references it makes sense to include it there. These values could also be specified on the command line, rather than in a configuration, if the plugin is designed to support this. It's all in the Better Builds With Maven book, Section 5 Developing Custom Maven Plugins.

I've pasted the relevant section of pom.xml, it would go into the configuration tag as Brett's snippet above shows.

 
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId/>
          <artifactId/>
          <version/>
          <extensions/>
          <executions>
            <execution>
              <id/>
              <phase/>
              <goals/>
              <inherited/>
              <configuration/>
            </execution>
          </executions>
Show
Barrie Treloar added a comment - Barry, See http://maven.apache.org/ref/2.0.3-SNAPSHOT/maven-model/maven.html Brett means that the configuration you require would be done inside the eclipse plugin pluginManagement section rather than specifying it within the dependency declaration. Since only the eclipse plugin cares about the different types of project references it makes sense to include it there. These values could also be specified on the command line, rather than in a configuration, if the plugin is designed to support this. It's all in the Better Builds With Maven book, Section 5 Developing Custom Maven Plugins. I've pasted the relevant section of pom.xml, it would go into the configuration tag as Brett's snippet above shows.
 
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId/>
          <artifactId/>
          <version/>
          <extensions/>
          <executions>
            <execution>
              <id/>
              <phase/>
              <goals/>
              <inherited/>
              <configuration/>
            </execution>
          </executions>
Hide
Barry Kaplan added a comment -

Excellent! Thanks for the heads up Baerrach.

Show
Barry Kaplan added a comment - Excellent! Thanks for the heads up Baerrach.
Hide
Kenney Westerhof added a comment -

Hm. Not sure I like this solution in this case. I've got the same issue here - when importing the m2 source tree and plexus,
and I wouldn't want to update the m2 poms with eclipse plexus config

You can just use the reactor: mvn eclipse:eclipse -r -Dmaven.reactor.includes=root/pom.xml,path/to/backport-util/pom.xml

If this is sufficient we could close this issue.

Show
Kenney Westerhof added a comment - Hm. Not sure I like this solution in this case. I've got the same issue here - when importing the m2 source tree and plexus, and I wouldn't want to update the m2 poms with eclipse plexus config You can just use the reactor: mvn eclipse:eclipse -r -Dmaven.reactor.includes=root/pom.xml,path/to/backport-util/pom.xml If this is sufficient we could close this issue.
Hide
Barrie Treloar added a comment - - edited

I tried using -r to specify the includes and it is finding projects that are not defined as modules in my pom.

I tried an equivalence test:
i.e.
mvn eclipse:eclipse
should be equivalent to
mvn eclipse:eclipse -r -Dmaven.reactor.includes=pom.xml
also tried
mvn eclipse:eclipse -r '-Dmaven.reactor.includes=\full\windows\path\to\pom.xml'
(which required quoting to avoid backslash issues.

But neither of the -r options work.

I also can find no documentation on the -r option. Which makes me reluctant to use this solution here and on MECLIPSE-158

For some reason the reactor is trying to locate a much older version of the pom.

Although now I am not convinced the quoting of the arguments is correct as it probably pulling something out of the local m2 repository. Other commands (like help:effective-pom) are failing with

[INFO] Cannot execute mojo: effective-pom. It requires a project with an existing pom.xml, but the build is not using one.

Show
Barrie Treloar added a comment - - edited I tried using -r to specify the includes and it is finding projects that are not defined as modules in my pom. I tried an equivalence test: i.e. mvn eclipse:eclipse should be equivalent to mvn eclipse:eclipse -r -Dmaven.reactor.includes=pom.xml also tried mvn eclipse:eclipse -r '-Dmaven.reactor.includes=\full\windows\path\to\pom.xml' (which required quoting to avoid backslash issues. But neither of the -r options work. I also can find no documentation on the -r option. Which makes me reluctant to use this solution here and on MECLIPSE-158 For some reason the reactor is trying to locate a much older version of the pom. Although now I am not convinced the quoting of the arguments is correct as it probably pulling something out of the local m2 repository. Other commands (like help:effective-pom) are failing with [INFO] Cannot execute mojo: effective-pom. It requires a project with an existing pom.xml, but the build is not using one.
Hide
Richard van Nieuwenhoven added a comment - - edited

MECLIPSE-344 is an other solution to connect workspace projects

Show
Richard van Nieuwenhoven added a comment - - edited MECLIPSE-344 is an other solution to connect workspace projects
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 (3)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: