Pages

Thursday, July 9, 2015

Maven build in colours

Did you ever wonder, how you can make your maven build display colours?
In this quick post I will show you what you need to do to show colours in your maven build.

  1. Navigate to wherever you have installed maven and go into the lib folder ~/apache-maven-3.3.1/lib
  2. Delete slf4j-simple-1.7.5.jar
  3. Find on the internet the following jars and add them to the lib folder
    log4j-api-2.2.jar
    log4j-core-2.2.jar
    log4j-slf4j-impl-2.2.jar
    slf4j-ext-1.7.5.jar

  4. Get out of the lib folder and navigate into the conf folder once in there create a file called log4j2.xml and add the following content:

    <?xml version="1.0" encoding="UTF-8" ?>
    <Configuration>
      <Properties>
        <Property name="maven.logging.root.level">INFO</Property>
      </Properties>
      <Appenders>
        <Console name="console" target="SYSTEM_OUT">
          <PatternLayout pattern="%highlight{[%p] %msg%n%throwable}" />
        </Console>
      </Appenders>
      <Loggers>
        <Root level="${sys:maven.logging.root.level}">
          <Appender-ref ref="console"/>
        </Root>
      </Loggers>
    </Configuration>
     
  5. Go to the terminal and try building a maven project

No comments:

Post a Comment

Share with your friends