Maven 2.x Eclipse Plugin

Add the ability to selectively treat a referenced project as a local repository file

Details

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

Description

The issue is that I have a large project with many interdependent submodules. One of the submodules uses XML Beans to generate a set of objects from an XML Schema. This works perfectly, but Eclipse has a problem with the class names used in XMLBeans, and I have to close that particular project for Eclipse not to complain. But, if I close that project, all of the projects that depend on it directly (through a referenced project), then complain that they are missing a referenced project.

The solution is to relate the project via the local repository (M2_REPO/...) not via a project reference, but in EclipseClasspathWriter, all projects available via the reactor are treated as referenced projects:

if ( dep.isReferencedProject() && !config.isPde() )

{ path = "/" + dep.getArtifactId(); //$NON-NLS-1$ kind = ATTR_SRC; }

One solution would be to not use project references, but the problem only happens with specific projects, and I want to be able to selectively mark dependencies as not being referenced.

Something as simple as, this:

<config>
<localReference>
<groupId>blah</groupId>
<artifactId>blah</artifactId>
</localReference>
</config>

Where the dependency identified by that groupId and artifactId would be treated not as a direct project reference but as a link to the local repository.

Does that make any sense?

Issue Links

Activity

Hide
Kenney Westerhof added a comment -

Yup, makes perfect sense.

But this is such a rare case (you should really try to fix that classname problem), that you should use the following solution:

mvn eclipse:eclipse -r -Dmaven.reactor.excludes=buggy/project/pom.xml

Show
Kenney Westerhof added a comment - Yup, makes perfect sense. But this is such a rare case (you should really try to fix that classname problem), that you should use the following solution: mvn eclipse:eclipse -r -Dmaven.reactor.excludes=buggy/project/pom.xml
Hide
Tim O'Brien added a comment -

Kenney would hate to see skip this configuration for the Maven 2.x eclipse plugin, but it wouldn't be too difficult to implement a setting to exclude a project reference from the .classpath file. If we allow a universal configuration to skip project references, why not just allow the possibility that someone would want to selectively exclude a project reference. If this isn't a feature you have a particular itch for, mark it as deferred, but saying, "Won't Fix" just because you'd rather not see it implemented is not a reason to close a bug.

The bug is with Eclipse, Eclipse doesn't properly compile source generated by XMLBeans. And, we need a setting to work around the bug in Eclipse.

Show
Tim O'Brien added a comment - Kenney would hate to see skip this configuration for the Maven 2.x eclipse plugin, but it wouldn't be too difficult to implement a setting to exclude a project reference from the .classpath file. If we allow a universal configuration to skip project references, why not just allow the possibility that someone would want to selectively exclude a project reference. If this isn't a feature you have a particular itch for, mark it as deferred, but saying, "Won't Fix" just because you'd rather not see it implemented is not a reason to close a bug. The bug is with Eclipse, Eclipse doesn't properly compile source generated by XMLBeans. And, we need a setting to work around the bug in Eclipse.
Hide
Kenney Westerhof added a comment -

Okay, but there is no generic way to express this. This really only concerns the reactor, or scope of projects
that the eclipse plugin operates on. Excluding the project on the commandline is IMHO cleaner than creating yet another
config option in the eclipse plugin to exclude certain projects.

I see your point on me closing it, but

  • this is not a bug, at least not in maven, and
  • there's at least 2 ways to solve this problem already,
    • the first being the reactor parameters
    • the second being profiles (put the problematic modules in a profile, that's enabled by default; when running mvn eclipse:eclipse specify a property that disables that profile, effectively excluding problematic modules).

Maybe I was too harsh when closing this, but there are just too many ways to do things already, and providing specific workarounds for all sorts of bugs in 3rd party tools in maven will only make the plugin configuration (and the plugin itself) more complex. The POM would blow up in size because of all the 'exclude this because that has such and such a bug, and oh, that environment, which may not be used at all, has this bug so we have to modify this and that to do such and such'. At least, that's what I'm afraid of. I use eclipse, but people that use another flavor IDE probably don't want to see POMs cluttered with this kind of info..

So, I've made my point, and leave this issue open for anyone who wants to fix it.

Show
Kenney Westerhof added a comment - Okay, but there is no generic way to express this. This really only concerns the reactor, or scope of projects that the eclipse plugin operates on. Excluding the project on the commandline is IMHO cleaner than creating yet another config option in the eclipse plugin to exclude certain projects. I see your point on me closing it, but
  • this is not a bug, at least not in maven, and
  • there's at least 2 ways to solve this problem already,
    • the first being the reactor parameters
    • the second being profiles (put the problematic modules in a profile, that's enabled by default; when running mvn eclipse:eclipse specify a property that disables that profile, effectively excluding problematic modules).
Maybe I was too harsh when closing this, but there are just too many ways to do things already, and providing specific workarounds for all sorts of bugs in 3rd party tools in maven will only make the plugin configuration (and the plugin itself) more complex. The POM would blow up in size because of all the 'exclude this because that has such and such a bug, and oh, that environment, which may not be used at all, has this bug so we have to modify this and that to do such and such'. At least, that's what I'm afraid of. I use eclipse, but people that use another flavor IDE probably don't want to see POMs cluttered with this kind of info.. So, I've made my point, and leave this issue open for anyone who wants to fix it.
Hide
Barrie Treloar added a comment -

I have the same problem with XML beans.

Kenney, would you be able to explain how the second option of using profiles works?

I think I'd like to see these options documented in the FAQ or something so that people who bump into this problem can easily find a solution.

Show
Barrie Treloar added a comment - I have the same problem with XML beans. Kenney, would you be able to explain how the second option of using profiles works? I think I'd like to see these options documented in the FAQ or something so that people who bump into this problem can easily find a solution.
Hide
Richard van Nieuwenhoven added a comment -

see: http://maven.apache.org/guides/introduction/introduction-to-profiles.html for a good explanation how to make and activate profiles.

the module with with XML beans moves to the modules section in your profile, but i must note that i do not like the notion that the ide control's my pom structure....

As soon as MECLIPSE-344 in integrated, it is possible to add an option that only projects already available in the workspace are directly referenced, that would solve the problem.

Show
Richard van Nieuwenhoven added a comment - see: http://maven.apache.org/guides/introduction/introduction-to-profiles.html for a good explanation how to make and activate profiles. the module with with XML beans moves to the modules section in your profile, but i must note that i do not like the notion that the ide control's my pom structure.... As soon as MECLIPSE-344 in integrated, it is possible to add an option that only projects already available in the workspace are directly referenced, that would solve the problem.
Hide
Richard van Nieuwenhoven added a comment -

changed the patch for MECLIPSE-344 a little, now you can exclude projects that are not as project in the workspace.

Show
Richard van Nieuwenhoven added a comment - changed the patch for MECLIPSE-344 a little, now you can exclude projects that are not as project in the workspace.
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 (2)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: