Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » jar file creation and deployment questions
jar file creation and deployment questions [message #877092] Fri, 25 May 2012 21:18 Go to next message
Marc Chamberlin is currently offline Marc ChamberlinFriend
Messages: 27
Registered: July 2009
Junior Member
Hello - I have some Eclipse usage questions and would like to know if
there is a structured way in Eclipse/Webtools that would solve these
annoyances. I suspect there is, probably using technology that I have
not yet learned about or how to use. If so, could someone provide me
with pointers to tutorials or docs that would show me how to solve the
following questions?

I have several dynamic web projects defined, each of which are used to
define a WAR file for deployment to some Tomcat server. In support of
these web projects we have a number of additional separate supporting
projects that are used to define and create collections of things like
servlets, applets/web apps, data transporters, general utilities etc.
These are simple java projects that are packaged into jar files for
usage in one or more of the dynamic web projects.

My questions are as follows -

1. Is there a mechanism in Eclipse that will automate the creation of
the jar file for each project, each time the project is built? At the
moment, we have to remember to click on the .jardesc jar file descriptor
in order to create the jar file for the project. This gets rather
annoying when one is doing iterative development and/or debugging.
Pointers to examples on how to do this would be much appreciated!

2. We had to configure the .jardesc files to warn about overwriting
files in order to avoid needlessly updating the .jardesc file (which
does not typically change) and thus avoiding needless CVS updates when a
project is checked in. It becomes annoying to have to say yes to
overwriting the .jar file, and no to overwriting the .jardesc file
every time we need to recreate the .jar file. Also, we discovered a
Catch22! One can check the box that will "Save the description of this
jar file in the workspace" but one cannot uncheck that box and have that
state of not saving the .jardesc permanently preserved in a .jardesc
file, since it will NOT be written out at all! Therefore, unchecking
that box is not a solution. So if there is a way to automate the
creation of .jar files, when we do a build, it would be really nice to
be able to avoid these overwrite questions as well.

3. For many of the jar files, we have to deploy them to multiple dynamic
web projects. To accomplish that, we have to create multiple .jardesc
files and execute them, since apparently a .jardesc file can only create
one jar file in one location. Or we have to copy/paste these jar files
from one project to another. Again a hassle and easy to forget this
step, so is there a way to automate this as well?

4. The publish mechanism for Tomcat seems to only recognize the need to
republish a dynamic web project when it detects a change has occurred
directly in one or more of the files (including jar files) within that
dynamic web project itself. Why doesn't the Tomcat server project detect
the need to publish when a jar file it depends on is recreated in one of
the supporting projects? It seems that in the Web Deployment Assembly,
for a dynamic web project, we define where jar files come from. So it
would seem that the Tomcat deployment mechanism should have enough
information to detect that a jar file created in another project has
changed, and therefore it needs to be republished. Right now, we have to
remember to force a republish which again is a hassle and an easy step
to forget.

5. The Web Deployment Assembly will only deploy jar files to the
WEB-INF/lib directory. How does one handle (automatically) the
deployment of jar files needed for applets/webapps? These cannot be
deployed to the WEB-INF/lib directory since the Tomcat server will not
allow user/client access to this directory. So they must be deployed to
somewhere else within a dynamic web project that is accessible by a
client. Is there any way to again automate the creation and deployment
of these kind of jar files?

Thanks in advance for any pointers/help... Marc..
Re: jar file creation and deployment questions [message #878577 is a reply to message #877092] Tue, 29 May 2012 14:46 Go to previous message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1310
Registered: July 2009
Senior Member
The Web Deployment Assembly page is what is available. Adding Project
dependencies on utility projects does allow publishing to detect changes
to the utility project. Note that you can double-click on the Deploy
Path and edit the text to specify the desired name for the jar and I
believe where you would like the jar to appear in the webapp. If you
direct it to someplace other than WEB-INF/lib, I think the project still
includes the jar in the build classpath, though technically it shouldn't.

If you want to add a direct jar dependency, I think it is best to add it
to the Java Build Path of the web project. Use the QuickFix for the
warning that should appear in the Markers or Problems view about the jar
not being available at runtime. Choosing to "publish/export" the jar
will include it in the WEB-INF/lib when the project is published. I
believe this approach is able to detect updated jars, unlike the more
"static" approach of adding the jar dependency in Web Deployment Assembly.

Cheers,
Larry

On 5/25/2012 5:18 PM, Marc Chamberlin wrote:
> Hello - I have some Eclipse usage questions and would like to know if
> there is a structured way in Eclipse/Webtools that would solve these
> annoyances. I suspect there is, probably using technology that I have
> not yet learned about or how to use. If so, could someone provide me
> with pointers to tutorials or docs that would show me how to solve the
> following questions?
>
> I have several dynamic web projects defined, each of which are used to
> define a WAR file for deployment to some Tomcat server. In support of
> these web projects we have a number of additional separate supporting
> projects that are used to define and create collections of things like
> servlets, applets/web apps, data transporters, general utilities etc.
> These are simple java projects that are packaged into jar files for
> usage in one or more of the dynamic web projects.
>
> My questions are as follows -
>
> 1. Is there a mechanism in Eclipse that will automate the creation of
> the jar file for each project, each time the project is built? At the
> moment, we have to remember to click on the .jardesc jar file descriptor
> in order to create the jar file for the project. This gets rather
> annoying when one is doing iterative development and/or debugging.
> Pointers to examples on how to do this would be much appreciated!
>
> 2. We had to configure the .jardesc files to warn about overwriting
> files in order to avoid needlessly updating the .jardesc file (which
> does not typically change) and thus avoiding needless CVS updates when a
> project is checked in. It becomes annoying to have to say yes to
> overwriting the .jar file, and no to overwriting the .jardesc file every
> time we need to recreate the .jar file. Also, we discovered a Catch22!
> One can check the box that will "Save the description of this jar file
> in the workspace" but one cannot uncheck that box and have that state of
> not saving the .jardesc permanently preserved in a .jardesc file, since
> it will NOT be written out at all! Therefore, unchecking that box is not
> a solution. So if there is a way to automate the creation of .jar files,
> when we do a build, it would be really nice to be able to avoid these
> overwrite questions as well.
>
> 3. For many of the jar files, we have to deploy them to multiple dynamic
> web projects. To accomplish that, we have to create multiple .jardesc
> files and execute them, since apparently a .jardesc file can only create
> one jar file in one location. Or we have to copy/paste these jar files
> from one project to another. Again a hassle and easy to forget this
> step, so is there a way to automate this as well?
>
> 4. The publish mechanism for Tomcat seems to only recognize the need to
> republish a dynamic web project when it detects a change has occurred
> directly in one or more of the files (including jar files) within that
> dynamic web project itself. Why doesn't the Tomcat server project detect
> the need to publish when a jar file it depends on is recreated in one of
> the supporting projects? It seems that in the Web Deployment Assembly,
> for a dynamic web project, we define where jar files come from. So it
> would seem that the Tomcat deployment mechanism should have enough
> information to detect that a jar file created in another project has
> changed, and therefore it needs to be republished. Right now, we have to
> remember to force a republish which again is a hassle and an easy step
> to forget.
>
> 5. The Web Deployment Assembly will only deploy jar files to the
> WEB-INF/lib directory. How does one handle (automatically) the
> deployment of jar files needed for applets/webapps? These cannot be
> deployed to the WEB-INF/lib directory since the Tomcat server will not
> allow user/client access to this directory. So they must be deployed to
> somewhere else within a dynamic web project that is accessible by a
> client. Is there any way to again automate the creation and deployment
> of these kind of jar files?
>
> Thanks in advance for any pointers/help... Marc..
Previous Topic:Older book and newer tools
Next Topic:JSF - More tool support
Goto Forum:
  


Current Time: Sat Nov 29 06:13:39 GMT 2014

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

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