groovy / GMavenPlus

A rewrite of GMaven, a Maven plugin for Groovy
Other
282 stars 35 forks source link

Help with GMavenPlus / MavenSimpleLogger problems #214

Closed nathanmarz closed 2 years ago

nathanmarz commented 2 years ago

I'm having trouble turning off logging when using mvn gplus:shell. I don't have any logging xml or properties files on the classpath, and when checking the class of org.slf4j.LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME) I discovered MavenSimpleLogger was configured. It appears this is what's printing the log messages. Is GMavenPlus configuring this? Is there a way to turn it off?

nathanmarz commented 2 years ago

I also found that providing a log4j2.properties file on the classpath does not change this behavior, even after confirming with -Dlog4j2.debug that log4j was picking up the configuration file.

nathanmarz commented 2 years ago

I discovered running the shell with mvn gplus:shell -Dorg.slf4j.simpleLogger.defaultLogLevel=ERROR fixes the problem. Is there a way to configure the pom.xml to automatically include that config when running just mvn gplus:shell?

keeganwitt commented 2 years ago

The shell mojo by default includes both your project's test classpath and the classpath of GMavenPlus itself, so that you can easily add dependencies to the plugin to use in your scripts or as a test. That's probably why MavenSimpleLogger is on the classpath. You can control this with includeClasspath.

I don't know of a way to specify default Java arguments to a plugin invocation because those are passed into java itself and merely passed along into anything invoked in that jvm instance.

nathanmarz commented 2 years ago

Thanks, includeClasspath did the trick.