Ok I reproduced the bug. For some reason, workspace dependencies of project overlays are not packaged by WTP. It's either a bug in m2e-wtp or upstream WTP. I created
https://issues.sonatype.org/browse/MECLIPSEWTP-245 to follow up on that issue.
So, until this is fixed, that means you need to explicitely add those common project dependencies to your customer project. You can do that in a m2e specific profile :
<profile><id>m2e</id>
<!-- this profile is only activated within eclipse/m2e -->
<activation><property><name>m2e.version</name></property></activation><dependencies>
<!-- add project dependencies from overlaid project-->
</dependencies></profile>
Regards,
Fred Bricon
On Thu, May 10, 2012 at 9:27 AM, Markus Meyer <meyer@xxxxxxx> wrote:
Fred,
thanks for your explanation. You write:
"In your case, your best chance is to move those classes to an
actual jar module."
I am not sure this is the problem. The classes created by the
productioncontrol_server .war project are found just fine (may be
that at some point I manually added a dependency to the Eclipse
project for those classes but anyway, it works). What is not found
are the classes in e.g. the project common_common. But common_common
IS a regular .jar project. To me it seems that when common_common is
closed or not in the workspace, the .jar from the server is used.
But when common_common is open, Eclipse does not use the .jar from
the server but the actual project. This compiles fine, but the
classes defined in common_common are not added to the exported .war,
neither within WEB-INF/classes, nor as a separate .jar file.
More specifically, your war project declaring <archiveClasses>true doesn't produce a jar
with
<classifier>classes</classifier> inside
the workspace. In the future, we *may* be able to generate that
extra jar at deployment time in m2e-wtp, but we're not there
yet.
In your case, your best chance is to move those classes to an
actual jar module.
Regards,
Fred Bricon
On Thu, May 10, 2012 at 9:04 AM, Markus Meyer <meyer@xxxxxxx> wrote:
Hi again,
what can I do to increase the probability that my question
below is answered? The problem I described is real and can
be reproduced always with the setup I describe below. I read
a lot on forums and tried googling for problems like this
but did not find any hints as to what I can try to fix or
work around the problem.
Best regards,
Markus
Am 07.05.2012 12:50, schrieb Markus Meyer:
Hi everyone,
I have the problem that dependent projects are not
included in the JAR deployed to Tomcat 6 when the
dependent project is open.
My project has the following structure:
customer-project depends on
productioncontrol_server depends on
common_common and
common_database and
common_geometry and
... some other projects and ...
... libraries ...
You find below the pom.xml files of the
"customer-project", the "productioncontrol_server" and
"common_common".
When I have a workspace with, say, "customer-project"
and "productioncontrol_server" open and all other
projects closed, the "customer-project" is built
successfully and can be deployed to the
Eclipse-internal Tomcat 6 without problems. The
dependent projects like "common_common",
"common_database" etc. are added to the
"productioncontrol_server" project as individual .jar
file and then deployed using the overlay.
However, when I open a dependent project like
"common_common", the project "common_common" is added
as a dependency to the "productioncontrol_server"
project in Eclipse settings (which is good) and the
"common-....jar" file disappears from the .war file
deployed to the eclipse-internal Tomcat 6 server
(which is bad). I can check this when using
Export->Jar File in Eclipse that the file
"common-...jar" is not there anymore in the .war as
soon as I open the project.
My environment:
Eclipse Indigo Release Build ID 20110615-0604
Eclipse EGit
m2e 1.0.100.20110804-1717
Maven Integration for WTP 0.14.0.20110928-2045