I have been unable to get Jenkins to run maven in such a way that it
honors the .mvn/maven.config properties file (introduced in maven
3.3).  I have tried running with a Maven project type and a Freestyle
project type.  If I execute maven from the command line on the Jenkins
slave in the workspace, it works fine.  Executing maven from Jenkins
against the pom, builds the project but the maven.config is never
picked up like it should be.

Any ideas why I Maven run from Jenkins does not pickup maven.config?

Using
Jenkins ver. 1.642.1
Maven 3.3.9
Maven Plugin 2.7.1

Example:
.mvn/maven.config
-Dmyproperty=HelloWorld

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>my.test</groupId>
  <artifactId>jenkins-maven-config</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <properties>
    <myproperty>ERROR: Not Set</myproperty>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.4.0</version>
        <executions>
          <execution>
            <id>echo parameter</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>echo ${myproperty}</executable>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAM0rHLz9Hm9zVLeMzfHKnxkkTxC6311vsk-L%2Bhv1EoHmMyzXiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to