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

Environment variable not available for Maven build/POM parsing

    • 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.

          [JENKINS-8865] Environment variable not available for Maven build/POM parsing

          Code changed in jenkins
          User: Olivier Lamy
          Path:
          maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
          http://jenkins-ci.org/commit/core/a5d9528c8fddf0c1ce2fe98fd33750a952033641
          Log:
          [FIXED JENKINS-8865] Environment variable not available for Maven build/POM parsing.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Olivier Lamy Path: maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java http://jenkins-ci.org/commit/core/a5d9528c8fddf0c1ce2fe98fd33750a952033641 Log: [FIXED JENKINS-8865] Environment variable not available for Maven build/POM parsing.

          Code changed in jenkins
          User: Olivier Lamy
          Path:
          changelog.html
          http://jenkins-ci.org/commit/core/24309c6cc22f7efa07c4befa24778f3939b115d7
          Log:
          changelog for JENKINS-8865

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Olivier Lamy Path: changelog.html http://jenkins-ci.org/commit/core/24309c6cc22f7efa07c4befa24778f3939b115d7 Log: changelog for JENKINS-8865

          dogfood added a comment -

          Integrated in jenkins_main_trunk #545
          [FIXED JENKINS-8865] Environment variable not available for Maven build/POM parsing.
          changelog for JENKINS-8865

          Olivier Lamy : a5d9528c8fddf0c1ce2fe98fd33750a952033641
          Files :

          • maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java

          Olivier Lamy : 24309c6cc22f7efa07c4befa24778f3939b115d7
          Files :

          • changelog.html

          dogfood added a comment - Integrated in jenkins_main_trunk #545 [FIXED JENKINS-8865] Environment variable not available for Maven build/POM parsing. changelog for JENKINS-8865 Olivier Lamy : a5d9528c8fddf0c1ce2fe98fd33750a952033641 Files : maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java Olivier Lamy : 24309c6cc22f7efa07c4befa24778f3939b115d7 Files : changelog.html

          Code changed in jenkins
          User: Olivier Lamy
          Path:
          src/main/java/hudson/maven/MavenModuleSetBuild.java
          http://jenkins-ci.org/commit/maven-plugin/36c11f588bcc73873b583abe62053e45c4773a0f
          Log:
          [FIXED JENKINS-8865] Environment variable not available for Maven build/POM parsing.

          Originally-Committed-As: a5d9528c8fddf0c1ce2fe98fd33750a952033641

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Olivier Lamy Path: src/main/java/hudson/maven/MavenModuleSetBuild.java http://jenkins-ci.org/commit/maven-plugin/36c11f588bcc73873b583abe62053e45c4773a0f Log: [FIXED JENKINS-8865] Environment variable not available for Maven build/POM parsing. Originally-Committed-As: a5d9528c8fddf0c1ce2fe98fd33750a952033641

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

              Created:
              Updated:
              Resolved: