Issue Details (XML | Word | Printable)

Key: MNGECLIPSE-107
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Igor Fedorenko
Reporter: Dimitry Voytenko
Votes: 16
Watchers: 21
Operations

If you were logged in you would be able to see more operations.
Maven Integration for Eclipse

Dependency Resolver and Eclipse Web Tools Platform (WTP)

Created: 26/Apr/06 10:05 PM   Updated: 02/May/08 10:19 PM
Component/s: WTP integration
Affects Version/s: None
Fix Version/s: 0.9.4

Time Tracking:
Not Specified

File Attachments: 1. Text File m2eclipse-patch.txt (3 kB)
2. Text File org.maven.ide.eclipse.patch (2 kB)
3. Zip Archive wtp-samples.zip (9 kB)

Environment: Eclipse WTP
Issue Links:
Related
 


 Description  « Hide
All tests have been done using the solution provided in the http://jira.codehaus.org/browse/MNGECLIPSE-59. This solution works very well, but there're specifics when using it with WebTools.

Attached are sample projects that demonstrate the issue (tested under Eclipse 3.1.2). Unpack wtp-samples.zip and import projects in the workspace. Patch from MNGECLIPSE-59 should be applied. Rebuild both projects. Build of "web-main" should fail with an error:
"Build path contains duplicate entry: 'web-component' for project web-main"

The problem occures b/c of conflict b/w Java classpath (in the Java Build Path > Projects) and Maven2 classpath container. They both contain "web-component" project. If go to Properties > Java Build Path > Projects and remove "web-component" project manually everything will compile fine, but WTP will not include "web-component" in the runtime classpath when running the "web-main" project in the servlet container (e.g. Tomcat). To fix that, you have to include "web-component" in the J2EE Module Dependencies for "web-main" (see Properties > J2EE Module Dependencies). When you try to save J2EE Module Dependencies changes, you get the same "duplicate classpath entry" error.

J2EE Module Dependencies use regular Java classpath for a project and thus Maven's container should work just fine (theoretically). The problem occures exactly when WTP tries to save J2EE Module Dependencies and synchronize them with Java classpath. It most probably tries to add a project marked in the "module dependencies" to the list of dependent java projects and fails.

One solution here could be to source "J2EE Module Dependencies" from the Maven's configuration for a project. J2EE Module Dependencies are stored within the project in the ".settings/.component" and looks something like the following:
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/resource/web-component/web-component">
<dependency-type>uses</dependency-type>
</dependent-module>

This information is present in the POM with dependency scope other than "provided" and "system".

If it's not possible to extend WTP to read module dependencies from Maven's POM this issue can be redirected to WTP itself, as there's nothing illegal with the way Maven2 extends classpath (as specified in MNGECLIPSE-59). It's only the synchronization procedure of WTP configuration that fails in this case.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Dimitry Voytenko added a comment - 28/Apr/06 12:21 PM
I also made a note on the WTP's https://bugs.eclipse.org/bugs/show_bug.cgi?id=139241, as I believe this is their problem rather than Maven's. Please note though, this note is only related to the "duplicate entry" issue. Sourcing of the ".component" content from the Maven's POM is not a part of it.

Robert Elliot added a comment - 30/Aug/06 04:32 PM
This patch causes M2Eclipse to add a classpath attribute org.eclipse.jst.j2ee.deployableArtifact=true to all items it adds to a project's classpath that ought to be packaged up with it if the project should be packaged as a war or ear.

At present this will do nothing useful, but it is possible that future releases of the WTP will recognise this attribute and act accordingly when deploying to a server. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=154251


Mike McMahon added a comment - 18/May/07 08:49 PM
My patch is very similar to Robert's but I made the following changes:
  • patch is against current codebase
  • instead of M2Eclipse making the decisions about deployment, now M2Eclipse simply adds an attribute called org.maven.ide.eclipse.scope which has the maven scope
  • tools like WTP and MyEclipse deployer can then decide which scopes to deploy for any given context

Igor Fedorenko added a comment - 02/May/08 10:19 PM
fixed. pom dependencies resolved into workspace projects are now added to WTP "J2EE Module Dependencies" and not to "Maven Dependencies"