pedrocgsousa
pedrocgsousa

Reputation: 417

Maven non-interactive mode (batch) prevent's project extensions loading

I'm trying to use Takari SmartBuilder in a Maven project under Jenkins. After testing it locally everything was working perfectly, but in Jenkins the Takari extension is not loaded.

After some investigation I found that maven's "-B" option order was preventing the projects extensions to load.

Not loading extensions:

mvn -B -f <project-name>/pom.xml clean install -X

Loading extensions:

mvn -f <project-name>/pom.xml -B clean install -X

Extensions are set in the root project folder under .mvn/extensions.xml

<?xml version="1.0" encoding="UTF-8"?>
<extensions>
  <extension>
    <groupId>io.takari.maven</groupId>
    <artifactId>takari-smart-builder</artifactId>
    <version>0.4.0</version>
  </extension>
  <extension>
    <groupId>io.takari.aether</groupId>
    <artifactId>takari-concurrent-localrepo</artifactId>
     <version>0.0.7</version>
  </extension>
  <extension>
    <groupId>io.takari.aether</groupId>
    <artifactId>aether-connector-okhttp</artifactId>
    <version>1.0.1-alpha</version>
  </extension>
</extensions>

Versions:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: /opt/maven-versions/apache-maven-3.3.9
Java version: 1.7.0_65, vendor: Oracle Corporation
Java home: /opt/java-versions/jdk1.7.0_65/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-327.13.1.el7.x86_64", arch: "amd64", family: "unix"

Upvotes: 2

Views: 590

Answers (1)

upperlimit
upperlimit

Reputation: 35

I believe I am facing a similar issue. see https://issues.jenkins.io/browse/JENKINS-70357

It seems that the Jenkins Maven Integration Plugin is injecting the -B parameter unconditionally and for a good reason I am afraid.

However, either with or without interactive mode enabled, the extensions are loaded successfully (from lib/ext though), which proves that interactive mode does not control extensions in any way.

Also, using MavenJob offers some substantial advantages, like triggering downstream builds etc., which cannot be used with FreeStyleJob, making use of MavenJob necessary for certain development environments.

Upvotes: 0

Related Questions