I'm implementing a plugin to generate tomcat server instances and I was hoping 
to get some help with it.  We have 2 different tomcat servers, that are almost 
identical, except each deploys different web applications (one for web apps 
that are accessible from the internet, one for internal web apps).  Therefore 
we create 2 servers, one gets installed on a server in the DMZ and the other 
gets installed on an internal server.
 
The plugin should do the following:
 
1.  Copy the tomcat server files to a working directory.  
2.  Copy config files and modified catalina.bat file to config and to bin 
(overwriting files that are there currently).  
3.  Generate the server.xml file using a velocity template.  We change the 
tomcat settings depending on the build profile (dev, qa, prod) and type 
(internet, internal).
4.  Compile and jar custom extension classes and place it in the server/lib 
file.  These classes are directly dependent on tomcat server classes.
5.  Compile and jar (or copy from the repository) our core business and 
utilities library and copy it to common/lib.  Nearly every one of our web 
applications are dependent on this jar (and therefore its dependencies).
6.  Copy web apps (of the appropriate type) from the repository into the 
webapps directory.
7.  Copy all common libraries to common/lib
8.  Zip up the entire server and copy it to a repository.
 
The idea is that you can unzip the final file and get a fully functioning 
server.
 
The first 4 steps and the last step should be pretty straight forward.  We 
already implemented this in a maven.xml file using ant tasks for maven 1.  I 
can just move it to a plugin.  
 
However, I'm not sure how to handle the dependencies.  In maven 1, we simply 
used properties on the dependency to mark it as a common library and wrote a 
plugin to copy those libraries to common/lib and copy the war file to the 
webapps directory after the application is built (i.e., <postGoal 
name="war:war">).  We are trying to get away from that mechanism.  That was 
invoked on the web application project, and we think it will simplify things if 
we keep all logic related to building the tomcat instance in one plugin and 
invoked on one project.  
 
What i'm planning on doing is to include our core library as a dependency into 
our tomcat project and include everything that should go into common/lib as 
dependencies on the core library.  That way I can implement the plugin to copy 
all jar dependencies (direct or indirect) into common/lib and have it copy the 
core library to common/lib and then cascade to all of its dependencies.  For 
the war dependencies, I'm hoping I can look at a property set on the war 
application project (although i'm not entirely sure how to do this) to 
determine if its the appropriate type (internet or internal) and copy it to the 
webapps directory if it is.
 
In order to keep dependencies listed in one place, the web applications can 
extend the core library project (or would it be better to create a parent 
project that contains only a pom.xml?).  If i did this, I would have to mark 
all the common dependencies as provided to keep them from being copied to the 
web-inf/lib directory.  Would this cause a problem when copying the files to 
common/lib explained above?
 
Any advice you can give would be greatly appreciated.  
 
Tom


----------------------------------------------------------------------
The information contained in this transmission is intended only for
the personal and confidential use of the designated recipients named
herein.  If the reader of this transmission is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
transmission in error, and that any review, dissemination,
distribution, or copying of this transmission is strictly prohibited.
If you have received this communication in error, please notify the
sender and return and delete the original transmission immediately.
Thank you.

Reply via email to