Failed to locate org.apache.tools.ant.Main

Hi Team,

I am following the CICD demo video and started to create build and deploy, But I am getting below error.

Checking out Revision 11347dd42bd8ea49e305c9c0c3a74e98f3656f0a (refs/remotes/origin/master)
Commit message: “Create Jenkinsfile.unix”

git config core.sparsecheckout # timeout=10
git checkout -f 11347dd42bd8ea49e305c9c0c3a74e98f3656f0a # timeout=10
git rev-list --no-walk 11347dd42bd8ea49e305c9c0c3a74e98f3656f0a # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] sh

  • /opt/softwareagM107/common/lib/ant/bin/ant -DSAGHome=/opt/softwareagM107 -DSAG_CI_HOME=/opt/CICD/BUILD_PIPELINE_SOURCE -DprojectName=NEW_PIPELINE_PROJECT build
    Failed to locateorg.apache.tools.ant.Main
    ant.home: /opt/softwareagM107/common/lib/ant
    Classpath: /opt/softwareagM107/common/lib/ant/lib/ant-launcher.jar:/opt/softwareagM107/common/lib/ant/lib/ant-antlr.jar:/opt/softwareagM107/common/lib/ant/lib/ant-apache-bcel.jar:/opt/softwareagM107/common/lib/ant/lib/ant-apache-bsf.jar:/opt/softwareagM107/common/lib/ant/lib/ant-apache-log4j.jar:/opt/softwareagM107/common/lib/ant/lib/ant-apache-oro.jar:/opt/softwareagM107/common/lib/ant/lib/ant-apache-regexp.jar:/opt/softwareagM107/common/lib/ant/lib/ant-apache-resolver.jar:/opt/softwareagM107/common/lib/ant/lib/ant-apache-xalan2.jar:/opt/softwareagM107/common/lib/ant/lib/ant-commons-logging.jar:/opt/softwareagM107/common/lib/ant/lib/ant-commons-net.jar:/opt/softwareagM107/common/lib/ant/lib/ant-imageio.jar:/opt/softwareagM107/common/lib/ant/lib/ant-jai.jar:/opt/softwareagM107/common/lib/ant/lib/ant-javamail.jar:/opt/softwareagM107/common/lib/ant/lib/ant-jdepend.jar:/opt/softwareagM107/common/lib/ant/lib/ant-jmf.jar:/opt/softwareagM107/common/lib/ant/lib/ant-jsch.jar:/opt/softwareagM107/common/lib/ant/lib/ant-junit.jar:/opt/softwareagM107/common/lib/ant/lib/ant-junit4.jar:/opt/softwareagM107/common/lib/ant/lib/ant-junitlauncher.jar:/opt/softwareagM107/common/lib/ant/lib/ant-launcher.jar:/opt/softwareagM107/common/lib/ant/lib/ant-netrexx.jar:/opt/softwareagM107/common/lib/ant/lib/ant-swing.jar:/opt/softwareagM107/common/lib/ant/lib/ant-testutil.jar:/opt/softwareagM107/common/lib/ant/lib/ant-xz.jar:/opt/softwareagM107/common/lib/ant/lib/ant.jar
    Launcher JAR: /opt/softwareagM107/common/lib/ant/lib/ant-launcher.jar
    Launcher Directory: /opt/softwareagM107/common/lib/ant/lib
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] { (Deploy)
    Stage “Deploy” skipped due to earlier failure(s)
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] { (Test)
    Stage “Test” skipped due to earlier failure(s)
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] }
    [Pipeline] // withEnv
    [Pipeline] }
    [Pipeline] // node
    [Pipeline] End of Pipeline
    ERROR: script returned exit code 2
    Finished: FAILURE

A couple of thoughts:

  • You do not specify which video you are following.
  • /opt is not a suitable location for CI/CD activity. By convention it is reserved for optional software packages, typically (but not limited to) from commercial vendors. A better place would be somewhere in var and by default that is where Jenkins puts things (/var/lib/jenkins if I remember correctly). The easiest and in my view also cleanest approach is to stay with Jenkins’ defaults.

In terms of narrowing things down, I would recommend to run the ant command manually from a normal shell. If it works there, that will tell you that it something in the setup of Jenkins as opposed to some broader issue.

Good luck!

Hi Jahn,

I am following Demo: Continuous Integration with webMethods.

Demo: Continuous Integration with webMethods (youtube.com)

I installed ABE in the server.
I installed Jenkins in Node1, and my IS (ABE & deployer) server installed in Nod2. I configured agent node in Jenkins (agent Node2).
I am running Jenkins job in slave node.

Here I see ABE installed in the IS server and also, I see that /common/lib/ant/bin/ant directory available in my node2 server.
image