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

No ANSI color output from Maven in console

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • maven-plugin
    • None
    • Jenkins 2.235.4 on Windows

      With a standard Maven job, I'm not getting ANSI color output from Maven in the console output (Web UI) despite calling Maven with -Dstyle.color=always and having MAVEN_OPTS with -Djansi.force=true. This is with Maven 3.5.4 and 3.6.3, I do get color output when switching to old Maven 3.0.4, which unconditionally outputs some ANSI sequences.

      I'm at a loss what to try further and what could be the cause of the problem.

      Example console ouput from a build, not showing any color:

      Parsing POMs
      Modules changed, recalculating dependency graph
      Established TCP socket on 28403
      [workspace] $ D:\Build\Tools\Java\JDKs\jdk1.8.0/bin/java -Dorg.apache.maven.global-settings=C:\Users\continteg\.m2\settings.xml -Djansi.force=true -cp D:\.j\plugins\maven-plugin\WEB-INF\lib\maven35-agent-1.13.jar;D:\Build\Tools\Java\maven\apache-maven-3.6.3\boot\plexus-classworlds-2.6.0.jar;D:\Build\Tools\Java\maven\apache-maven-3.6.3/conf/logging jenkins.maven3.agent.Maven35Main D:\Build\Tools\Java\maven\apache-maven-3.6.3 D:\.j\war\WEB-INF\lib\remoting-4.3.jar D:\.j\plugins\maven-plugin\WEB-INF\lib\maven35-interceptor-1.13.jar D:\.j\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.13.jar 28403
      <===[JENKINS REMOTING CAPACITY]===>channel started
      Executing Maven:  -B -f D:\.j\jobs\MyProject\workspace\pom.xml clean install -Dstyle.color=always
      [INFO] Scanning for projects...

      Note that the following does output color, so the problem is really with Maven's own output not generating color:

                  <plugin>
                      <groupId>com.github.genthaler</groupId>
                      <artifactId>beanshell-maven-plugin</artifactId>
                      <version>1.4</version>
                      <executions>
                          <execution>
                              <phase>initialize</phase>
                              <goals>
                                  <goal>run</goal>
                              </goals>
                              <configuration>
                                  <script><![CDATA[
                                      print("\u001b[1;31mBold Red\u001b[0m");
                                  ]]></script>
                              </configuration>
                          </execution>
                      </executions>
                  </plugin>

       

       

            Unassigned Unassigned
            nmatt Niklas Matthies
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: