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

Maven 2/3 project with MAVEN_OPTS in Node Properties does not work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • maven-plugin
    • None
    • Hudson 1.393, Maven 2.2.1

      I want to specify a certain repositoryLocation for a Hudson slave node.

      I've defined a Node Property MAVEN_OPTS=-Dmaven.repo.local=/srv2/hudson/m2-repo

      I've attached a tiny example pom that simply prints the MAVEN_OPTS.

      I first run this project as a normal Maven 2/3 project. Instead of installing to the custom repo defined in MAVEN_OPTS, artifacts are installed to the default /srv/hudson/.m2/repository:

      [INFO] Executing tasks

      main:
           [echo] Ant says hello!
           [echo] MAVEN_OPTS are -Dmaven.repo.local=/srv2/hudson/m2-repo
      [INFO] Executed tasks
      [INFO] [install:install {execution: default-install}]
      [INFO] Installing /srv2/hudson/workspace/foo-core/pom.xml to /srv/hudson/.m2/repository/com/tfnico/examples/foo-core/1.0-SNAPSHOT/foo-core-1.0-SNAPSHOT.pom
      

      So, the MAVEN_OPTS variable is in there, but Maven does not use it.

      However, running a freestyle project, calling mvn clean install outputs this:

      main:
           [echo] Ant says hello!
           [echo] MAVEN_OPTS are -Dmaven.repo.local=/srv2/hudson/m2-repo
      [INFO] Executed tasks
      [INFO] [install:install {execution: default-install}]
      [INFO] Installing /srv2/hudson/workspace/flexo-foo/pom.xml to /srv2/hudson/m2-repo/com/tfnico/examples/foo-core/1.0-SNAPSHOT/foo-core-1.0-SNAPSHOT.pom
      

      The MAVEN_OPTS are here correctly used, and the custom repo is used.

            Unassigned Unassigned
            tfnico tfnico
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: