Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Eclipse user library variables and jar export to WEB-INF/lib(Eclipse user library variables and jar export to WEB-INF/lib)
Eclipse user library variables and jar export to WEB-INF/lib [message #643307] Mon, 06 December 2010 13:19 Go to next message
Scott is currently offline ScottFriend
Messages: 5
Registered: December 2010
Junior Member
I have a workspace with nearly fifty web projects in it. In an effort to streamline classpath entries, I have created a user library variable and added all required jars to it. Next, I removed the individual classpath (build) entries from each of the fifty projects and replaced them with my single user library variable. Everything was going great until I deployed one of my projects from Eclipse to Tomcat and discovered the list of jars on the user library variable were not being copied to the WEB-INF/lib folder.

Does anyone know of a way to specify that these libraries get copied to the deployment source? I experimented with the Java EE Module Dependency tab, but the jars were not copied even after selecting the name of the user library set.

Peace, Scott

[Updated on: Mon, 06 December 2010 13:53]

Report message to a moderator

Re: Eclipse user library variables and jar export to WEB-INF/lib [message #643337 is a reply to message #643307] Mon, 06 December 2010 14:28 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1313
Registered: July 2009
Senior Member
On 12/6/2010 8:19 AM, stanlick@gmail.com wrote:
> down vote favorite
>
>
> I have a workspace with nearly fifty web projects in it. In an effort to
> streamline classpath entries, I have created a user library variable and
> added all required jars to it. Next, I removed the individual classpath
> (build) entries from each of the fifty projects and replaced them with
> my single user library variable. Everything was going great until I
> deployed one of my projects from Eclipse to Tomcat and discovered the
> list of jars on the user library variable were not being copied to the
> WEB-INF/lib folder.
>
> Does anyone know of a way to specify that these libraries get copied to
> the deployment source? I experimented with the Java EE Module Dependency
> tab, but the jars were not copied even after selecting the name of the
> user library set.
>
> Peace, Scott
>

If you open the Markers view there should be a Classpath Dependency
Validator Message warning group. If you expand that group you should
see some warnings similar to:

Classpath entry ??? will not be exported or published. Runtime
ClassNotFoundExceptions may result.

Right click on these warnings and select Quick Fix. This allows you to
mark the classpath entry for inclusion in WEB-INF/lib.

Cheers,
Larry
Re: Eclipse user library variables and jar export to WEB-INF/lib [message #643612 is a reply to message #643337] Tue, 07 December 2010 16:13 Go to previous messageGo to next message
Scott is currently offline ScottFriend
Messages: 5
Registered: December 2010
Junior Member
Thanks Larry --

Any idea how I can mark these jars as publish/deploy dependencies more efficiently than selecting each one and quick-fix. I have fifty projects and thirty jars! I will either need surgery or a new mouse before this could be wrapped up Laughing

Peace,
Scott
Re: Eclipse user library variables and jar export to WEB-INF/lib [message #643659 is a reply to message #643612] Tue, 07 December 2010 18:39 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1313
Registered: July 2009
Senior Member
On 12/7/2010 11:13 AM, Scott wrote:
> Thanks Larry --
> Any idea how I can mark these jars as publish/deploy dependencies more
> efficiently than selecting each one and quick-fix. I have fifty projects
> and thirty jars! I will either need surgery or a new mouse before this
> could be wrapped up :lol:
> Peace,
> Scott

Manually modifying the .classpath files by copy & pasting the added
attribute that controls this might be a little faster, but probably not
much better overall.

Cheers,
Larry
Re: Eclipse user library variables and jar export to WEB-INF/lib [message #643684 is a reply to message #643659] Tue, 07 December 2010 20:33 Go to previous messageGo to next message
Scott is currently offline ScottFriend
Messages: 5
Registered: December 2010
Junior Member
Larry --

Would you mind taking a look at the following and tell me if this should work. First the export of my user library, and second the .classpath of a project including this library on the build path. Even with this dependency quick fix, the jars are still not being exported to the project WEB-INF/lib. Any clues? Before I spend time doing anything to the other 49 projects, I'd like to determine a pattern that works.

P.S. I do like you tip on changing only each projects' .classpath if I can get it to actually work.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<eclipse-userlibraries version="2">
<library name="struts-2.2.1-jars" systemlibrary="false">
<archive path=" /struts2/WebContent/WEB-INF/lib/commons-fileupload-1.2.1.jar "/>
<archive path="/struts2/WebContent/WEB-INF/lib/commons-io-1.3.2.jar"/ >
<archive path="/struts2/WebContent/WEB-INF/lib/freemarker-2.3.16.jar "/>
<archive path="/struts2/WebContent/WEB-INF/lib/javassist-3.7.ga.jar"/ >
<archive path="/struts2/WebContent/WEB-INF/lib/ognl-3.0.jar"/>
<archive path="/struts2/WebContent/WEB-INF/lib/struts2-core-2.2.1.jar " source="F:/SCOTT-SHARED-DESKTOP/My Documents/Struts2Course/source/struts2/WebContent/WEB-INF/li b/struts2-src-2.2.1.zip "/>
<archive path="/struts2/WebContent/WEB-INF/lib/struts2-src-2.2.1.zip "/>
<archive path="/struts2/WebContent/WEB-INF/lib/xwork-core-2.2.1.jar" source="F:/SCOTT-SHARED-DESKTOP/My Documents/Struts2Course/source/struts2/WebContent/WEB-INF/li b/struts2-src-2.2.1.zip "/>
<archive path="/struts2/WebContent/WEB-INF/lib/servlet-api.jar"/>
<archive path=" /struts2/WebContent/WEB-INF/lib/struts2-config-browser-plugi n-2.2.1.jar "/>
</library>
</eclipse-userlibraries>




<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path=" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.inte rnal.debug.ui.launcher.StandardVMType/jre6 "/>
<classpathentry kind="con" path=" org.eclipse.jst.server.core.container/org.eclipse.jst.server .tomcat.runtimeTarget/Apache Tomcat v6.0"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/struts-2.2.1-jars">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib" />
</attributes>
</classpathentry>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Re: Eclipse user library variables and jar export to WEB-INF/lib [message #643699 is a reply to message #643684] Tue, 07 December 2010 22:03 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1313
Registered: July 2009
Senior Member
On 12/7/2010 3:33 PM, Scott wrote:
> Larry --
> Would you mind taking a look at the following and tell me if this should
> work. First the export of my user library, and second the .classpath of
> a project including this library on the build path. Even with this
> dependency quick fix, the jars are still not being exported to the
> project WEB-INF/lib. Any clues? Before I spend time doing anything to
> the other 49 projects, I'd like to determine a pattern that works.
> P.S. I do like you tip on changing only each projects' .classpath if I
> can get it to actually work.
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <eclipse-userlibraries version="2">
> <library name="struts-2.2.1-jars" systemlibrary="false">
> <archive path="
> /struts2/WebContent/WEB-INF/lib/commons-fileupload-1.2.1.jar "/>
> <archive path="/struts2/WebContent/WEB-INF/lib/commons-io-1.3.2.jar"/ >
> <archive path="/struts2/WebContent/WEB-INF/lib/freemarker-2.3.16.jar "/>
> <archive path="/struts2/WebContent/WEB-INF/lib/javassist-3.7.ga.jar"/ >
> <archive path="/struts2/WebContent/WEB-INF/lib/ognl-3.0.jar"/>
> <archive path="/struts2/WebContent/WEB-INF/lib/struts2-core-2.2.1.jar "
> source="F:/SCOTT-SHARED-DESKTOP/My
> Documents/Struts2Course/source/struts2/WebContent/WEB-INF/li
> b/struts2-src-2.2.1.zip "/>
> <archive path="/struts2/WebContent/WEB-INF/lib/struts2-src-2.2.1.zip "/>
> <archive path="/struts2/WebContent/WEB-INF/lib/xwork-core-2.2.1.jar"
> source="F:/SCOTT-SHARED-DESKTOP/My
> Documents/Struts2Course/source/struts2/WebContent/WEB-INF/li
> b/struts2-src-2.2.1.zip "/>
> <archive path="/struts2/WebContent/WEB-INF/lib/servlet-api.jar"/>
> <archive path="
> /struts2/WebContent/WEB-INF/lib/struts2-config-browser-plugi n-2.2.1.jar
> "/>
> </library>
> </eclipse-userlibraries>
>
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <classpath>
> <classpathentry kind="src" path="src"/>
> <classpathentry kind="con" path="
> org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.inte
> rnal.debug.ui.launcher.StandardVMType/jre6 "/>
> <classpathentry kind="con" path="
> org.eclipse.jst.server.core.container/org.eclipse.jst.server
> .tomcat.runtimeTarget/Apache Tomcat v6.0"/>
> <classpathentry kind="con"
> path="org.eclipse.jst.j2ee.internal.web.container"/>
> <classpathentry kind="con"
> path="org.eclipse.jst.j2ee.internal.module.container"/>
> <classpathentry kind="con"
> path="org.eclipse.jdt.USER_LIBRARY/struts-2.2.1-jars">
> <attributes>
> <attribute name="org.eclipse.jst.component.dependency"
> value="/WEB-INF/lib" />
> </attributes>
> </classpathentry>
> <classpathentry kind="output" path="build/classes"/>
> </classpath>

Looks good to me. Fortunately, the added classpath entry is project
agnostic. If it works for one, the same entry should work for each project.

Cheers,
Larry
Re: Eclipse user library variables and jar export to WEB-INF/lib [message #643702 is a reply to message #643699] Tue, 07 December 2010 22:16 Go to previous messageGo to next message
Scott is currently offline ScottFriend
Messages: 5
Registered: December 2010
Junior Member
Larry --

Thanks for looking at my configs. The problem is, the jars are NOT being exported to WEB-INF/lib of the project containing the .classpath I included.

Scott
Re: Eclipse user library variables and jar export to WEB-INF/lib [message #643861 is a reply to message #643702] Wed, 08 December 2010 13:59 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1313
Registered: July 2009
Senior Member
On 12/7/2010 5:16 PM, Scott wrote:
> Larry --
> Thanks for looking at my configs. The problem is, the jars are NOT being
> exported to WEB-INF/lib of the project containing the .classpath I
> included.
>
> Scott

A simple experiment shows something similar working for me. If you
haven't already, restart your Eclipse, then right-click on the server in
the Servers view and select "Clean...". That should ensure that the
projects are published accurately. If there is still a problem, we will
have to investigate what is different in your workspace.

Cheers,
Larry
Re: Eclipse user library variables and jar export to WEB-INF/lib [message #643990 is a reply to message #643861] Wed, 08 December 2010 23:28 Go to previous message
Scott is currently offline ScottFriend
Messages: 5
Registered: December 2010
Junior Member
Wow! Either adding the following entry to .classpath or allowing quick fix to do it for you is not enough. you *must* close and restart Eclipse and then run on server to get the jars to actually get deployed to WEB-INF. I tried every combination of Publish, Clean... you name it and the only way the jars were ever deployed to the next modified project's .classpath was to close and restart Eclipse.

Sounds like something is not being reconsidered once the files have been read in.

<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/struts-2.2.1-jars">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="build/classes"/>

Thanks for all your help Larry

Peace,
Scott
Previous Topic:Extend Html Tags or Create Html Tag LIbrary?
Next Topic:When I start then eclipse has got a lot of errors.
Goto Forum:
  


Current Time: Mon Dec 22 06:23:00 GMT 2014

Powered by FUDForum. Page generated in 0.03726 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software