Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Dynamic Web Project referencing some other projects
icon3.gif  Dynamic Web Project referencing some other projects [message #548840] Fri, 23 July 2010 05:21 Go to next message
Leon  is currently offline Leon
Messages: 1
Registered: July 2010
Junior Member
I have a Dynamic Web Project which uses some other projects in the workspace as library.
What I want is when I deploy the project to the server, as a war file, the referenced project should be included as a jar file in the /WEB-INF/lib directory.

So I configured the packaging structure using "Web Deployment Assembly" configurator, I added the referenced project, defined the source, and deploy path.

But somehow, when it is built and packaged, the war file does include a "SampleReferencedProject.jar" in the WEB-INF/lib directory (which can be seen when I extract it), but its size is 0.

I couldn't figure out what should I do.

The org.eclipse.wst.common.component file of the web project is as the following:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="cg-ibs-admin">
        <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-resource deploy-path="/" source-path="/src/main/webapp"/>
        <dependent-module deploy-path="/WEB-INF/lib" handle="module:/resource/cg-ibs-apps-lib/cg-ibs-apps-lib">
            <dependency-type>uses</dependency-type>
        </dependent-module>
        <property name="context-root" value="/admin"/>
        <property name="java-output-path" value="/cg-ibs-admin/target/classes"/>
    </wb-module>
</project-modules>


and the .classpath is the following:


<?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="src" output="target/test-classes" path="src/test/java"/>
	<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.generic.runtimeTarget/JBoss v4.2">
		<attributes>
			<attribute name="owner.project.facets" value="jst.utility"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
		<attributes>
			<attribute name="owner.project.facets" value="java"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
	<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
	<classpathentry kind="output" path="target/classes"/>
</classpath>


Any help is appreciated.
Re: Dynamic Web Project referencing some other projects [message #548925 is a reply to message #548840] Fri, 23 July 2010 09:07 Go to previous messageGo to next message
Russell Bateman is currently offline Russell Bateman
Messages: 3120
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 7/23/2010 3:21 AM, Leon wrote:
> I have a Dynamic Web Project which uses some other projects in the
> workspace as library.
> What I want is when I deploy the project to the server, as a war file,
> the referenced project should be included as a jar file in the
> /WEB-INF/lib directory.
>
> So I configured the packaging structure using "Web Deployment Assembly"
> configurator, I added the referenced project, defined the source, and
> deploy path.
>
> But somehow, when it is built and packaged, the war file does include a
> "SampleReferencedProject.jar" in the WEB-INF/lib directory (which can be
> seen when I extract it), but its size is 0.
>
> I couldn't figure out what should I do.
>
> [snip]
>
> Any help is appreciated.

Do Web App Libraries show up in the Properties -> Java EE Module
Dependencies list? If so, make certain this one
(SampleReferencedProject.jar) is checked?

Just a wild guess.

Russ Bateman
Re: Dynamic Web Project referencing some other projects [message #548927 is a reply to message #548840] Fri, 23 July 2010 09:11 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1295
Registered: July 2009
Senior Member
On 7/23/2010 5:21 AM, Leon wrote:
> I have a Dynamic Web Project which uses some other projects in the
> workspace as library.
> What I want is when I deploy the project to the server, as a war file,
> the referenced project should be included as a jar file in the
> /WEB-INF/lib directory.
>
> So I configured the packaging structure using "Web Deployment Assembly"
> configurator, I added the referenced project, defined the source, and
> deploy path.
>
> But somehow, when it is built and packaged, the war file does include a
> "SampleReferencedProject.jar" in the WEB-INF/lib directory (which can be
> seen when I extract it), but its size is 0.
>
> I couldn't figure out what should I do.
>
> The org.eclipse.wst.common.component file of the web project is as the
> following:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project-modules id="moduleCoreId" project-version="1.5.0">
> <wb-module deploy-name="cg-ibs-admin">
> <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-resource deploy-path="/" source-path="/src/main/webapp"/>
> <dependent-module deploy-path="/WEB-INF/lib"
> handle="module:/resource/cg-ibs-apps-lib/cg-ibs-apps-lib">
> <dependency-type>uses</dependency-type>
> </dependent-module>
> <property name="context-root" value="/admin"/>
> <property name="java-output-path" value="/cg-ibs-admin/target/classes"/>
> </wb-module>
> </project-modules>
>
> and the .classpath is the following:
>
>
> <?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="src" output="target/test-classes"
> path="src/test/java"/>
> <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 .generic.runtimeTarget/JBoss
> v4.2">
> <attributes>
> <attribute name="owner.project.facets" value="jst.utility"/>
> </attributes>
> </classpathentry>
> <classpathentry kind="con"
> path=" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.inte rnal.debug.ui.launcher.StandardVMType/JavaSE-1.6 ">
>
> <attributes>
> <attribute name="owner.project.facets" value="java"/>
> </attributes>
> </classpathentry>
> <classpathentry kind="con"
> path="org.eclipse.jst.j2ee.internal.web.container"/>
> <classpathentry kind="con"
> path="org.eclipse.jst.j2ee.internal.module.container"/>
> <classpathentry kind="output" path="target/classes"/>
> </classpath>
>
> Any help is appreciated.
>

Since your web project isn't directly referencing a
SampleReferencedProject project, like it would when just using WTP, it
implies that maven is trying, but not quite handling this correctly. I
don't know enough about how maven is supposed to work to say more. You
may wish to pursue this on a maven forum or newsgroup.

Cheers,
Larry
Re: Dynamic Web Project referencing some other projects [message #641934 is a reply to message #548927] Mon, 29 November 2010 05:08 Go to previous message
Dzmitry [zmicer] Harachka is currently offline Dzmitry [zmicer] Harachka
Messages: 9
Registered: August 2010
Junior Member
Hi, All!
Btw, I have rather similar problem when dynamic project references another pojo java project (at both project deps and at deployment assembly), and there are not problems at compilation time, but when running web project on server (tomcat 6.0, eclipse built-in view servers) - then I have exception NoClassDefFoundError.

I checked Deployment Assembly (eclipse 3.6 helios). And I found that definition of dependency I add (jar of pojo project to put under WEB-INF/lib) disappeared every time I enter this dialog.

But what is interesting - .settings\org.eclipse.wst.common.component of web project contains this definition..

Please help in this.


Your Zmicer


www.zmicer.com
Previous Topic:Eclipse Hangs/Pauses When I Start to Type <elem... in JSPX/XML Editor, Especially with Custom Tag
Next Topic:Extend the (X)HTML editor
Goto Forum:
  


Current Time: Tue Jul 22 13:39:22 EDT 2014

Powered by FUDForum. Page generated in 0.02112 seconds