Hi Fabrizio,

thank you for your quick reply. Comments inline.

Fabrizio Giustina schrieb:
> On 10/18/05, Dietrich Schulten <[EMAIL PROTECTED]> wrote:
> 
>>how does the m2 eclipse plugin determine the path where it looks for web
>>app libraries when used for dynamic web projects?

> if you run m2 eclipse
> from a parent project and some of these dependencies are in the list
> of compiled modules they will be added as a module dependencies
> instead of jars.

I added springframework 1.2.5 as dependency.
m2 retrieves the jar and puts it to
ws\my-webapp\target\my-webapp\WEB-INF\lib
It also makes it to the m2-built war from there.

Eclipse is informed about the jar by adding
M2_REPO/springframework/spring/1.2.5/spring-1.2.5.jar
to .classpath

So this works almost as I hoped.

However, eclipse does not understand that it should add this lib from
the target folder to .deployables, from where Eclipse debugs the
application using Eclipse's tomcat integration.
Rather Eclipse seems to expect the lib in the
src\main\webapp\WEB-INF\lib folder. I manually copied it there, and
Eclipse automatically inserted spring.1.2.5.jar into the web apps
library and .deployables.

That would mean I have to manually copy everything from
target/my-webapp/WEB-INF/lib to src/main/webapp/WEB-INF/lib
Probably this is not how it is meant to be:

How can I provide external jars for a parent project, so that they
"appear in the list of compiled modules and are added as module
dependencies", as you said above? I created a parent pom.xml and used m2
eclipse:eclipse from the parent folder. I also updated the child pom.xml
files to have a parent element that points back to the parent.

My parent pom.xml:

<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/maven-v4_0_0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <version>1.0-SNAPSHOT</version>
  <artifactId>app</artifactId>
  <packaging>pom</packaging>
  <modules>
    <module>my-app</module>
    <module>my-webapp</module>
  </modules>
</project>

Also missing is the project dependency from my-webapp to my-app, Eclipse
does not get the dependency yet.


>>I have the problem that eclipse complains about a missing
>>WEB-INF/classes classes folder, which seems to come from a "Web app
>>library [artifact]" containing a my-webapp/WEB-INF/classes source path
>>with a marker saying "(missing)".

This disappeared after I selected my-webapp instead of artifact in
Eclipse. So I have to enter the artifactId in the pom.xml like so:

<java.lang.String>
org.eclipse.jst.j2ee.internal.web.container/my-webapp
</java.lang.String>

instead of

<java.lang.String>
org.eclipse.jst.j2ee.internal.web.container/artifact
</java.lang.String>

I assumed, some magic might replace the artifactId for artifact. M2
newbie question: Is it possible to refer to the artifactId, as if it
were a variable, in the pom.xml?

Thank you for all your hard work. Do you have a HOWTO already? Maybe I
could write one if I get all this to work.

Regards,
Dietrich

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to