How do I share an Eclipse User Library with other users?   Leave a comment



An EclipseSW User Library can be used to group a set of jarW files, such as a set of TomcatSW jar files. In another tutorial, I created a user library called “TOMCAT_6.0.14_LIBRARY” for a set of Tomcat jar files.

In a group development setting, it can be useful to share a user library with other developers so that all developers can can gain the benefits of using a user library classpathW. It’s beneficial for all developers to use the same user library so as to avoid jar file dependency issues.

You can share a user library with other developers by exporting your user library to an XMLW file. This XML file can then be imported by other developers.

To export a user library, to go Window → Preferences and go to JavaSW → Build Path → User Libraries. Here, click the Export button.

Export User Library

Select the user library or libraries to export. I selected the TOMCAT_6.0.14_LIBRARY library. Enter a destination location and name. I chose to export the file to my desktop and named the file “tomcat_6.0.14_library.xml”. Click OK. Your user library should now be exported to a file.

Export User Library

The generated tomcat_6.0.14_library.xml file is shown below:


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<eclipse-userlibraries version="2">
    <library name="TOMCAT_6.0.14_LIBRARY" systemlibrary="false">
        <archive path="C:/dev/apache-tomcat-6.0.14/bin/bootstrap.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/bin/commons-daemon.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/bin/tomcat-juli.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/lib/annotations-api.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/lib/catalina.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/lib/catalina-ant.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/lib/catalina-ha.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/lib/catalina-tribes.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/lib/el-api.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/lib/jasper.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/lib/jasper-el.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/lib/jasper-jdt.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/lib/jsp-api.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/lib/servlet-api.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/lib/tomcat-coyote.jar"/>
        <archive path="C:/dev/apache-tomcat-6.0.14/lib/tomcat-dbcp.jar"/>

One important thing to notice is that the archive paths (the paths to the jar files) in the xmlW file are paths to the various jar files in the file system. If the other developers on your team are using the same location for Tomcat (C:/dev/apache-tomcat-6.0.14/), then they don’t need to alter the file before importing the User Library. If their Tomcat installations are in a different location, then this file needs to be updated to contain the paths to their Tomcat installations before they import the file.

As a final note, the user library can be imported via the Import button at Java → Build Path → User Libraries.

Posted 2012年04月3日 by gw8310 in eclipse


Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: