Condition with Task in Ant

scmuser created the topic: Condition with Task in Ant
Hi,

How can i use conditions in Ant Task execution?

Any idea?

tpatil replied the topic: Re: Condition with Task in Ant
[i]













[/i]

rajeshkumar replied the topic: Re: Condition with Task in Ant
Hi,

I guess questions was based on applying condition for Aant TASK instead of Ant Target. Following ways i mean using you can set the conditional properties value but set condition with TASK.

There is one external lib ant-contrib which can be used to put conditional Task such you can find more details in links below…..
ant-contrib.sourceforge.net/tasks/tasks/if.html
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Replace xml values using ant

tpatil created the topic: Replace xml values using ant
I want to replace xml values using ant. Any idea?

e.g
org.hibernate.dialect.Oracle10gDialect

I want to replace the value of hibernate.dialect property using ant.

rajeshkumar replied the topic: Re: Replace xml values using ant
You can opt for any one of these based on senario…

1. if you can your Value as holding place such as… @org.hibernate.dialect.Oracle10gDialect@

Then u can use Filterset task in Ant…for more info…

ant.apache.org/manual/Types/filterset.html

2. If you have same requirement as you mentioned abobe… then probably you can try ReplaceRegExp ant task.

ant.apache.org/manual/Tasks/replaceregexp.html

Please let me know if this solve your problem. 🙂
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

SQL files execute : Incorrect syntax near ‘go’.

saiki created the topic: SQL files execute : Incorrect syntax near ‘go’.
Getting below issue when trying to run the ant script.

I am trying to run few sql files from the folder through ant script in which I configured the “jtds-1.2.5.jar”.
Unable to run the GO statment in the sql file. But able to execute same file it through sql studio with out any error.

************************************************** **


************************************************** **
ERROR:
************************************************** **
java.sql.SQLException: Incorrect syntax near ‘go’.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnos tic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(Td sCore.java:2820)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCor e.java:2258)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(T dsCore.java:632)
at net.sourceforge.jtds.jdbc.JtdsStatement.processRes ults(JtdsStatement.java:584)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL (JtdsStatement.java:546)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeImp l(JtdsStatement.java:723)
at net.sourceforge.jtds.jdbc.JtdsStatement.execute(Jt dsStatement.java:1160)
at org.apache.tools.ant.taskdefs.SQLExec.execSQL(SQLE xec.java:775)
at org.apache.tools.ant.taskdefs.SQLExec.runStatement s(SQLExec.java:751)
at org.apache.tools.ant.taskdefs.SQLExec$Transaction. runTransaction(SQLExec.java:1055)
at org.apache.tools.ant.taskdefs.SQLExec$Transaction. access$000(SQLExec.java:985)
at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLE xec.java:653)

rajeshkumar replied the topic: Re: SQL files execute : Incorrect syntax near ‘go’.
ave you tried executing sql statement on command line. may be sql studio has some setting which is helping to get it execute but not the ant script.

please refer these url as well…
forums.oracle.com/forums/thread.jspa?threadID=1323298
stackoverflow.com/questions/6614544/how-…on-using-jdbc-driver
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

saiki replied the topic: Re: SQL files execute : Incorrect syntax near ‘go’.
I Have set delimetr to GO in ant script

Then it worked

Tagged :

Compile sql file for syntax for error

saiki created the topic: Compile sql file for syntax for error
Hi,

How to Compile sql file for syntax error using ANT script.

Is there any possibility to compile through batch file.

I have 100 of sql file i dont want to create db and know the error in file.

Like java i want to compile it

rajeshkumar replied the topic: Re: Compile sql file for syntax for error
One way – exec method where you can mysqld and do whatever you want.
ant.apache.org/manual/Tasks/exec.html

Another way
www.roseindia.net/tutorials/ant/AntScriptCreateMysqlTable.shtml

Please try any of these and let me if you have any issues in script.
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

saiki replied the topic: Re: Compile sql file for syntax for error
Currently we are creating database through ant script only from CI. We do this build for every 8hrs.

Problem is b4 running the build we are deleting the existing database and then creating the new DB with same name. If there are any syntax error in the sql file the build fails and then it takes some time to fix it.

Idea is to compile sql (Check for syntax error) file for every 3hrs rather than executing and creating new DB and data ?

Tagged :

Can you create a list of files in Apache ant without using touch tasks

rajeshkumar created the topic: Can you create a list of files in Apache ant without using touch tasks
Can you create a list of files in Apache ant without using touch tasks?
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Apache ant interview questions

rajeshkumar created the topic: Apache ant interview questions
Links to all Apache Ant Task – ant.apache.org/manual/tasklist.html

Question 1. Write a ant build.xml and call one batch file from build.xml. batch file should create one directory.

Question 2. Write a ant build.xml which should copy the files and folders from another and create a tar file.

Question 3. Linux – Write a ant build.xml which should create 5 files and five folders and change the file permission to all files to 644 and folder to 755.

Question 4. Write a two build.xml named with “build1.xml” and “build2.xml”. Each build.xml will compile one java program but build2.xml should be called from build1.xml.

Question 5. Go through all these questions mentioned in the url below and try to find an answer and provide your answer as part of comments.
www.scmgalaxy.com/index.php?option=com_k…d-answers&Itemid=120
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

sribhavani_u replied the topic: Apache ant interview questions
Question1
========



Question2
=========







Question 3
=========





files created







Folders created










permissions changed files:644 folders:755

Question4
=========
q4build1










q4build2



nineetha replied the topic: Apache ant interview questions
QUESTION 1



[/b]

QUESTION 2









QUESTSION 3























QUESTION 4 target









rajeshkumar replied the topic: Apache ant interview questions
Good work. I checked last week and its nice.
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Sample Apache ant assignment – try it out

rajeshkumar created the topic: Sample Apache ant assignment – try it out
Clone the prject- github.com/scmgalaxy/helloworld-java-ant

Duplicate 10 source file from HelloWorld.java
Create a directory called “mybuild”
Clean all 10 java class files if exist
compile only 5 java files
Copy rest 5 files under folder called “no-need-to-compile”
create package of jar / war of the compiled files
Note: must use echo in all programs
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

crystal2904 replied the topic: Sample Apache ant assignment – try it out





































rajeshkumar replied the topic: Sample Apache ant assignment – try it out
There are some issues in terms of understanding the requirement but its a good start to you.
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Sample Apache ant project for begginers

rajeshkumar created the topic: Sample Apache ant project for begginers
Pre-
1. clone the src code from – github.com/scmgalaxy/Javatest1
2. Create a proper build structure via ant

Write a two build.xml –
One(Name of the file – Build.xml)
Second(Name of the file – myfile.xml)

You should do the following things in build.xml
1. copy the src file from clone folder to build folder
2. change the permission of file to current user
3. create a build folder strcuture needed. use your knowledge
4. Comiple the source code
5. Call build file – myfile.xml

You should do the following things in myfile.xml
1. Zip the compiled file.
2. Create a jar file.
3. Delete the .class file
4. Sleep for 10 sec
5. create a directory using exec.(Not ant tasks)
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

harsha924 replied the topic: Sample Apache ant project for begginers
Hi Rajesh,

Here is my assignment.

Regards,
Harsha

File Attachment:
File Name: MyAntProje…rsha.zip
File Size:5 KB
MyAntProject-Harsha

Tagged :

Apache Ant Interview Questions and Answers

rajeshkumar created the topic: Apache Ant Interview Questions and Answers
Please provide answers for the all following questions here…
www.scmgalaxy.com/scm/general/interview-…ons-and-answers.html
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn