Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-13917

Artifactory plugin libraries affecting the path used during an Ant build

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • artifactory-plugin
    • None
    • Linux (CentOS 6)

      We have a job using an Ant script to perform the build. One of the targets in this script generates instrumented classes to enable us to generate a Cobertura coverage report.

      As part of our set of standard libraries, we include various jars from the slf4j suite. When we enable the Artifactory plugin for this job, the Cobertura Ant target fails, because of an incompatible set of jars being used. The snippet of output below is generated with verbose logging from the VM:

      12:19:40 cobertura-instrumented-src-classes:
      12:19:40 [Loaded net.sourceforge.cobertura.ant.CommonMatchingTask from file:/opt/jenkins/jobs/data-processing/workspace/test-lib/cobertura-1.9.4.1.jar]
      12:19:40 [Loaded net.sourceforge.cobertura.ant.InstrumentTask from file:/opt/jenkins/jobs/data-processing/workspace/test-lib/cobertura-1.9.4.1.jar]
      12:19:40 [Loaded net.sourceforge.cobertura.ant.MergeTask from file:/opt/jenkins/jobs/data-processing/workspace/test-lib/cobertura-1.9.4.1.jar]
      12:19:40 [Loaded net.sourceforge.cobertura.ant.CheckTask from file:/opt/jenkins/jobs/data-processing/workspace/test-lib/cobertura-1.9.4.1.jar]
      12:19:40 [Loaded net.sourceforge.cobertura.ant.ReportTask from file:/opt/jenkins/jobs/data-processing/workspace/test-lib/cobertura-1.9.4.1.jar]
      12:19:40 [Loaded net.sourceforge.cobertura.ant.Ignore from file:/opt/jenkins/jobs/data-processing/workspace/test-lib/cobertura-1.9.4.1.jar]
      12:19:40 [Loaded net.sourceforge.cobertura.ant.IgnoreBranches from file:/opt/jenkins/jobs/data-processing/workspace/test-lib/cobertura-1.9.4.1.jar]
      12:19:40 [Loaded net.sourceforge.cobertura.ant.IncludeClasses from file:/opt/jenkins/jobs/data-processing/workspace/test-lib/cobertura-1.9.4.1.jar]
      12:19:40 [Loaded net.sourceforge.cobertura.ant.ExcludeClasses from file:/opt/jenkins/jobs/data-processing/workspace/test-lib/cobertura-1.9.4.1.jar]
      12:19:40 [Loaded org.apache.tools.ant.taskdefs.ImportTask from file:/opt/apache-ant-1.8.1/lib/ant.jar]
      12:19:40 [Loaded net.sourceforge.cobertura.util.CommandLineBuilder from file:/opt/jenkins/jobs/data-processing/workspace/test-lib/cobertura-1.9.4.1.jar]
      12:19:40 [Loaded org.apache.log4j.Category from file:/opt/jenkins/jobs/data-processing/workspace/test-lib/log4j-over-slf4j-1.6.4.jar]
      12:19:40 [Loaded org.apache.log4j.Logger from file:/opt/jenkins/jobs/data-processing/workspace/test-lib/log4j-over-slf4j-1.6.4.jar]

      • 12:19:40 [Loaded org.slf4j.MarkerFactory from file:/opt/jenkins/plugins/artifactory/WEB-INF/lib/slf4j-api-1.5.8.jar]
        12:19:40 [Loaded org.apache.tools.ant.util.DateUtils from file:/opt/apache-ant-1.8.1/lib/ant.jar]

      The line prefixed with * shows the problem; the slf4j-api-1.5.8.jar is being loaded from the artifactory plugin directory. This is an older version than that supplied with our project which is 1.6.4 - and this is causing a problem when the compilation step occurs.
      When we run this from the command line using ant directly we can see that the correct jar from within our project is loaded.

      I'm afraid I don't understand fully how the addition of plugins affects the build environment technically, but I assume that the Artifactory plugin has been able to modify the environment/build path somehow to ensure that it's available at the appropriate time. Unfortunately this seems to cause problems if newer libraries are needed elsewhere.

      We can work around this by using the Ant/Ivy/Artifactory integration from the build script directly, but it would be good to be able to do this from Jenkins and simplify our scripts.

            yossis yossis
            camden Camden Holt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: