Jenkins Cannot find executable for ANT - ant

I'm using the automatic installation option for Ant but still jenkins complains that it cannot find the executable. Am I missing something? I have given the path to the ant version we use. It has successfully downloaded and unpacked it on the server but it still complains it can't find the executable.

Did you install Ant? Is it in Jenkin's PATH? If not, Jenkins cannot use the default version of Ant.
However, if you go into the Jenkins configuration page, you can install various versions of Ant. For example, you may want to install the latest version of Ant, and Ant 1.5 for that one project that cannot use any version of Ant beyond 1.5:
When you define your project, you can select the version of Ant you want to use. When you select that you want to Invoke Ant as a build step, you are given a drop down menu of what version of Ant you want to use. The first is the Default which is the Ant version found in your PATH. However, if you've gone into Jenkins configuration and downloaded other versions of Ant, you can use one of those instead.

I think is more easy to you install ant manually , or you need check the jenkins log file for detailed errors

Found what I missed. I had to add the name of the directory it unpacks the ant file to in the
"Subdirectory of extracted archive" field. Forgot to mention we are using a fairly old version of ant. (1.7.0).

Related

Why is org-netbeans-modules-java-j2seproject-copylibstask.jar required failed ant build

When doing an ant build (thought jenkins) for a test project, I get the below error. As this test project will be deployed in tomcat why does the build require a netbeans specific module
Obviously I can add the jar file to a path in jenkins and then continue the build, but want to know why it needs a netbeans specific jar?
Is it because the project setup in Netbeans is wrong?
Thanks in advance.
Tony
======Error below here =========
var/lib/jenkins/workspace/DeployTest2/nbproject/build-impl.xml:797: The libs.CopyLibs.classpath property is not set up.
This property must point to
org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part
of NetBeans IDE installation and is usually located at
/java/ant/extra folder.
Either open the project in the IDE and make sure CopyLibs library
exists or setup the property manually. For example like this:
ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar

xjc with annox running from command prompt

I have tried to run a example from the website http://confluence.highsource.org/display/J2B/Annotate+Plugin#AnnotatePlugin-Activation. The very first schema provided in the webpage and I saved it as schema.xsd under c:\jaxb folder. Then, I ran the command 'xjc -extension schema.xsd' from command prompt and I get the similar error. Apparently xjc doesn't seem to understand this url http://annox.dev.java.net. How do I solve this?
You have to add the annotate plugin with all the dependencies to the classpath. See this Ant build file for what dependencies are
You have to activate the plugin using -Xannotate switch
Here's a sample Ant project. I'll assemble a command-line example for the next version.

Include ant libs from within the build file

My problem is the following:
I would like to use the propertyregex task in ant. The project I am working on is built on various different servers and I don't want to configure (install the ant-nodeps.jar) every server. The source needs to include everything, that is not installed on the system by default.
So now I would need to add the ant-nodeps.jar to the ant classpath from within the build file. Does somebody know how to do that?
Cheers,
Robert
The propertyregex task is part of ant-contrib and can be installed as part of your build using Apache ivy
Checkout the following example, which demonstrates how to download and use the "for" task (also from the ant-contrib project):
Problems getting my ANT builds to work after OS upgrade
The one downside is that ivy does not come pre-packaged with ANT, so the following answer has a tip on how to bootstrap your ANT builds. Once ivy is started it can be used to pull down everything else your build needs.
Ivy fails to resolve a dependency, unable to find cause
Update
While I understand you requirement to have no change on the target platforms, it's a very difficult problem to solve if you must also match several old versions of the build software. I have found incompatibilities between the latest ANT and 5 year old versions like 1.7 (ANT 1.6.5 is now 8 years old....)
What I do is install a very limited number of ANT versions on my Jenkins slave nodes. Build jobs can then only choose from these and then use ivy to download all other 3rd party software dependencies (This setup emulates how you'd manage a set of Maven projects).
I suspect you're using ANT to run your deployments? If that is the case I would suggest switching to something like Groovy, which can be deployed as a single jar file and can pull down dependencies on the fly, using Grape.

cannot be found: com/jcraft/jsch/UserInfo

I am trying to use the Ant <scp> task in my buildfile. It gives me an error every time I run the target:
cannot be found: com/jcraft/jsch/UserInfo
I have read some posts that talk about having this issue with Ant 1.7. Some of the posts are talking about removing the ant-jsch.jar files from the ant_home lib. Unfortunately I can't do that as the ant_home is common across lot of other projects and I can't remove or update any jar files from the lib directory.
Is there a way that I can solve this issue purely using Ant configuration?
ant-jsch.jar contains ssh related tasks developed by Apache Ant team, while jsch.jar contains the jsch library which is the dependency of those ssh tasks.
So do a little check: check if jsch.jar is in your $ANT_HOME/lib and also check if the jar contains UserInfo.class.
If one of above happens, download the latest version of jsch.jar and put it in $ANT_HOME/lib.
I am currently using Ant 1.8.4 with a jsch.jar downloaded last year without any problem.
Update:
Check this page first:
http://ant.apache.org/manual/install.html#optionalTasks
Please note that <scp> and other ssh tasks (the ant-jsch.jar) are included in the Ant binary distribution by default. You don't need to write <taskdef> to use <scp> because it is included in Ant's lib directory by default. I recommend you to put jsch.jar in that directory with the following points:
These ssh tasks don't support classpath def, that is to say, you can't define a <classpath> pointing to jsch.jar and then reference to it in an ssh task.
Also you can put jsch.jar in any directory included in your system's CLASSPATH environment variable, but it is not a good practice.
We usually put a task and its dependency in the same directory.

Can not compile Nutch1.4 with ant

all
I'm trying to deploy Nutch1.4 to Hadoop cluster(following this page). I got some problems when compiling Nutch with ant.
problem 1
When I run ant command, I got the following error:
/home/xenserver/apache-nutch-1.4-bin/build.xml:71: invalid Date syntax in "01/25/1971 2:00 pm"
I remove attribute "datetime" from line 71 in file build.xml and run ant again. Then I got another problem.
problem 2
The error is:
/home/xenserver/apache-nutch-1.4/build.xml:412: syntax errors in ivy file: java.text.ParseException: http://java.sun.com/xml/jaxp/properties/schemaLanguage in file:/home/xenserver/apache-nutch-1.4/ivy/ivy.xml
at org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser$Parser.parse(XmlModuleDescriptorParser.java:273)
........
What's wrong with the steps above? Is there any tutorial for compiling Nutch1.4?
Need your help.Thanks in advance.
For compiling nutch 1.4, all you have to do is run ant clean deploy from the nutch directory. The output is created in the directory named 'runtime' with 2 folders: one for local mode and other one for cluster mode.
please check the date settings and ant installation on your machine. I think that is casing the issue. Also have you tampered/ edited /home/xenserver/apache-nutch-1.4/ivy/ivy.xml ? Please check that file too.
EDIT:
There is some problem with the build file when executed on your Linux box.
Check these out: this and this.
These are the things that you should verify on your setup:
java version and ant version : dont use old ones. get the latest ones or ones that are compatible with your nutch release. FYI: for nutch-1.4 I am using apache-ant-1.8.3 and java jdk1.6.0_18. This combination works perfectly fine with me.
Check that you have installed a JDK and not a JRE
Check if your JAVA_HOME environment variable point to the JDK. System PATH variable must have $JAVA_HOME/bin and $ANT_HOME/bin appended to it. ANT_HOME variable must point to the ant installation directory.
Can you successfully run normal ant targets on any other build files ? try out with small ant build file.
Still facing the same issue, run ant command with -v option. This will provide more information about the error faced.
eg.
ant -v clean deploy

Resources