developerinlondon
Programmer
anyone knows of a good source for tutorials for deploying servlets with multiple servlet files, packages etc?
i went through the oreilly ant manual but it speaks about how ant works and about a sample scenario (non-servlet) but not what steps in what sequence needs to be done if we were to do it without ant.
So far I am guessing the steps can be like following :
1) create a directory called 'build' and copy all of the source files onto this directory. (eg if I have package1.library1.java, package1.library2.java, package2.servlet1.java, package2.servlet2.java I would put hem all in the same directory(
2) javac -d . -classpath [put all the library files' locations one by one] xxx.java
where xxx.java is one of the above files.
Doing this for all of the above files will create directories package1 and package2 under the 'build' directory and put .class files in them.
3) if there is a log4j.properties file put this in the build directory also.
4) now create the following directory structure under build :
build
-- WEB-INF
-- -- web.xml
-- -- log4j.properties
-- -- classes
-- -- -- package1
-- -- -- -- library1.class
-- -- -- -- library2.class
-- -- -- package2
-- -- -- -- servlet1.class
-- -- -- -- servlet2.class
5) once this is created go to the 'build' directory and jar it using following -
jar cvf servlet1.war WEB-INF
this will create the war file in the 'build' directory.
6) Run Tomcat Manager and deploy the created war file to it.
7) Check and see if it works.
8) IF not or I need to change a line in my code then do all the above steps again!
Am I on the right track here? is it a standard to use ANT since its such a long process? Is there any sample ANT build.xml I can get anywhere that does something similar to the above?
thanks
i went through the oreilly ant manual but it speaks about how ant works and about a sample scenario (non-servlet) but not what steps in what sequence needs to be done if we were to do it without ant.
So far I am guessing the steps can be like following :
1) create a directory called 'build' and copy all of the source files onto this directory. (eg if I have package1.library1.java, package1.library2.java, package2.servlet1.java, package2.servlet2.java I would put hem all in the same directory(
2) javac -d . -classpath [put all the library files' locations one by one] xxx.java
where xxx.java is one of the above files.
Doing this for all of the above files will create directories package1 and package2 under the 'build' directory and put .class files in them.
3) if there is a log4j.properties file put this in the build directory also.
4) now create the following directory structure under build :
build
-- WEB-INF
-- -- web.xml
-- -- log4j.properties
-- -- classes
-- -- -- package1
-- -- -- -- library1.class
-- -- -- -- library2.class
-- -- -- package2
-- -- -- -- servlet1.class
-- -- -- -- servlet2.class
5) once this is created go to the 'build' directory and jar it using following -
jar cvf servlet1.war WEB-INF
this will create the war file in the 'build' directory.
6) Run Tomcat Manager and deploy the created war file to it.
7) Check and see if it works.
8) IF not or I need to change a line in my code then do all the above steps again!
Am I on the right track here? is it a standard to use ANT since its such a long process? Is there any sample ANT build.xml I can get anywhere that does something similar to the above?
thanks