You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by alexlehm <al...@gmail.com> on 2014/06/17 21:34:23 UTC

Running plugin with "own" classloader for slf4j in maven 3.2

Until Maven 3.0.x it was possible to run plugins that use slf4j with a
configuration of slf4j chosen by the project files (e.g. slf4j log4j binding
or a simplelogging config in the project), since Maven wasn't using slf4j
itself. Now in 3.2, the slf4j classes are loaded by Maven and so use the
ones that are stored in the lib and config dirs of Maven.

It is possible to remove the slf4j related files from maven and use other
ones instead, but I would prefer it if I could select the binding inside the
project. I assume that this requires some kind of classpath change to force
the plugin to use a new instance of slf4j and use the files select in the
project, but I have no idea how to do that (or if it is possible at all).

(the plugin I am currently using is vertx-maven-plugin, which basically runs
the whole project inside Maven)





--
View this message in context: http://maven.40175.n5.nabble.com/Running-plugin-with-own-classloader-for-slf4j-in-maven-3-2-tp5796426.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Running plugin with "own" classloader for slf4j in maven 3.2

Posted by alexlehm <al...@gmail.com>.
When I include logback in the project, it just keeps using the simple logger,
there is no message about multiple bindings.



You can swap slf4j-simple against Logback if you like. As far as I know, 
plugins are isolated aren't they? Does SLF4J report duplicate bindings 
if you try so?





--
View this message in context: http://maven.40175.n5.nabble.com/Running-plugin-with-own-classloader-for-slf4j-in-maven-3-2-tp5796426p5796487.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Running plugin with "own" classloader for slf4j in maven 3.2

Posted by Michael Osipov <mi...@apache.org>.
Am 2014-06-17 21:34, schrieb alexlehm:
> Until Maven 3.0.x it was possible to run plugins that use slf4j with a
> configuration of slf4j chosen by the project files (e.g. slf4j log4j binding
> or a simplelogging config in the project), since Maven wasn't using slf4j
> itself. Now in 3.2, the slf4j classes are loaded by Maven and so use the
> ones that are stored in the lib and config dirs of Maven.
>
> It is possible to remove the slf4j related files from maven and use other
> ones instead, but I would prefer it if I could select the binding inside the
> project. I assume that this requires some kind of classpath change to force
> the plugin to use a new instance of slf4j and use the files select in the
> project, but I have no idea how to do that (or if it is possible at all).

You can swap slf4j-simple against Logback if you like. As far as I know, 
plugins are isolated aren't they? Does SLF4J report duplicate bindings 
if you try so?

M


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Running plugin with "own" classloader for slf4j in maven 3.2

Posted by alexlehm <al...@gmail.com>.
Thanks, I will take a look how to implement that.


I've seen 3 people ask about this thus far but making this mechanism
configurable for servers that need to run inside Maven is not high on my
priority list.

Can you not just fork and then use the runtime as it would be launched in
production. Running app servers inside Maven in general I don't think is the
best model.





--
View this message in context: http://maven.40175.n5.nabble.com/Running-plugin-with-own-classloader-for-slf4j-in-maven-3-2-tp5796426p5796493.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Running plugin with "own" classloader for slf4j in maven 3.2

Posted by Jason van Zyl <ja...@takari.io>.
I've seen 3 people ask about this thus far but making this mechanism configurable for servers that need to run inside Maven is not high on my priority list.

Can you not just fork and then use the runtime as it would be launched in production. Running app servers inside Maven in general I don't think is the best model.

On Jun 17, 2014, at 3:34 PM, alexlehm <al...@gmail.com> wrote:

> Until Maven 3.0.x it was possible to run plugins that use slf4j with a
> configuration of slf4j chosen by the project files (e.g. slf4j log4j binding
> or a simplelogging config in the project), since Maven wasn't using slf4j
> itself. Now in 3.2, the slf4j classes are loaded by Maven and so use the
> ones that are stored in the lib and config dirs of Maven.
> 
> It is possible to remove the slf4j related files from maven and use other
> ones instead, but I would prefer it if I could select the binding inside the
> project. I assume that this requires some kind of classpath change to force
> the plugin to use a new instance of slf4j and use the files select in the
> project, but I have no idea how to do that (or if it is possible at all).
> 
> (the plugin I am currently using is vertx-maven-plugin, which basically runs
> the whole project inside Maven)
> 
> 
> 
> 
> 
> --
> View this message in context: http://maven.40175.n5.nabble.com/Running-plugin-with-own-classloader-for-slf4j-in-maven-3-2-tp5796426.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
http://twitter.com/takari_io
---------------------------------------------------------

happiness is like a butterfly: the more you chase it, the more it will
elude you, but if you turn your attention to other things, it will come
and sit softly on your shoulder ...

-- Thoreau