• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Regarding Ant issue.

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Team,
I am new babie in ant please help me.
I have created war files using Apache Ant version 1.8.1, war files is generated successfully. I want to start tomcat 7.0.23 and place my project in webapps directory of tomcat but after creating war files build.xml not executing below bold lines. I donot know what is wrong, please look into this i am sending by build.xml files as well as build.properties files

build.xml file:



build.properties:

 
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

arvind kushwaha wrote:I donot know what is wrong...


Do you know the "error" and its line number ?
 
arvind kushwaha
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting the below error.
I donot know which file is not found.

aa@aa-desktop:~/tempworkspace$ ant
Buildfile: /home/aa/tempworkspace/build.xml

init:
[echo] !!!Making directories !!!

compile:
[echo] !!!Compiling Java Files !!!
[javac] /home/aa/tempworkspace/build.xml:31: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

war:
[echo] !!!Creating War files !!!
[war] Building war: /home/aa/tempworkspace/dist/togle.war

deploy:
[echo] !!!deploy !!!

install:
[echo] !!!install Target!!!

BUILD FAILED
/home/aa/tempworkspace/build.xml:108: java.io.FileNotFoundException: togle (Is a directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:120)
at java.io.FileInputStream.<init>(FileInputStream.java:79)
at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:170)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
at org.apache.tools.ant.Main.runBuild(Main.java:801)
at org.apache.tools.ant.Main.startAnt(Main.java:218)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 7 seconds
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look carefully at the error message:

/home/aa/tempworkspace/build.xml:108: java.io.FileNotFoundException: togle (Is a directory)

The part in red is the file name, the part in blue is what Ant doesn't like. If you go back to the "install" target, you will note that the "war" property on line 106 is set to a directory, but it expects a file.
 
arvind kushwaha
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Peter for your's precious comment. The Problem is solved.

Thanks to all guys who help on this matter. I had make some changes and it worked. But on below bold line No: 29 want to pass dynamic file name instead of hard code. Can Any one Help on this. I am
attaching build. xml and build.properties file.

Build.xml




Build.properties

#build.properties file
project-name=togle
appserver.home=c:/apache-tomcat-7.0.23
deploy.path=${appserver.home}/webapps
appserver.lib=${appserver.home}/lib
sql.driver=com.mysql.jdbc.Driver
sql.url=jdbc:mysql://localhost:3306/
sql.user=root
sql.pass=redhat
sql.filePath=c:\
#sql.fileName=togle_20120213_1401.sql
sql.libPath=C:\lib
sql.libFileName=mysql-connector-java-5.0.7-bin.jar
#sqlFileLib=c:\lib/mysql-connector-java-5.0.7-bin.jar
tomcat.manager.url=http://localhost:8080/manager/
tomcat.manager.username=tomcat
tomcat.manager.password=tomcat

 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I assume, based on the file name, that the file is generated by some process somewhere and that process includes a date/time string in the filename, and what you want to do is set up the build.xml generically enough to handle whatever name was generated. This requires two steps:

1) First, change line 29 to be:



2) Set the sql.fileName property to the file's name. Exactly how that is done depends on who or what generated the file. Possibilities include updating the build.properties with the name and passing it using -D or setting an environment variable. There are probably other ways. But without knowing how the file gets generated, I can't be more specific.
 
arvind kushwaha
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Peter,

The file is given by user, i don't have to worried about that, thank you so much, but supposed above file run it created database, table and inserted all value. but i had updated some jsp again i have to run the build.xml file, in this scenario though table is created already it again try to do the same . I want to skip the database part when its run second time or all the data is already present in user machine. how would i achieve this in single build.xml file.

If provide me some code it will appreciated.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is what I would do.

Do not make "init" depend on "createDatabaseAndTable" (remove the depends clause from line 33)

Then when you need to create the database and build th code, run as:

ant createDatabaseAndTable war

Later when you just want to rebuild the app, run:

ant
 
Nothing up my sleeve ... and ... presto! A tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic