• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

I Wrote My First ANT Script. Even mkdir Does Not Do Anything

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a simple web application developed in the Eclipse Luna.  The directory structure of the application is like:

+--- SchoolSchedule
+--- +--- Java Resources
+--- +--- +--- src
+--- +--- +--- +--- org.eclipse.wtp.sample.classchedule
+--- +--- +--- +--- +--- ScheduleServlet.java
+--- +--- +--- +--- +--- SchoolClass.java
+--- +--- +--- +--- +--- SchoolSchedule.java
+--- +--- build
+--- +--- WebContent
+--- +---+--- META-INF
+--- +---+--- WEB-INF
+--- +--- +--- +--- lib
+--- +--- +--- +--- +--- jstl.jar
+--- +--- +--- +--- +--- servlet-api.jar
+--- +--- +--- +--- +--- standard.jar
+--- +--- +--- +--- web.xml
+--- +--- +--- Schedule.jsp
+--- +--- build.xml


The build.xml is at the project root.  This web application runs successfully.

I created an ANT script to compile, build a WAR file, and deploy it.  But, even the basic task does not work.  I right click on the build.xml --> run as ... --> Ant build.  In the console, I can see all the echo messages and no error.  However, I do not see any new directories created (I "refresh" the project.).  No "class" files compiled from the Java code and not to mention build and deploy.  

There is something I did not get it right.  Please help.  Here is my Ant script:

 
Johaness Murong
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is me again.

Sorry, the "Java Resources" is Eclipse specific.  To be accurate, under the project root, there are src, build, WebContent folders and the build.xml file.

Hoping someone could kindly help.  Thank you.
 
Marshal
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you didn't get any error messages out of running that script, then perhaps the directories were actually created somewhere you didn't expect. You've got another task which is supposed to delete some directories: did it delete the directories you expected it to delete? The potential problem is that the current working directory when you ran the script wasn't what you hoped it would be.

You can use the Windows file-viewer app to search for directories with a particular name, so try that.
 
Johaness Murong
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Paul,  You are right.  The cause of the problem is

The current working directory when you ran the script wasn't what you hoped it would be.  

 I have to change:


to


Now, I am able to compile the Java classes (i.e. javac works).  I can see the compiled Java classes under root/build/classes folder.

However, I still cannot build a WAR file (I have read those previously posted relevant threads and tried to follow the examples).  I can see 1. the "copy" tasks do not work because I do not see files are copied into the "build/war" directory; and 2. the "war" task is not doing anything.  Nevertheless, there is no error message on the console.  Here I post my ANT script and hoping to get some more help.  Thank you very much.

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!