开发者

Use snapshot library when developing a web app in eclipse

I develop a web application using eclipse, maven and tomcat container. My web app uses snapshot version of a Java library that I also work on. In eclipse 开发者_StackOverflow中文版both projects (web app and the library) are open. The library is a regular Maven/Java project, and the web app is a Dynamic Web Application.

The problem is that eclipse under Maven Dependencies displays the library project as open, and not the jar files, so when I want to debug the web app the jar of that library is not copied into the WEB-INF/lib folder of tomcat. If I use a release version of the library, eclipse displays the jar file and is copied into the WEB-INF/lib folder of tomcat.

To solve that problem I have to close the library project and it works as expected (jar copied into tomcat). Is there a way to include an open project into a dynamic web app when debugging it with tomcat under eclipse?

.classpath:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" output="target/classes" path="src/main/java"/>
    <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
    <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0"/>
    <classpathentry kind="output" path="target/classes"/>
</classpath>


I am not sure if it works in web projects but

<project> -> context menu -> Maven -> Disable Workspace Resolution

will stop the m2eclipse plugin to resolve dependencies in the workspace (by checking open projects). The dependencies will be requested from the (local) repository instead. Thus you have to install your library project if you want a new version to be referenced by your web project.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜