Detecting System Architecture in Ant

Is there a way to find what architecture an ant script is running on? Currently I have the following: <echo>System = ${os.name} ${os.arch}</echo> which produces: [echo] System = Linux i386 This not correct, as I am running 64 bit linux. Thank you

How do I code an ant Task that takes an arbitrary Mapper?

Generally speaking, any ant task which accepts a <mapper> will also accept several tags designating particular mappers: <identitymapper>, <regexmapper>, etc. But if you're writing your own task, you are supposed to supply a method for each possible tag that may exist inside your task. You don't want to add separate addConfiguredMapper(), addConfiguredIdentityMapper(), addConfiguredRegexMapper(), etc. methods. How do you easily set up a custom ant Task to take any arbitrary M

Ant Testing Macrodef Attribute without IF

I am attempting to remove all lines that begin with log if a macrodef attribute is set to prod (example below). I plan on using replaceregexp to remove all lines beginning with log. However, I am not sure how to test if an attribute is set to a specific value, besides using the if task. I would like to not introduce any non-core Ant tasks to perform this, but I can't come up with any other solutions. Do I have any other options besides using the if-task? Thanks <macrodef name="setBuild

How to macro-ify ant targets?

I want to be able to have different targets doing nearly the same thing, as so: ant build <- this would be a normal (default) build ant safari <- building the safari target. The targets look like this: <target name="build" depends="javac" description="GWT compile to JavaScript"> <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler"> <classpath> <pathelement location="src"/> <path refid="project.class.path"/>

ant + javac + properties

In an ant script, I would like to compile only certain packages e.g. com.example.some_package.foo com.example.some_package.bar This is what I want to do, but it doesn't seem to work, because property substitution doesn't seem to work in the <include> tag: <property name="ROOT_PKG_PATH" location="com/example/some_package"/> ... <target name="compile-client" depends="init"> <javac srcdir="${srcDir}" destdir="${buildDir}" debug="on"

Using Ant date properties?

I am using Ant to build a fileset. I only want to include files in the file set that have been modified after a specific date. (See below) Ideally I would like the below datetime value to be some sort of property that is equal to the create date of the build file. E.g. I only want files included in the fileset that where modified after the build file was created I cant use a static string because this build file will be checked out from subversion by multiple developers. <fileset dir="some-

ANT - javac compile failure due to cannot find symbol

I'm trying to compile ActionFactory.java file which imports one of my package, RegisterAction.java Here is the file structure: /com/masatosan/actions/register/RegisterAction.java /com/masatosan/redirector/ActionFactory.java According to the ANT output, I think ANT cannot find RegisterAction.java which is imported in ActionFactory.java It does compile successfully when I manually run javac on console so this must be some classpath setting that ANT is not looking at. I know I can add some j

How can I have the Ant JUnit task run all tests and then stop the rest of the build if any test has failed

I'm running JUnit via Ant using a target something like this: <target name="junit" depends="compile"> <mkdir dir="${report.dir}"/> <junit printsummary="yes" haltonfailure="yes" showoutput="yes" > <classpath> <path refid="classpath"/> <path location="${classes.dir}"/> </classpath> <formatter type="brief" usefile="false"/> <formatter type="xml"/> <batchtest fork="yes"

Clean Text Formatting in Apache Ant

Is there something in Apache Ant in helping to better format Text output from <echo>'s ? For example, my build scripts are formatted with tab spacing, and the tabbing is outputted in the output. I was wondering if there was something to help clean up the formatting without making my build script look untidy. Hope that makes sense, Steve

Ant task external program hangs

I am running the mqsicreatbar.exe program from ANT and it hangs after sometime. can someone please provide any help. The same command works fine in command line Ant Version: 1.8.2 OS version: Windows Server 2003 here is the code I have issue protected String runS(Commandline cmdline, String outputProperty) { //String outV = "opts.mb.runS.output" + i++; Project aProj = getProject(); ExecTask exe = (ExecTask) aProj.createTask("exec"); Commandline.Argu

Ant build.xml problems with JAR

When I let ant build the java project (with default operation "run") the programm starts normal. No warning or error. But when I run the JAR, built by ant, from a terminal (java -jar ...) everything looks fine, until I use any feature from our external libs (e.g. swingx, date chooser). A massive excption is thown: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at org.jdesktop.swingx.plaf.basic.BasicMonthViewUI.getTraversableGridPositionAtLocation(BasicMonthViewUI.jav

How to avoid running ant tasks on source files that have not changed?

I have an ant task that executes some command on a list of files. I would like, on consecutive builds, to avoid from re-running the command on files that have passed the command with success and haven't changed. For example: (here the command is xmllint) <target name="xmllint-files"> <apply executable="xmllint"> <srcfile/> <fileset dir="." includes="*.xml"> <modified/> </fileset> </apply> </target>

Ant FTP task - cannot create type

Could someone help me with Ant? I want to deploy some files through FTP but i still can't due to error: Could not create type ftp due to java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClientConfig In ant lib directory I have: lrwxrwxrwx 1 root root ant-bootstrap.jar -> ../../java/ant-bootstrap.jar lrwxrwxrwx 1 root root ant-commons-net.jar -> ../../java/ant/ant-commons-net.jar lrwxrwxrwx 1 root root ant.jar -> ../../java/ant.jar lrwxrwxrwx 1 root root ant-launcher.jar ->

Ant: Iterating through an XML file's nodes

I have the following XML structure: <servers> <hostname>ABC01</hostname> <hostname>ABC02</hostname> </servers> I need to retrieve a file from each server, from a folder I know, attach it to an email and then send it. What would be the approach for this? Thanks.

Run selenium with Ant

I looked on Google and here on stackoverflow, but couldn't find it. I know it is possible, to start the selenium standalone server with an Ant script. I'm trying to do it now for a half of a day. The only thing what the script should do is: Start the selenium standalone sever Go to 1 web URL in Firefox shutdown

Ant Compiled classes are not included in generated Jar

I am creating a jar bundle using ant build script. The problem is that the .class files are not included in the generated .jar file. I have also tried the {build.dest} in making the jar, but with no effect. remaining all the files i require are in .jar file. Here is my build script <?xml version="1.0"?> <project name="TaskNodeBundle" default="all" basedir="."> <!-- Sets variables which can later be used. --> <!-- The value of a property is accessed via ${} -->

boolean getters using xjc and ant

I am working on a project which uses xjc to generate the java files from XSD. The problem I am facing is it generate Boolean getters as isXXX instead of getXXX. <target name="jaxb"> <delete dir="${generated-src}"/> <mkdir dir="${generated-src}"/> <xjc destdir="${generated-src}" extension="true"> <schema dir="${schema-source}" includes="*.xsd"/> <binding dir="${schema-source}" includes="*.xjb"/> </xjc> </target>

Ant Jenkins/Hudson JBoss Plugin wait after Startup?

I am starting the JBoss server through the Jenkins JBoss plugin. After that I am executing some Selenium tests through Ant target. Some of the first Selenium tests fail due to timeout, I am suspecting that the Ant test target is executed right after the JBoss has started, and the server has not properly finished the startup. Starting the server takes approximately 2 minutes. Is there a way to set a wait time after startup?

Ant How can I parse a file path and get its parent's parent's directory?

Using Ant - in a buildfile - how can I parse a file path and get its parent's parent's directory? <target name="test"> <property name="jar" value="D:\F\D\r\org\springframework\spring-beans\3.0.7.R\spring-beans.jar" /> <echo>${jar}</echo> </target> I want to get this result: D:\F\D\r\org\springframework\spring-beans

Display the output of an exec task in ant

I am scping files using the exec Ant task. It is working fine, but the output of the scp command is not displayed. Below is the code <target name="scp-jar" depends = "jar"> <exec executable="/usr/bin/scp"> <arg value="my.jar"/> <arg value="myserver:dir"/> </exec> </target> What changes I have to make to display the file progress output of the scp command?

Ant Delete fileset filenames, but in different directory

So I have a fileset containing files in one directory: <fileset id="modules" dir="${modules.dir}"> <include name="core*.jar"/> <include name="fileset*.jar"/> <include name="upgrader*.jar"/> <include name="hello*.jar"/> </fileset> However, these files are copied into the ${lib.dir}, i.e, the ${lib.dir} contains copies of core*.jar, fileset*.jar, etc. How do I delete these copied files? Also, please note I can't use external libraries like

Apache Ant - Hide/Secure Exec Task Arguments

I want to execute Ant with the verbose option but I don't want the arguments passed into the Exec task to be displayed in situations where they are sensitive (i.e. user/password). An example is where there's a connection to a database: <exec executable="/bin/sh" failonerror="true"> <arg line="/opt/blah/blah/bin/frmcmp_batch.sh Module=blah Userid=username/mypassword@blah Module_Type=blah"/> </exec> I don't want the arguments (specifically "Userid=username/mypassword@blah

Ant exec task and check using some ksh script

I'm facing a problem using Ant I'd like to check for the end of a long process, without using a nasty <sleep> command. In my Ant target, I'm launching <exec executable="my long process" /> When I'm manually checking for the end of the process, I'm using this following command : watch " "check ksh script" | grep "ONLINE" " When the grep returns something, it means my process has ended (because the check ksh script outputs ONLINE) How can I perform the same check in Ant ? I'm

Ant: javac task: path versus pathelement

I would like to know the difference between the following javac Ant tasks. <!-- Task 1 --> <javac destdir="${build}" classpath="classes.jar" debug="on"> <src path="${src}"/> <src> <pathelement path="${src2}"/> <pathelement path="${src3}"/> </src> </javac> <!-- Task 2 --> <javac destdir="${build}" classpath="classes.jar" debug="on"> <src path="${src}"/> <src path="${src2}"/> <src path="${src3}"/> &

Replace the token in file with contents of other file using ant script

I have 2 files input file and replace file. I want to replace a token(@@CONTENT_TO_REPLACE@@) in input file with all the contents of replace file. Input file: <amxdata_base:Enterprise xmlns:amxdata="http://tibco.com/amxadministrator/command/line/types" xmlns:amxdata_base="http://tibco.com/amxadministrator/command/line/types_base" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <!-- Enterprise level Substitution variables --> @@CONTENT_TO_REPLACE@@ &l

Ant Jenkins: Make file publicly available

I am creating files with a custom version number during the build that I want to be publicly available through http. Assuming I am building the project "MyTestApp", I want the version number text file I created to be available at a location like http://jenkins.company/job/MyTestApp/revision.txt Any idea how to achieve this?

How to organize tests sequence in ant or jenkins

I use selenium WebDriver with junit, ant and jenkins. I set up jenkins to use ant build.xml to run my tests. But currently I run only one tests. In build.xml I set variable which is used in each test. So to run test in Jenkins I set in Targets: build MyTest1 -Dvariable="value" I want to run all tests in sequence one after another. I try this: build MyTest1 -Dvariable="value" MyTest2 -Dvariable="value" But 2 tests began run in browser at the same time. How can I organize needed sequence.

IBM Worklight 6.1 - Ant build failed: Could not load definitions

I've upgraded my worklight server from v6.0 to v6.1. The target environment is Liberty and Oracle database. I've build a war for v6.1 and try to deploy it. it fails with following error message: [taskdef] Could not load definitions from resource com/worklight/ant/defaults.properties. It could not be found.

In Ant delete list of files only if they exists

I am trying to delete list of files using Ant 1.6.5 , but I have to put a condition that if only the file exists delete it or else throw a build failure error to user, I have got the below snipped from the forums here , but when i modify accordingly in my environment it is not working. <property name="file.list" value="test1.props,test2.props,test3.props"/> <target name="file.missing" depends="validate.dir"> <echo message = " The Filelist is : ${file.list} "/> <

Building ejb jar weblogic 103 and ANT

I am using wlappc command in ant script to build jar and I have weblogic.jar in classpath. ejb3Compile: [echo] "Compiling EJB" [wlappc] Created working directory: /var/tmp/appcgen_1423590774747_VMS.jar [wlappc] java.lang.RuntimeException: error in finding weblogic.Home [wlappc] at weblogic.Home.getInstance(Home.java:91) [wlappc] at weblogic.Home.getPath(Home.java:97) [wlappc] at weblogic.ejb.container.persistence.InstalledPersistence.setInstallationLocation(Inst

Ant replace property value by property name in a xml file

I need to replace property value in a xml file using the property name. Ex: <property name="test-name" value="default-value"/> I have a target to replace this value . i.e "default-value". User can run this target several times if he's given a wrong value for property test-name he can try again running target with correct value. Therefore i can not use regular expression to replace "default-value". I can only rely on property name. Is there a way to replace property value using it's nam

Ant How do i generate a junit report with fail

I have junit testscript that creates different and unique ID. So when it finds an existing ID or a wrong Id I want the test script report via ANT to show that it is failed for following record but passed for the rest of the records that are correct. @Test public void testCreateTrade() throws Exception driver.findElement(By.id("VIN")).clear(); driver.findElement(By.id("VIN")).sendKeys(vVin); String str = driver.getCu

Ant Script for converting multiple file formats using mappers- creating double extension files

I want to convert multiple file formats to a single file format. Example: D:\myrepo\rough has 3 files 1. abc.sql 2. def.xml 3. ghi.dmp I want them all to be converted to .txt using glob mappers. <?xml version ="1.0"?> <project name = "roughone" default="taget1"> <target name= "target1"> <move todir="D:\myrepo\rough"> <fileset dir="D:\myrepo\rough"> </fileset> <mapper type ="glob" from="*" to="*.txt"/> </move>

Ant Propertyregex to read a CSV line and assign fields to variables

I have a csv/txt file with below entries abc,123 xyz,678 ijk,921 I'm trying to read the file through for loop and assign first element to var1, and second to var2 var1=abc var2=123 I need to use these variables to perform some task and return back to the loop to read the next line of the file and assign new values. Below is what I have, and I'm not able to assign the variable <loadfile property="message" srcFile="test.txt" /> <target name="compile"> <for param="line" li

"Exception caught while parsing Xanitizer XML report file" : ParserConfigurationException occurs while running SonarQube Scanner for Ant Task

I'm trying to setup SonarQube with Xanitizer on my local machine so that the findings of the last generated Security Findings XML, get picked up by the SonarQube Plugin for Xanitizer so that it can display the results on the SonarQube server. The analysis of the files and the generation of the report is done manually from within the Xanitizer software. The XML file is generated under the parent unzipped directory of Xanitizer, and not inside the SonarQube or the Sonar Scanner directories. The

JMeter execute ant test local failed

I'm following JMeter wiki page of CommittingChanges which was updated. I'm running ant checkstyle ant package ant test Test Failed with error in differences from Bug52310.csv: BUILD FAILED C:\jmeter\jmeter\build.xml:2681: The following error occurred while executing th is line: C:\jmeter\jmeter\build.xml:2621: CSV Files are not identical. C:\jmeter\jmeter\bin\testfiles\Bug52310.csv ComputeIPAddr,200,OK,TG2 1-1,text,true HTTP-Request-HC31,200,OK,TG2 1-1,text,true HTTP-Reque

Copy an Ant argument list into a property

In Ant is there any way to do something like this: <arguments id="arg-list"> <arg value="arg1" /> <arg value="arg2" /> </arguments> <property name="prop1" refid="arg-list" /> I'm trying to write a macro for psexec and I'm looking for a nice way to pass in the argument list. I know that you can do something similar with classpaths... Thanks!

Which Ant property contains the CWD when the ant script is run?

I don't want to get the basedir -- that appears to contain the build.xml script -- I want the CWD of the call to ant itself. Basically, I want to do this: $ cd /home/chrisr/projects/some_project $ ant -f ../../tools/ant-build-rules/library.xml build-library At this point, I need two things: The path to ant-build-rules in absolute form; this is currently found in the basedir property, so I'm set there. The path of some_project, in absolute form. This is what I don't know how to get. Whic

In ant, how to apply a target on a list of files (without ant-contrib)?

Basically, I would like to mimic apply task but instead of passing to it anexecutable, I would like to pass an ant task and come up with something like: <project> <target name="my-task"> <!--target definition--> <target/> <target name="my-task-on-files"> <apply task="my-task"> <srcfile/> <targetfile/> <fileset dir="." includes="*.xml"/> </apply> </target> </project> The

ant fileset dir exclude certain directory

There are many questions on this topic but none of the answers are solving my problem. Starting this thread again to get fresh input. I tried two different approaches for excluding B-dir and all its contents under A-dir/subdir. But none work. FYI, a-dir is under dir.src 1) <copy todir="${dir.classes}" excludes="A-dir/**/B-dir/**"> <fileset dir="${dir.src}" > <exclude name="**/*.java"/> </fileset> </copy> 2) <copy todir="${dir.classes}"> &

adding jars dynamically from build.xml ant

I created a jar file with dependencies(i.e wlclient.jar, wljmxclient.jar) added to manifest file Class-Path attribute. I get error saying "Unsupported protocol: t3", But if I place these jars in C:\apache-ant-1.8.3\lib folder, this executes with no errors. I am new to ant please help. The ant task for creating a jar file is given below. <jar destfile="projectpoc.jar" basedir="bin" excludes="**/Test.class"> <manifest> <attribute name="Class-Path"

How to start and stop jboss from apache ant build.xml file

I have make jar war EAR using ant and Hudson and store all files at some temp folder now I want to copy all war and ear files to jboss jboss/default/deploy folder using Apache ANT How can I do this?? Following is my master build file which call all other build.xml files and make jar war ear files but after making this all files this don't copy all any of the files to jboss/default/deploy folder <copy todir="${jbossdeploy.dir}" overwrite="yes"> <fileset dir="${class.dir}

FDT ANT tasks - exportAirApplication vs release.AirApplication

I'm struggling with customised ANT-driven AIR packaging under FDT 5.6.x . I've just upgraded from FDT 5.0.x and I'm struggling to rebuild by workflow. I had an ANT script which loaded current project properties (build numbers etc), injected them into an AIR properties.xml file and then packaged a version of the app using the fdt.release.AirApplication task, with a custom file name to indicate the release etc. I can see that there's been significant refactoring of the release packaging mechani

Ant Hot deploy project with a lot of static content in Weblogic

I have a Java EE application with a lot of static content: Javascript, images, css and such. Right now we are using weblogic plugin for eclipse to deploy our applications for testing purposes, but it's getting pretty slow and it's only going to get slower. Since we have a lot of javascript, it's often that we have to make small changes and test them in quick succession which is becoming a big headache. We also want to move away from using weblogic plugin on Eclipse. We want to find a solution t

Ant Convert ibatis to mybatis

I have run ibatis2mybatis tool to convert ibatis to mybatis and I get an error: [xslt] Transforming into D:\Program Files\ibatis2mybatis\destination [xslt] Processing D:\Program Files\ibatis2mybatis\source\SqlMapConfig.xml to D:\Program Files\ibatis2mybatis\destin ation\SqlMapConfig.xml [xslt] Loading stylesheet D:\Program Files\ibatis2mybatis\migrate.xslt [xslt] : Error! The markup declarations contained or pointed to by the document type declaration must be well-forme

Configure project name and version for sonar at jenkins in an ant project

I have a problem with the configuration in an ant project at jenkins with sonar. For to establish a ant project with sonar at Jenkins it's necessary to indicate the properties: sonar.projectVersion, sonar.projectName, sonar.projectKeys, sonar.binaries, sonar.libraries and sonar.sources. I would like knowing if it's possible to establish the projectVersion and projectName in the file build.xml or build.properties and to indicate in the sonar that it takes the value of these properties. For exampl

Ant optimal chain for resolve in ivy

I have some project's that integrates ivy, i publish my artifact in two possible repositories, local, that respond to a folder, and beta, that respond to a server where archiva is installed and where i share my jars with my colleague. Now the problem: i need to find a way to build a resolution chains that do this things: search between the various repository the latest.integration. retrieve that jar. if that jar is already in my cache do not have to download it. if the artifact in the cache h

Ant : sshexec outputproperty not working as expected

sshexec outputproperty not working as expected in Ant. Ant Version : 1.9.4 Command : <sshexec host="${Server}" username="${User}" Password="${Password}" trust="true" command="${cmd}" failonerror="true" outputproperty="sshexecOutput" /> <echo message="Value of outputproperty ${sshexecOutput}" />` Logs : [sshexec] Connecting to <Server_Name>:22 [sshexec] cmd : <SSHEXEC_COMMAN

  1    2   3   4   5   6  ... 下一页 最后一页 共 18 页