I believe that simply using log4j 1.2.15 will also work (that's the minimum log4j that works with the latest slf4j I believe).
-Spencer --- On Mon, 7/25/11, Alexander von Zitzewitz <[email protected]> wrote: From: Alexander von Zitzewitz <[email protected]> Subject: Re: [gradle-user] Strange log4j classpath problem in Gradle Plugin To: [email protected] Date: Monday, July 25, 2011, 2:40 PM For the record and for anybody facing similar problems: I solved it by implementing velocity's LogChute interface so that velocity does not implicitly assume that log4j has to be used. Best regards Alexander On Jul 25, 2011, at 11:31 AM, Alexander von Zitzewitz wrote: > Hi, > > I just wrote my first gradle plugin to integrate a specific parser generator > into our builds. The parser generator uses velocity 1.6.2 and velocity has a > dependency to log4j 1.2.12. > > Now as soon as the parser generator initializes velocity I am getting the > following exception: > > Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: > java.lang.NoSuchMethodError: org.apache.log4j.Logger.setAdditivity(Z)V > at > org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:443) > at > org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:431) > at > org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63) > ... 29 more > Caused by: java.lang.NoSuchMethodError: > org.apache.log4j.Logger.setAdditivity(Z)V > at > org.apache.velocity.runtime.log.Log4JLogChute.initAppender(Log4JLogChute.java:126) > at > org.apache.velocity.runtime.log.Log4JLogChute.init(Log4JLogChute.java:85) > at > org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:157) > at > org.apache.velocity.runtime.log.LogManager.updateLog(LogManager.java:255) > at > org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:795) > at > org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:250) > at > org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:114) > at org.apache.velocity.app.Velocity.init(Velocity.java:79) > at > com.hello2morrow.javapg.grammar.lalr.NodeClassGenerator.generateNodeClasses(NodeClassGenerator.java:27) > > > In my build.gradle I even added log4j as compile time dependency: > > apply plugin: "groovy" > > repositories > { > mavenCentral() > > mavenRepo urls: "http://maven.hello2morrow.com/repository" > mavenRepo urls: "http://repo.gradle.org/gradle/libs" > } > > dependencies > { > compile group: 'log4j', name: 'log4j', version: '1.2.12' > compile group: 'com.hello2morrow', name: 'javapg', version: '3.0' > compile gradleApi() > groovy localGroovy() > } > > > But that does not help. Googling the exception brings an association with > slf4j log4j bridge jar. Is that jar used by gradle? Is there any way to make > velocity run within the context of a gradle plugin? > > Thanks for any help in advance. And kudos for the gradle team for creating > this marvelous gem. > Best regards > > Alexander von Zitzewitz > > hello2morrow Inc. > 1 (877) 294-6327 > > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > Best regards Alexander von Zitzewitz hello2morrow Inc. 1 (877) 294-6327 --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
