slf4j-log4j12 not packaged by maven with “runtime” scope

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

slf4j-log4j12 not packaged by maven with “runtime” scope

smallufo

I have a project managed by maven with slf4j-api-1.5.8 and log4j-1.2.14 dependencies.

In runtime , slf4j needs slf4j-log4j12-1.5.8.jar to "bridge" output to log4j.

So in pom.xml , I add this dependency :



  <dependencyManagement>
   
<dependencies>
       
<dependency>
           
<groupId>org.slf4j</groupId>
           
<artifactId>slf4j-log4j12</artifactId>
           
<version>1.5.8</version>
           
<type>jar</type>
           
<scope>runtime</scope>
       
</dependency>
   
</dependencies>
 
</dependencyManagement>


After building (war:war) , log4j-1.2.14.jar and slf4j-api-1.5.8.jar are both added to WEB-INF/lib directory , but I cannot find slf4j-log4j12-1.5.8.jar within !

I then use "Dependency Hierarchy" to check the resolved dependencies , but cannot find slf4j-log4j12 (so it's not packaged into WEB-INF/lib , well , maybe because its "runtime" scope)

I don't know what's going wrong here ? How should I correctly package  slf4j-log4j12-1.5.8.jar to the war ?

environment : maven 3.0-beta1 , m2-eclipse-0.10.0.20100209

Reply | Threaded
Open this post in threaded view
|

Re: slf4j-log4j12 not packaged by maven with “runtime” scope

Fred Bricon
You declared slf4j-log4j12 in the dependencyManagement section of your pom.xml.
That means, if a slf4j-log4j12 was to be found in all your actual dependencies, then the version you specified would be used.

Either move your current slf4j-log4j12 <dependency> block in your project's <dependencies> section, or, if you wanna keep it in the <dependencyManagement> section, simply add the following to your <dependencies> :
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            <dependency>

If you notice an odd behavior in m2eclipse, I strongly suggest you test your projects' configuration with maven CLI beforehand, to see if the problem comes from your pom config or m2eclipse.

regards,

Fred Bricon


On Mon, May 31, 2010 at 12:37 PM, smallufo <[hidden email]> wrote:

I have a project managed by maven with slf4j-api-1.5.8 and log4j-1.2.14 dependencies.

In runtime , slf4j needs slf4j-log4j12-1.5.8.jar to "bridge" output to log4j.

So in pom.xml , I add this dependency :



  <dependencyManagement>
   
<dependencies>
       
<dependency>
           
<groupId>org.slf4j</groupId>
           
<artifactId>slf4j-log4j12</artifactId>
           
<version>1.5.8</version>
           
<type>jar</type>
           
<scope>runtime</scope>
       
</dependency>
   
</dependencies>
 
</dependencyManagement>


After building (war:war) , log4j-1.2.14.jar and slf4j-api-1.5.8.jar are both added to WEB-INF/lib directory , but I cannot find slf4j-log4j12-1.5.8.jar within !

I then use "Dependency Hierarchy" to check the resolved dependencies , but cannot find slf4j-log4j12 (so it's not packaged into WEB-INF/lib , well , maybe because its "runtime" scope)

I don't know what's going wrong here ? How should I correctly package  slf4j-log4j12-1.5.8.jar to the war ?

environment : maven 3.0-beta1 , m2-eclipse-0.10.0.20100209