Hi,
how does the m2 eclipse plugin determine the path where it looks for web
app libraries when used for dynamic web projects?
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)".
Usually the web app libraries are used to add jars to a deployment which
are automatically used for building, as well. The web app libraries are
manipulated by copying jars to WEB-INF/lib.
The my-webapp/WEB-INF/classes source entry seems to make no sense here,
I would expect src/main/webapp/WEB-INF/lib.
Can anyone explain how m2 would insert jars into the web project so that
they end up in the .deployables folder in such a way that they can be
used for debugging right away?
I would expect the eclipse plugin to add jars meant for deployment to
WEB-INF/lib, and to create the appropriate classpath entry. In a war the
jars should certainly be in ./lib, not in ./classes.
I run m2 eclipse:eclipse with the following pom.xml
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-webapp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven Webapp Archetype</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>my-webapp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<buildcommands>
<java.lang.String>org.eclipse.wst.common.modulecore.ComponentStructuralBuilder</java.lang.String>
<java.lang.String>org.eclipse.jdt.core.javabuilder</java.lang.String>
<java.lang.String>org.eclipse.wst.validation.validationbuilder</java.lang.String>
<java.lang.String>org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver</java.lang.String>
<java.lang.String>org.eclipse.wst.common.modulecore.DependencyGraphBuilder</java.lang.String>
</buildcommands>
<classpathContainers>
<java.lang.String>org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache
Tomcat v5.0</java.lang.String>
<java.lang.String>org.eclipse.jst.j2ee.internal.web.container/artifact</java.lang.String>
</classpathContainers>
<projectnatures>
<java.lang.String>org.eclipse.jem.workbench.JavaEMFNature</java.lang.String>
<java.lang.String>org.eclipse.jdt.core.javanature</java.lang.String>
<java.lang.String>org.eclipse.wst.common.modulecore.ModuleCoreNature</java.lang.String>
</projectnatures>
</configuration>
</plugin>
</plugins>
</build>
</project>
What I get is:
<classpath>
<classpathentry output=".deployables/my-webapp/WEB-INF/classes"
kind="src" path="src/main/java"/>
<classpathentry output=".deployables/my-webapp/WEB-INF/classes"
kind="src" path="src/main/resources"/>
<classpathentry sourcepath="JRE_SRC" kind="var" rootpath="JRE_SRCROOT"
path="JRE_LIB"/>
<classpathentry kind="var"
path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
<classpathentry kind="con"
path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache
Tomcat v5.0"/>
<classpathentry kind="con"
path="org.eclipse.jst.j2ee.internal.web.container/artifact"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
and the .wtpmodules
<project-modules id="moduleCoreId">
<wb-module deploy-name="my-webapp">
<module-type module-type-id="jst.web">
<version>2.4</version>
<property name="context-root" value="my-webapp"/>
</module-type>
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
<wb-resource deploy-path="/WEB-INF/classes"
source-path="src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes"
source-path="src/main/resources"/>
</wb-module>
</project-modules>
Regards,
Dietrich
|