Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Adding external JARs to CVS project
Adding external JARs to CVS project [message #200322] Mon, 19 March 2007 05:37 Go to next message
Eclipse UserFriend
Originally posted by: petra.k.geoaxon.com

Hi there! I've created a project that uses Hibernate Annotation
classes. The project must be booked into the CVS repository. In order
to use Hibernate, I need to add a list of external JARs to my Java
Build path. But when adding them, the JAR path is hard-coded (with
my username, eg. /home/petra/...)

Now when one of the other CVS users try to check out the project, they
have errors on their project, because the directory for the JAR doesn't
exist on their system.

The result is that each time the project is checked out, each user
needs to update the project build path to his own file structure.

I'm sure this is not the correct way of adding external JARs to a CVS
project, but I cannot find any other suggestions on the internet. Please
can you advise me on how to achieve this? Thanks!
Re: Adding external JARs to CVS project [message #200384 is a reply to message #200322] Mon, 19 March 2007 11:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: krzysztofHMMMMdaniel.gmail.com

Have you tried putting those libs inside your project, in newly created
folder named 'lib'?

Adding .project to .cvsignore may also help.

Regards,
Chris
Re: Adding external JARs to CVS project [message #200452 is a reply to message #200322] Mon, 19 March 2007 14:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

You can use Class Path Variables to reference jar files that don't reside in
your project. The variable is workspace dependent meaning that all
developers will need to define the variable in their workspace. The
variable points to a location in your hierarchy. You can extend the
variable to create a reference relative to the variable location.

Use the Class Path Variable on the Libraries tab of the Java Build
Properties page to add the jar. Other users importing the project can
define the variable on the Window->Preferences->Java->Build Path->Classpath
Variables page.


"Petra Kritzinger" <petra.k@geoaxon.com> wrote in message
news:pan.2007.03.19.05.37.04.700713@geoaxon.com...
> Hi there! I've created a project that uses Hibernate Annotation
> classes. The project must be booked into the CVS repository. In order
> to use Hibernate, I need to add a list of external JARs to my Java
> Build path. But when adding them, the JAR path is hard-coded (with
> my username, eg. /home/petra/...)
>
> Now when one of the other CVS users try to check out the project, they
> have errors on their project, because the directory for the JAR doesn't
> exist on their system.
>
> The result is that each time the project is checked out, each user
> needs to update the project build path to his own file structure.
>
> I'm sure this is not the correct way of adding external JARs to a CVS
> project, but I cannot find any other suggestions on the internet. Please
> can you advise me on how to achieve this? Thanks!
Re: Adding external JARs to CVS project [message #200577 is a reply to message #200384] Tue, 20 March 2007 03:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse5.rizzoweb.com

Krzysztof Daniel wrote:
> Have you tried putting those libs inside your project, in newly created
> folder named 'lib'?

This is the preferred approach in most cases. It is usually desirable to
have all dependencies checked in so that anyone can easily checkout and
build the project without having to download or install other stuff in
separate locations.

Hope this helps,
Eric
Re: Adding external JARs to CVS project [message #200606 is a reply to message #200577] Tue, 20 March 2007 04:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: petra.k.geoaxon.com

> Krzysztof Daniel wrote:
>> Have you tried putting those libs inside your project, in newly created
>> folder named 'lib'?

Eric Rizzo wrote:
> This is the preferred approach in most cases.

Thanks for the feedback! This solved my problem.
Re: Adding external JARs to CVS project [message #200614 is a reply to message #200452] Tue, 20 March 2007 04:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: petra.k.geoaxon.com

Dave Wegener wrote:

> ...The variable is workspace dependent...

Thanks, I didn't realise that!
Re: Adding external JARs to CVS project [message #200662 is a reply to message #200452] Tue, 20 March 2007 12:07 Go to previous messageGo to next message
Jörg Thönnes is currently offline Jörg ThönnesFriend
Messages: 229
Registered: July 2009
Senior Member
On 03/19/2007 03:51 PM, Dave Wegener wrote:
> You can use Class Path Variables to reference jar files that don't reside in
> your project. The variable is workspace dependent meaning that all
> developers will need to define the variable in their workspace. The
> variable points to a location in your hierarchy. You can extend the
> variable to create a reference relative to the variable location.
>
> Use the Class Path Variable on the Libraries tab of the Java Build
> Properties page to add the jar. Other users importing the project can
> define the variable on the Window->Preferences->Java->Build Path->Classpath
> Variables page.

Quite nearby are the "User Libraries." IMHO, this is the best way to packages external libraries:

Window->Preferences->Java->Build Path->User Libraries. Every User Library conists of several JAR
files, for every JAR file you can configure source code and javadoc etc.

Here is an installation guide to setup the open source QuickFIX library as Eclipse user library
(replace $qfjVErsion by a version number etc.):

> Create a new Eclipse User Library using
>
> * Window / Preferences...
> * Java / Build Path / User Libraries / New...
> * User library name:
>
> QuickFIXJ_$version
>
> Select new user library and press "Add JARs". Browse to
>
> /opt2/QuickFIX/quickfixj-$qfjVersion/quickfixj/quickfixj.jar
>
> Open added JAR and add source and API docs:
>
> * Source Attachment: "Edit..."
> o Select "External File..." and browse to:
>
> /opt2/QuickFIX/quickfixj-$qfjVersion/quickfixj/src.zip
>
> * Javadoc location: "Edit..."
> o Select "Javadoc in archive"
> o "Path within archive:" api
> o "Archive path:" browse to
>
> /opt2/QuickFIX/quickfixj-$qfjVersion/quickfixj/doc/api-doc.z ip
>
> Use "Validate..." to check the correct Javadoc location.
>
> Finally add all dependent JARs from the directory
>
> /opt2/QuickFIX/quickfixj-$qfjVersion/quickfixj/lib
>
> using "Add JARs" (multiple select possible). Neither source code attachment nor Javadoc location is provided.
>
> Export the User Library using "Export..." to

Please adapt for your need. You could also export the user libraries to your CVS workspace, so
whenever somebody adds a new library, all other will see this in "Team Synchronize" and can import
the new settings into their preferences.

Please note the naming convention

<name>_<version>

taken from e.g. Debian Linux packages.

In the Project Properties / Java Build Path, use "Add Library..." / User Library. Using the button
"User Libraries", you will get to the Window / Preferences ...

Have fun! Would nice to hear some feedback how it worked for your project...

Cheers, Jörg

> "Petra Kritzinger" <petra.k@geoaxon.com> wrote in message
> news:pan.2007.03.19.05.37.04.700713@geoaxon.com...
>> Hi there! I've created a project that uses Hibernate Annotation
>> classes. The project must be booked into the CVS repository. In order
>> to use Hibernate, I need to add a list of external JARs to my Java
>> Build path. But when adding them, the JAR path is hard-coded (with
>> my username, eg. /home/petra/...)
>>
>> Now when one of the other CVS users try to check out the project, they
>> have errors on their project, because the directory for the JAR doesn't
>> exist on their system.
>>
>> The result is that each time the project is checked out, each user
>> needs to update the project build path to his own file structure.
>>
>> I'm sure this is not the correct way of adding external JARs to a CVS
>> project, but I cannot find any other suggestions on the internet. Please
>> can you advise me on how to achieve this? Thanks!
>
>
Re: Adding external JARs to CVS project [message #203400 is a reply to message #200452] Thu, 05 April 2007 04:19 Go to previous message
Eclipse UserFriend
Originally posted by: petra.k.geoaxon.com

Sorry, until now I didn't understand this procedure exactly. Now I've
grasped the concept. (Thanks, Dave, I'm getting there!)

For other newbies,the following steps can be taken:

1. Define a new Class path variable as Dave said
(Window->Preferences->Java->Build Path->Classpath Variables). Point it to
the directory where your external JARs reside.

2. Select project > properties > Java Build Path. On the Libraries tab,
select "Add Variable". Select the variable you just created and "Extend".
Select the JAR(s) you want to add.

3. Make sure all the other CVS users also define the class path in their
workspace.

(Thanks also Jorg for clarifying this issue)

> You can use Class Path Variables to reference jar files that don't
> reside in your project. The variable is workspace dependent meaning
> that all developers will need to define the variable in their workspace.
> The variable points to a location in your hierarchy. You can extend
> the variable to create a reference relative to the variable location.
>
> Use the Class Path Variable on the Libraries tab of the Java Build
> Properties page to add the jar. Other users importing the project can
> define the variable on the Window->Preferences->Java->Build
> Path->Classpath Variables page.
Previous Topic:editing data in Oracle database from Eclipse
Next Topic:HowTo distinguish files with same name in different editors?
Goto Forum:
  


Current Time: Tue Apr 16 20:46:32 GMT 2024

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

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

Back to the top