• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting Up Development Environment Using Ant

 
Aryeh Golob
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a general question about setting up my Tomcat development environment.

I believe to have Tomcat set up correctly and verified that I can run a Servlet.

Here are my CATALINA variables ...



I modified the sample HelloWorldExample servlet and verified that I can compile and run the servlet using the folowing URL.

http://localhost:8080/netcomm/servlets/servlet/HelloWorldExample

Here are the servlet definitions as defined in my web.xml file ...





I have ANT set up so that when I execute the ant command, a build directory is created under the root netcomm directory which contains the $ROOT/netcomm/builds/WEB-INF/classes/com/ .... /HelloWorldExample.class file.

If I move the build WEB-INF application directory structure to the root application directory ($ROOT/netcomm/WEB-INF/classes/com/ .... /HelloWorldExample.class etc.), then everything works fine.


My question, is however, what is the best way to set up my development environment so that I can just type ant and have everything work without having to move directory etc. or restart tomcat server?

The documentation says something about either resetting CATALINA_BASE or using the Manager application ...

Can anyone advise regarding the correct way to set up a Tomcat development environment using ANT in the most efficient way possible?

I appreciate your time and consideration.

Sincerely,
Aryeh
 
Misha Ver
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Who created ANT script? Why don't you just modify the script to deploy to proper location?

Ideally ANT script should get you code from version control system, compile the code, create war file and deploy to Tomcat. Read about Tomcat Manager, particularity about Executing Manager Commands With Ant
 
Aryeh Golob
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi and thank you for your reply ...

I understand that ANT can create the WAR file and copy it to the proper location.

I was curious what the best way to set up my development environment would be.

Perhaps I should add a copy from the $ROOT/myapp/build/WEB-INF to $ROOT/myapp/WEB-INF?

Was just wondering if someone with some Tomcat development experience could help me out with understanding the best way to set up a development environment.

I appreciate your feedback and if you do have any more info that may help me, I am very grateful.

Thanks,
Aryeh
 
Aryeh Golob
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Misha ...

So here is what I did ...

Added ant copy directive to my build.xml to file to copy $ROOT/builds/WEB-INF/classes to $ROOT/WEB-INF/classes.

Added ant clean directive to delete $ROOT/WEB-INF/classes in addition to $ROOT build.

Added ant reload directive for Tomcat Manager to reload context.

--------------------

I did see that the documentation you referenced suggests building a new .war file upon reload.

Will modify later when I get closer to deploying live app.

Thanks again!

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic