At the moment I wimp out and let eclipse generate a .WAR file for me. However I would like to have a script to do this. I have tried to run a command like the following in the base project directory of my eclipse web project but the resultant .war file structure is not the same as the one that eclipse creates for me and does not work - page not found errors etc.
jar cvf archiveName.war .
For example the .jsp file physically reside in my webcontent directory within the eclipse directory structure. However when eclipse creates the .war file those .jsp files appear in the root.
When I run the command above they remain in a subdirectory.
So do I need to re-jig my eclipse project or do something different for the jar command ?
Will that overcome the problems I am experiencing with the JAR command or is it just another way of doing the same. I am aware of ANT but never used it personally so I dont know if it would overcome the structural "path" issues I have with the resultant .WAR file.
I am getting closer to understanding the problem - but not the solution.
When I hunt around in the Project Properties within Eclipse I see this page called a Web Deployment Assembly (see attached screen dump). If shows how the physical project directory structure is mapped (changed) when building a .WAR file from the Eclipse IDE.
When I run the jar command this mapping does not seem to happen and as such I end up with an invalid structure.
So - how do I replicate what Eclipse is doing when it builds the .WAR file for me ?
You really should look into Ant or Maven to do this for you. If you insist on just running jar from the command line, then you should first copy all of the files you need into a single directory (preferably not within the existing Eclipse project directory structure ) that matches the desired war contents, and then jar that directory.
OK - I will look at ANT then - can you recommend a web link or book that would deal with the type of thing I'm trying to do. I don't seem to know the correct key words to find any useful examples. This kind of build which needs to re-arrange the structure of the target file must be very common ?
Is this re-arrangement of directories something unique to how eclipse works ?