views:

50

answers:

3

Hello,

I have a problem with my build path. In my web project all .jar must go on projects, so I cannot use the WEB-INF/lib resource to add .jars there.

So I created a Lib project so I could use it in the same way I use the WEB-INF/lib. Problem is I am not beeing able to make it work properly. Seems fairly easy, I create a Java proyect, put all .jar in it and then tell the build path to look at that proyect in the specific place I put this .jars.

I have tried creating other types of project (a non-java project an utility JEE project...) and changing the native libreary location of the depended project. All futile.

So, How can I make one project see the .jar of another project?

Thanks for all.

+2  A: 

I'm not sure, but I think you have to do to the jars project>properties>build path>order and export and mark all the libs you and to pass through.

rsilva
Doesn't seem to work either. Should I be looking for a JEE module dependency?
Random
+1  A: 

Using Maven would be a better alternative since it is actually a repo for jar files. Another alternative is to simply have a shared lib directory, then you configure your classpath to include the jar files at that location, preferably using a classpath variable to define its location.

There really isn't much point to putting them in an eclipse project, it adds no value. The other problem you have is that the jars are going to be required in the war at runtime, so without putting them in the lib directory, they will have to appear somewhere else that the classloader can find them, such as the servers classpath or some other shared location (this will be vendor dependent).

Robin
I understand the futility in my actions, unfortunatly it is not my decision. It's a 'corporate and arquitecture' decision. I understand we are shipping both projects. Funny thing is we are going to use maven to deploy...
Random
+1  A: 

In your project properties under "J2EE Module Dependencies"/"Web Libraries" add your external jars there

eugener
I added the path to all .jars but it didn't work, so I tried adding each individual jar as a J2EE Module Dependencie Seems it's working. Thanks!
Random