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 <[email protected]> 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.
>
> Best regards,
> Markus
>
> Am 10.05.2012 09:17, schrieb Fred Bricon:
>
> m2e doesn't support workspace projects generating more than one artifact
> (see  http://dev.eclipse.org/mhonarc/lists/m2e-users/msg02514.html )
>
>  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 <[email protected]> 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
>>>
>>> These are my pom.xml files:
>>>
>>> POM.XML OF CUSTOMER-PROJECT
>>>
>>> <project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
>>> http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="
>>> http://maven.apache.org/POM/4.0.0
>>> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
>>> <modelVersion>4.0.0</modelVersion>
>>> <parent>
>>> <artifactId>pom</artifactId>
>>> <groupId>com.gfii.maven</groupId>
>>> <version>LATEST</version>
>>> </parent>
>>> <groupId>com.gfii.productioncontrol.customer</groupId>
>>> <artifactId>customer</artifactId>
>>> <version>1.0-SNAPSHOT</version>
>>> <packaging>war</packaging>
>>> <name>productioncontrol_customer</name>
>>> <dependencies>
>>> <dependency>
>>> <groupId>com.gfii.productioncontrol</groupId>
>>> <artifactId>server</artifactId>
>>> <classifier>classes</classifier>
>>> <version>1.0-SNAPSHOT</version>
>>> <scope>provided</scope>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.gfii.productioncontrol</groupId>
>>> <artifactId>server</artifactId>
>>> <version>1.0-SNAPSHOT</version>
>>> <type>war</type>
>>> <scope>runtime</scope>
>>> </dependency>
>>> </dependencies>
>>> <build>
>>> <finalName>productioncontrol-customer-${version}</finalName>
>>> <sourceDirectory>src</sourceDirectory>
>>> <testSourceDirectory>test</testSourceDirectory>
>>> </build>
>>> </project>
>>>
>>>
>>> POM.XML OF PRODUCTIONCONTROL_SERVER
>>>
>>> <project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
>>> http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="
>>> http://maven.apache.org/POM/4.0.0
>>> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
>>> <modelVersion>4.0.0</modelVersion>
>>> <groupId>com.gfii.productioncontrol</groupId>
>>> <artifactId>server</artifactId>
>>> <version>1.0-SNAPSHOT</version>
>>> <packaging>war</packaging>
>>> <parent>
>>> <groupId>com.gfii.maven</groupId>
>>> <artifactId>pom</artifactId>
>>> <version>LATEST</version>
>>> </parent>
>>> <scm>
>>> <connection>scm:git:ssh://git@git/productioncontrol/server</connection>
>>> <url>http://git/?p=productioncontrol/server.git</url>
>>> </scm>
>>> <dependencies>
>>> <dependency>
>>> <groupId>junit</groupId>
>>> <artifactId>junit</artifactId>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.gfii.common</groupId>
>>> <artifactId>common</artifactId>
>>> <version>1.0-SNAPSHOT</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.gfii.common</groupId>
>>> <artifactId>database</artifactId>
>>> <version>1.0-SNAPSHOT</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.gfii.common</groupId>
>>> <artifactId>geometry</artifactId>
>>> <version>1.0-SNAPSHOT</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.gfii.common</groupId>
>>> <artifactId>jsf</artifactId>
>>> <version>1.0-SNAPSHOT</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.gfii.common</groupId>
>>> <artifactId>nesting</artifactId>
>>> <version>1.0-SNAPSHOT</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.gfii.common</groupId>
>>> <artifactId>reporting</artifactId>
>>> <version>1.0-SNAPSHOT</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.gfii.customer.wenzel.webshop</groupId>
>>> <artifactId>backend_xml</artifactId>
>>> <version>1.0-SNAPSHOT</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.apache.xmlrpc</groupId>
>>> <artifactId>xmlrpc-server</artifactId>
>>> <version>3.1.3</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.jdom</groupId>
>>> <artifactId>jdom</artifactId>
>>> <version>1.1.2</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.sun.mail</groupId>
>>> <artifactId>javax.mail</artifactId>
>>> <version>1.4.4</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.lowagie</groupId>
>>> <artifactId>itext</artifactId>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.thoughtworks.xstream</groupId>
>>> <artifactId>xstream</artifactId>
>>> <version>1.3.1</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>commons-lang</groupId>
>>> <artifactId>commons-lang</artifactId>
>>> <version>2.5</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>xml-apis</groupId>
>>> <artifactId>xml-apis</artifactId>
>>> <version>1.3.04</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>backport-util-concurrent</groupId>
>>> <artifactId>backport-util-concurrent</artifactId>
>>> <version>2.2</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.apache.xmlrpc</groupId>
>>> <artifactId>xmlrpc-common</artifactId>
>>> <version>3.1.3</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>commons-net</groupId>
>>> <artifactId>commons-net</artifactId>
>>> <version>2.0</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>net.sf.jasperreports</groupId>
>>> <artifactId>jasperreports</artifactId>
>>> <version>4.1.1</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.apache.xmlrpc</groupId>
>>> <artifactId>xmlrpc-client</artifactId>
>>> <version>3.1.3</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.im4java</groupId>
>>> <artifactId>im4java</artifactId>
>>> <version>1.2.0</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.prowidesoftware</groupId>
>>> <artifactId>wife</artifactId>
>>> <version>6.0-RC1</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.freemarker</groupId>
>>> <artifactId>freemarker</artifactId>
>>> <version>2.3.19</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>net.sourceforge.supercsv</groupId>
>>> <artifactId>supercsv</artifactId>
>>> <version>1.52</version>
>>> </dependency>
>>> </dependencies>
>>> <build>
>>> <finalName>productioncontrol-${version}</finalName>
>>> <plugins>
>>> <plugin>
>>> <groupId>org.apache.maven.plugins</groupId>
>>> <artifactId>maven-war-plugin</artifactId>
>>> <configuration>
>>> <warSourceDirectory>WebContent</warSourceDirectory>
>>> <attachClasses>true</attachClasses>
>>> <archiveClasses>true</archiveClasses>
>>> </configuration>
>>> </plugin>
>>> </plugins>
>>> <sourceDirectory>src</sourceDirectory>
>>> <testSourceDirectory>test</testSourceDirectory>
>>> <resources>
>>> <resource>
>>> <directory>src</directory>
>>> </resource>
>>> <resource>
>>> <directory>test</directory>
>>> </resource>
>>> </resources>
>>> </build>
>>> </project>
>>>
>>>
>>> POM.XML OF COMMON_COMMON
>>>
>>> <project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
>>> http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="
>>> http://maven.apache.org/POM/4.0.0
>>> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
>>> <modelVersion>4.0.0</modelVersion>
>>> <groupId>com.gfii.common</groupId>
>>> <artifactId>common</artifactId>
>>> <version>1.0-SNAPSHOT</version>
>>> <parent>
>>> <groupId>com.gfii.maven</groupId>
>>> <artifactId>pom</artifactId>
>>> <version>LATEST</version>
>>> </parent>
>>> <scm>
>>> <connection>scm:git:ssh://git@git/common/common</connection>
>>> <url>http://git/?p=common/common.git</url>
>>> </scm>
>>> <dependencies>
>>> <dependency>
>>> <groupId>junit</groupId>
>>> <artifactId>junit</artifactId>
>>> </dependency>
>>>
>>> <dependency>
>>> <groupId>xml-apis</groupId>
>>> <artifactId>xml-apis</artifactId>
>>> <version>1.3.04</version>
>>> </dependency>
>>>
>>> <dependency>
>>> <groupId>commons-net</groupId>
>>> <artifactId>commons-net</artifactId>
>>> <version>2.0</version>
>>> </dependency>
>>>
>>> <dependency>
>>> <groupId>commons-lang</groupId>
>>> <artifactId>commons-lang</artifactId>
>>> <version>2.5</version>
>>> </dependency>
>>>
>>> <dependency>
>>> <groupId>com.thoughtworks.xstream</groupId>
>>> <artifactId>xstream</artifactId>
>>> <version>1.3.1</version>
>>> </dependency>
>>>
>>> <dependency>
>>> <groupId>org.im4java</groupId>
>>> <artifactId>im4java</artifactId>
>>> <version>1.2.0</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.owasp.antisamy</groupId>
>>> <artifactId>antisamy</artifactId>
>>> <version>1.4.4</version>
>>> </dependency>
>>>
>>> <dependency>
>>> <groupId>com.drewnoakes</groupId>
>>> <artifactId>metadata-extractor</artifactId>
>>> <version>2.5.0-RC3</version>
>>> </dependency>
>>>
>>> </dependencies>
>>> <build>
>>> <sourceDirectory>src</sourceDirectory>
>>> <testSourceDirectory>src/com/gfii/common/test</testSourceDirectory>
>>> <testResources>
>>> <testResource>
>>> <directory>test</directory>
>>> </testResource>
>>> </testResources>
>>> </build>
>>> </project>
>>>
>>>
>>> Any help is greatly appreciated.
>>>
>>> Best regards,
>>> Markus
>>>
>>> _______________________________________________
>>> m2e-users mailing list
>>> [email protected]
>>> https://dev.eclipse.org/mailman/listinfo/m2e-users
>>>
>>
>> _______________________________________________
>> m2e-users mailing list
>> [email protected]
>> https://dev.eclipse.org/mailman/listinfo/m2e-users
>>
>
>
>
>  --
> "Have you tried turning it off and on again" - The IT Crowd
>
>
> _______________________________________________
> m2e-users mailing 
> [email protected]https://dev.eclipse.org/mailman/listinfo/m2e-users
>
>
>
> _______________________________________________
> m2e-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/m2e-users
>
>


-- 
"Have you tried turning it off and on again" - The IT Crowd
_______________________________________________
m2e-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/m2e-users

Reply via email to