vuzbuz wrote:
I have project A as a web project (meaning its a Maven Project created as
maven-archetype-webapp). It consists of classes and resources (jsps for
example). I package it as a WAR using m2eclipse run configuration named
mvn:package. I get a WAR and deploy it into my maven repository.

Afterwards I have a project B, also a web project.
I create a dependency on project A (dependency's type is war).
Have you verified if your project B can be build with Maven? To make sure use "mvn clean package" command from the command line or launch it using Maven launch configuration in Eclipse using "clean package" goals. As far as I know, dependency of type war can't be in the project's classpath and if projects can't be build with Maven we can't guarantee that it would work in the ide.
There's this problem of having project A in the same workspace while project
B is dependent on it, so I close project A.
Can you please elaborate on what problem you have? I did a quick test with two war projects and can't reproduce issue. Oddly enough m2eclipse configured projects A and B in a way that project B actually see classes from project A. You may need to verify that you have both WTP and Maven support for WTP installed.
Now, here are the problems:
1. Even though the dependency's scope is compile, I don't have access to the
classes of project A. That pisses me off - I assumed that must be the whole
thing about being dependent on a war in compile time. To work it around, I
can create a jar file of project A and put it in the maven repository, and
then create another dependency in project B on the jar of project A. That
would suck, though...
This is just how Maven works. Dependencies of type war are not participating into the project's classpath. Also you can't put .war file in project classpath in Eclipse. See project classpath configuration in JDT.
2. When I deploy project B to my tomcat using eclipse, I don't get anything
from within project A (not its classes nor its jsps). However, when I use
mvn:package to create a WAR of project B, I do get everything from within
project B. That means I can take that WAR and deploy it manually to the
tomcat, but that would suck too.
3. While developing, I want project B to depend on project A not via maven,
but simply as an eclipse project dependency. For this to work when I deploy
to tomcat, I also have to declare project A as 'Java EE Module Dependency'
in eclipse. That's not possible since project A is considered a Dynamic Web
Module, and eclipse doesn't allow 2 Dynamic Web Modules to be dependent on
each other.
You should not edit project configuration manually for projects with Maven dependency management enabled. To update project configuration use "Maven / Update project configuration" from popup menu on your projects. This way, m2ecllipse will configure WTP projects and interdependencies to match Maven configuration in project's poms.
Does anyone have solution?
The ideal situation would be declaring the maven dependency in project B,
and right away get the classes of project A to my classpath so that I can
access them, while also having the whole project A packaged with project B
when I use eclipse's simple deploy to tomcat.
If you need classes shared between two different wars, those classes should be in a separate common module with jar packaging. That would be configuration that works in Maven and it also been verified with m2eclipse. If you like, I can dig out a test project that demonstrate such project structure.
Some details:
I work with Eclipse 3.4, m2eclipse 0.9.6 (+Maven Integration for WTP) and
tomcat 5.5.
I hope the information suffices.
Generally, for complex multi-project issues it is a good idea to open a bug report in jira at http://jira.codehaus.org/browse/MNGECLIPSE and attach sample test project in there. Then you could follow up here in the mailing list and link back to the issue if you want to discuss it and look for workarounds.

 Hope that helps.

 regards,
 Eugene



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to