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

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

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

          [JENKINS-8543] Maven 2/3 project with MAVEN_OPTS in Node Properties does not work

          tfnico added a comment -

          In the Maven2/3 job, configuring MAVEN_OPTS works as expected, so I assume this is specific for node properties. A bit like it was in #JENKINS-4030 - so obviously this has worked in the past.

          tfnico added a comment - In the Maven2/3 job, configuring MAVEN_OPTS works as expected, so I assume this is specific for node properties. A bit like it was in # JENKINS-4030 - so obviously this has worked in the past.

          I also have this problem, with Jenkins 1.413. I will try the suggestion with MAVEN_OPTS=${MAVEN_OPTS} tomorrow.

          Manuel Doninger added a comment - I also have this problem, with Jenkins 1.413. I will try the suggestion with MAVEN_OPTS=${MAVEN_OPTS} tomorrow.

          Indra Gunawan added a comment -

          I am getting the same problem with Jenkins 1.455. I tried setting the MAVEN_OPTS to ${MAVEN_OPTS} in the maven2/3 type job and add node's Environment variables:

          MAVEN_OPTS = -Xms512m -Xmx512m -XX:MaxPermSize=256m -Dmaven.repo.local=${XWT_MVN_LOCAL_REPO}

          still:

          [xwt] $ java -Xms512m -Xmx512m -XX:MaxPermSize=256m -Dmaven.repo.local=/auto/nmtg-hudson11-sjc/hudson/conf.sjc-nmtgci-04/xwt-mvn-local-repo -cp /scratch/hudson_slave_sjc-nmtgci-04/maven-agent.jar:/scratch/hudson_slave_sjc-nmtgci-04/classworlds.jar hudson.maven.agent.Main /auto/cwtools/maven/sjc-nmtgci-01/apache-maven-2.2.1/ /scratch/hudson_slave_sjc-nmtgci-04/slave.jar /scratch/hudson_slave_sjc-nmtgci-04/maven-interceptor.jar 46752 /scratch/hudson_slave_sjc-nmtgci-04/maven2.1-interceptor.jar
          <===[JENKINS REMOTING CAPACITY]===>channel started
          Executing Maven: -B -f /scratch/hudson_slave_sjc-nmtgci-04/workspace/1.7.3.x-xwt-test/xwt/pom.xml -Dmaven.repo.local=/scratch/hudson_slave_sjc-nmtgci-04/workspace/1.7.3.x-xwt-test/.repository clean deploy

          -Indra

          Indra Gunawan added a comment - I am getting the same problem with Jenkins 1.455. I tried setting the MAVEN_OPTS to ${MAVEN_OPTS} in the maven2/3 type job and add node's Environment variables: MAVEN_OPTS = -Xms512m -Xmx512m -XX:MaxPermSize=256m -Dmaven.repo.local=${XWT_MVN_LOCAL_REPO} still: [xwt] $ java -Xms512m -Xmx512m -XX:MaxPermSize=256m -Dmaven.repo.local=/auto/nmtg-hudson11-sjc/hudson/conf.sjc-nmtgci-04/xwt-mvn-local-repo -cp /scratch/hudson_slave_sjc-nmtgci-04/maven-agent.jar:/scratch/hudson_slave_sjc-nmtgci-04/classworlds.jar hudson.maven.agent.Main /auto/cwtools/maven/sjc-nmtgci-01/apache-maven-2.2.1/ /scratch/hudson_slave_sjc-nmtgci-04/slave.jar /scratch/hudson_slave_sjc-nmtgci-04/maven-interceptor.jar 46752 /scratch/hudson_slave_sjc-nmtgci-04/maven2.1-interceptor.jar <=== [JENKINS REMOTING CAPACITY] ===>channel started Executing Maven: -B -f /scratch/hudson_slave_sjc-nmtgci-04/workspace/1.7.3.x-xwt-test/xwt/pom.xml -Dmaven.repo.local=/scratch/hudson_slave_sjc-nmtgci-04/workspace/1.7.3.x-xwt-test/.repository clean deploy -Indra

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

              Created:
              Updated: