tags:

views:

181

answers:

2

Hi,

How can I add an library to a seam project?

Do I need to copy them manually somewhere or edit the build.xml to do it for me?

Or is there an automatic way provided by seam to add new libraries?

BR,

Cleber

+2  A: 

Do I need to copy them manually somewhere or edit the build.xml to do it for me?

If you project was generated by seam-gen simply add library to lib subfolder.

Or is there an automatic way provided by seam to add new libraries?

You can use maven to manage dependencies. Seam projects aren't mavenized by default, but there are community templates of seam maven projects. Fortunately maven will officially supported in Seam 3.

cetnar
I must be forgetting something then, I added the library to the project's lib folder, added it to my eclipse's classpath and I'm able to compile the application but I get runtime errors when deploying it to JBoss. Checking the EAR file I could see that the new library wasn't deployed.
Cleber Goncalves
@Cleber: I you use `seam deploy` or `seam explode` it works as I wrote. If you use eclipse to deploy (WTP) - you need to check this new jar as web library dependency in Project Properties -> Java EE Module Dependencies, then new jar will be deployed with webapp in WEB-INF\lib folder.
cetnar
Well, I couldn't get it to work that way. Although I'm using seam deploy/explode (doing undeploy/unexplode before) the libraries didn't get copied to the deploy folder... Also I couldn't find the mentioned menu option in Eclipse even though I'm running WTP (Eclipse Web Developer Tools Version: 3.1.0.v200905242131-7R77FShEVw2xUGpF1LiNxdVAELXy Build id: 20090616035105) and Eclipse 3.5. Maybe a different build?
Cleber Goncalves
Thanks for the tip about Maven, I'll check it out
Cleber Goncalves
@Cleber: Ouch, I forget to inform you about adding line in deployed-jars-ear.list file - it was my oversight. About eclipse this view is visible in Dynamic Web Modules Project - project genrated by seam-gen isn't such one, it managed by ant. Sorry for misrepresentations.
cetnar
+1  A: 

I did find a way to get it done, the 'ear' task in build.xml has a

<includesfile name="deployed-jars-ear.list"/>

If I edit this file (found next to build.xml) and add the names of my libraries to the end of it, they get copied to the lib folder inside my EAR file which is what I need, since I want then to be loaded by the EAR classloader.

It is worth noting for people new to JBoss like me that JBoss ships with a few libraries already deployed under jboss-5.1.0.GA\lib\endorsed that might conflict with yours if you don't watch out.

Cleber Goncalves