I have a utility jar file that I use in all my applications (web and
desktop).
But the problem is that, in the case of the web applications, every time
that
I generate this jar file again (due to some update in their classes,
for example) I have to copy it to the lib directory of the application
server
(I'm using JBoss, so I place my utility jars there). So, this takes time
and
it is also error prone, in the case that I could forget to copy the file
to the
lib directory.

I would like to have a way to update the jar file automatically to the
application server when I deploy my web application, without the need to
explicitly copy it. Is there a way WTP can help me achieve this,
automatizing
my development process?

If you're deploying to your server using the WTP server controls you can
create a J2EE Utility Project and specify that your Web project depends on
the utility project. WTP will then bundle the utility project with your
Web app before automatically deploying it to the server.

If you're deploying to your server without WTP's help I'd integrate this
into your build process. That way each time there is an update to your
utility project you simply rebuild your Web app automatically pulling in
the changes and then redeploy your entire Web app.

> If you're deploying to your server using the WTP server controls you can
> create a J2EE Utility Project and specify that your Web project depends on
> the utility project. WTP will then bundle the utility project with your
> Web app before automatically deploying it to the server.

Yes, I'm using the WTP server controls and I'll try the J2EE Utility
Project to solve my problem as you suggested to me. But I have just one
doubt about the behavior of the Utility Project: as I said, I'm using
JBoss and I place my utility jar file in the server lib directory, so all
my web applications in the deploy directoy can see it. Can I specify to
the Utility Project that I want my jar file deployed to the server lib
directory or is it deployed by default in another way, to another
location? To be sincere I don't mind where the Utility Project deploy the
jar file, since my web application will still be able to see it.

>Can I specify to
>the Utility Project that I want my jar file deployed to the server lib
>directory or is it deployed by default in another way, to another
>location?

No. The utility project will be automatically deployed to your Web app's
lib directory. If you want to deploy to another location (such as the
server lib directory) I'd create a simple Ant task and hook up it up as an
Eclipse builder for your project. (You can hook up any Ant task as an
Eclipse builder.) Then, when you rebuild your utility project your Ant
task will get invoked and your utility project will automatically get
deployed.