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

Environment variable not available for Maven build/POM parsing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • maven-plugin
    • None
    • Jenkins 1.397 master and slaves
      Linux Debian/Ubuntu

      Whereas setting environment variable in Jenkins configuration, nor in slave/node configuration, it seems unavailable to Maven:
      ANDROID_HOME=/opt/build/tools/android/

      The sample configuration (attached file) requires Android SDK to succeed, but even without it, you should be able to encounter the following issue:

      Parsing POMs
      ERROR: Failed to parse POMs
      hudson.util.IOException2: remote file operation failed: /home/hudsonslave/tmp/workspace/android-5.4 at hudson.remoting.Channel@71211a9c:thorin
      at hudson.FilePath.act(FilePath.java:752)
      at hudson.FilePath.act(FilePath.java:738)
      at hudson.maven.MavenModuleSetBuild$RunnerImpl.parsePoms(MavenModuleSetBuild.java:698)
      at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:531)
      at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:420)
      at hudson.model.Run.run(Run.java:1362)
      at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:405)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:145)
      Caused by: hudson.remoting.ProxyException: hudson.maven.MavenModuleSetBuild$MavenExecutionException: org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
      [ERROR] 'dependencies.dependency.systemPath' for com.google.android:android-sdk-nx:jar must specify an absolute path but is ${env.ANDROID_HOME}/platforms/android-8/android.jar @ line 23, column 19

      I tried to set ANDROID_HOME from different places, the only working workaround is to use Parameterized Build plugin.
      When locally building that project on my computer, "export ANDROID_HOME=/path/to/..." is enough.

      I also encountered that issue with freestyle projects where the fix was to set the export at the beginning of the Shell command.

        1. config.xml
          3 kB
          Julien Carsique

            olamy Olivier Lamy
            jcarsique Julien Carsique
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: