ant

Calling ant target in known xml file from within an Ant Task

六月ゝ 毕业季﹏ 提交于 2020-02-04 04:04:47
问题 I'm writing an Ant Task: public class MyTask extends Task { public void execute() { .... } } Now I'm wondering whether it is possible for me to call a target that exists in another known xml file from within the above execute() method? Something like: public void execute() { AntCaller.call("anotherBuildFile.xml", "someTarget"); } 回答1: You are on the right track. If you wanted to all another task from XML, you would use <ant> (since it is another file.) You can call a task from Java only if

Calling ant target in known xml file from within an Ant Task

*爱你&永不变心* 提交于 2020-02-04 04:03:53
问题 I'm writing an Ant Task: public class MyTask extends Task { public void execute() { .... } } Now I'm wondering whether it is possible for me to call a target that exists in another known xml file from within the above execute() method? Something like: public void execute() { AntCaller.call("anotherBuildFile.xml", "someTarget"); } 回答1: You are on the right track. If you wanted to all another task from XML, you would use <ant> (since it is another file.) You can call a task from Java only if

Calling ant target in known xml file from within an Ant Task

久未见 提交于 2020-02-04 04:03:46
问题 I'm writing an Ant Task: public class MyTask extends Task { public void execute() { .... } } Now I'm wondering whether it is possible for me to call a target that exists in another known xml file from within the above execute() method? Something like: public void execute() { AntCaller.call("anotherBuildFile.xml", "someTarget"); } 回答1: You are on the right track. If you wanted to all another task from XML, you would use <ant> (since it is another file.) You can call a task from Java only if

Ant task to check if a database (connection) exists?

妖精的绣舞 提交于 2020-02-03 16:49:13
问题 is there a possibility in ANT to check whether a database (connection) exists or not without failing the build? For example: <target name="check-database-available"> <sql classpath="${oracle.jar}" driver="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@${my.db.host}:${my.db.port}:${my.db.sid}" userid="${my.db.user}" password="${my.db.pw}" onerror="continue" errorproperty="exit.status"> select * from dual; </sql> <echo message="### exit status = ${exit.status}" /> </target> This will always

Ant task to check if a database (connection) exists?

柔情痞子 提交于 2020-02-03 16:46:20
问题 is there a possibility in ANT to check whether a database (connection) exists or not without failing the build? For example: <target name="check-database-available"> <sql classpath="${oracle.jar}" driver="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@${my.db.host}:${my.db.port}:${my.db.sid}" userid="${my.db.user}" password="${my.db.pw}" onerror="continue" errorproperty="exit.status"> select * from dual; </sql> <echo message="### exit status = ${exit.status}" /> </target> This will always

Ant task to check if a database (connection) exists?

微笑、不失礼 提交于 2020-02-03 16:45:45
问题 is there a possibility in ANT to check whether a database (connection) exists or not without failing the build? For example: <target name="check-database-available"> <sql classpath="${oracle.jar}" driver="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@${my.db.host}:${my.db.port}:${my.db.sid}" userid="${my.db.user}" password="${my.db.pw}" onerror="continue" errorproperty="exit.status"> select * from dual; </sql> <echo message="### exit status = ${exit.status}" /> </target> This will always

trouble using replaceregexp when replacing string DIR location

纵饮孤独 提交于 2020-02-03 10:49:28
问题 I am having trouble in doing this. there is 1 batch file with this line: set TEST_DIR=C:\temp\dir1 I just want to set some new value to TEST_DIR But, when I use in my ant script, it escapes forward slashes and gives this result: set TEST_DIR=C:homedir2 Instead, I want to give it: set TEST_DIR=C:\home\dir2 I am using this command: <replaceregexp file="${MT_BATCH_FILE_LOCATION}\myfile.bat" match="TEST_DIR=C:\\temp\\dir1" replace="TEST_DIR=C:\home\dir2" byline="true" /> 回答1: You can get the

Ant gets stuck while building runnable jar

我们两清 提交于 2020-02-02 15:45:43
问题 it's me again. I've been trying to create java project into a runnable jar using ant script. This is my build.xml <project name="simple-app" basedir="." default="main"> <property name="src.dir" value="src" /> <property name="build.dir" value="build" /> <property name="classes.dir" value="${build.dir}/classes" /> <property name="jar.dir" value="${build.dir}/jar" /> <property name="lib.dir" value="lib" /> <property name="main-class" value="app.App" /> <path id="classpath"> <fileset dir="${lib

Ant gets stuck while building runnable jar

自作多情 提交于 2020-02-02 15:42:47
问题 it's me again. I've been trying to create java project into a runnable jar using ant script. This is my build.xml <project name="simple-app" basedir="." default="main"> <property name="src.dir" value="src" /> <property name="build.dir" value="build" /> <property name="classes.dir" value="${build.dir}/classes" /> <property name="jar.dir" value="${build.dir}/jar" /> <property name="lib.dir" value="lib" /> <property name="main-class" value="app.App" /> <path id="classpath"> <fileset dir="${lib

Propagating exit code from exec'd batch file back to ant

99封情书 提交于 2020-02-02 03:05:10
问题 I need to call sbt from ant. I'm doing this with the "exec" task as follows: <target name="publish-jar"> <exec executable="sbt.bat" failonerror="true"> <arg value="publish"/> </exec> </target> I need the ant task to "fail" if the sbt task fails, which is why failonerror="true" is being used. However, this does not work. When the sbt task fails, ant does not report a failed build. This looks like the problem discussed here: Ant exec resultproperty is not working. The suggested workaround is to