You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Derek <p5...@gmail.com> on 2016/06/02 19:02:26 UTC

Jenkins and maven.config usage

I have been unable to get Jenkins to run maven in such a way that it
honors the .mvn/maven.config file.  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 (property is not set to value in maven.config).

Any ideas why 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>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org