Created attachment 1174774 [details] log4j2.xml Description of problem: Maven 3 added colorized logging support via log4j2. However, the default installation of maven does not add log4j-slf4j (slf4j binding to log4j2) or an appropriate log4j2.xml file for colorized output. Worse, the way maven loads its dependencies (symlinks in /usr/share/maven/lib/* and /usr/share/maven/lib/ext/*) make it difficult for users to configure colorization without those settings being clobbered by an RPM update (because it's a classpath decision which isn't set in /etc). The solution is to: 1. create /etc/maven/logging/log4j2.xml (attached) 2. install log4j-slf4j.noarch 3. remove the symlink at /usr/share/maven/lib/slf4j_simple.jar 4. add symlinks (in /usr/share/maven/lib or /usr/share/maven/lib/ext) to each of $(build-classpath log4j/log4j-api log4j/log4j-core log4j/log4j-slf4j-impl slf4j/ext) Additionally, there's an annoying bug in Maven 3.3.3 which gives a warning when switching to colorized output: https://issues.apache.org/jira/browse/MNG-5961 Version-Release number of selected component (if applicable): maven-3.3.3-3.fc23.noarch
(In reply to Christopher Tubbs from comment #0) > Maven 3 added colorized logging support via log4j2. However, the default > installation of maven does not add log4j-slf4j (slf4j binding to log4j2) or > an appropriate log4j2.xml file for colorized output. Maven upstream is currently working on adding out-of-the-box colorization in next major release (3.4.0). Maybe you can just wait for it? > Worse, the way maven loads its dependencies (symlinks in > /usr/share/maven/lib/* and /usr/share/maven/lib/ext/*) make it difficult for > users to configure colorization without those settings being clobbered by an > RPM update (because it's a classpath decision which isn't set in /etc). There are multiple ways of customizing Maven installation by editing config files, either globally or only for specific users (doesn't even require root access). If you want equivalent of globally adding JARs to lib/ or lib/ext/ then you can simply edit /etc/m2.conf and list arbitrary JARs there. This config file is marked as %config(noreplace), so it won't be updated by RPM. You don't need to remove slf4j-simple.jar - SLF4J warnings about multiple bindings can be avoided by using more advanced Maven class loading tricks, like creating separate class realm "log4j" and making "plexus.core" import classes from it. Example m2.conf is attached. Let me know if you need more information. > Additionally, there's an annoying bug in Maven 3.3.3 which gives a warning > when switching to colorized output: > https://issues.apache.org/jira/browse/MNG-5961 This one I can patch in Fedora.
Created attachment 1174813 [details] Example m2.conf
(In reply to Mikolaj Izdebski from comment #1) > Maven upstream is currently working on adding out-of-the-box colorization in > next major release (3.4.0). Maybe you can just wait for it? Sure can. I didn't see any other open bugs about it. This can certainly wait for 3.4.0. I have patched my own system in the meantime, and that works well enough for me. (In reply to Mikolaj Izdebski from comment #2) > Created attachment 1174813 [details] > Example m2.conf Thanks, but without removing the slf4j-simple, won't slf4j complain about multiple bindings on the classpath?
(In reply to Christopher Tubbs from comment #3) > Thanks, but without removing the slf4j-simple, won't slf4j complain about > multiple bindings on the classpath? No, separate class realm is created specifically to avoid this warning. Classes imported from other realms (log4j) shadow classes from current realm (plexus.core).
Maven 3.4.0 snapshot available in rawhide (f26) already has out-of-the-box colorized logging. We don't plan to submit the snapshot to stable Fedoras. For those, please use the workaround provided.