Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • src/main/resources
  • src/test/resources
  • uPortal's uportal-portlets-overlay/PortletName/src/main/resources folder (bundled portlets only)

Maven Configuration

Approach 1 (easiest and strongly recommended): Remove log4j and commons-logging using provided scope

Use provided scope. This has the advantage of being quick and easy, but when running unit tests your IDE, e.g. Eclipse, will still place commons-logging.jar on your projet's class path as seen by your IDE. You would need to make sure that jcl-over-slf4j.jar is visible before commons-logging.jar by your IDE.  See http://www.slf4j.org/faq.html#excludingJCL.

...

Code Block
languagehtml/xml
    <properties>
...
        <logbackVersion>1.0.13</logbackVersion>
        <slf4jVersion>1.7.5</slf4jVersion>
    </properties>

<dependencyManagement>
...
            <!-- For sl4j/logback logging, see https://wiki.jasig.org/display/PLT/Logging+Best+Practices -->
            <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
                <version>1.1.2</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.17</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4jVersion}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jul-to-slf4j</artifactId>
                <version>${slf4jVersion}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>log4j-over-slf4j</artifactId>
                <version>${slf4jVersion}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jcl-over-slf4j</artifactId>
                <version>${slf4jVersion}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logbackVersion}</version>
                <scope>runtime</scope>
            </dependency>
            <!-- End of logging section -->
</dependencyManagement>
<dependencies>
...
        <!-- Logging section -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>
        <!-- End of logging section -->
</dependencies>
Approach 2 (not preferred)

Use the tree goal of the maven dependency plugin to see where these libraries are pulled in from. The end of the output will have a block that looks something like what you see below. The goal here is to find any common-logging or log4j dependencies, trace up to the root dependency and add an excludes block to it.

...