diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java index ee793505..0d04906f 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java @@ -315,7 +315,9 @@ protected synchronized void doCompile(final Set sources, final List classp // log compiled classes List classes = (List) invokeMethod(findMethod(compilationUnitClass, "getClasses"), compilationUnit); - getLog().info("Compiled " + classes.size() + " file" + (classes.size() != 1 ? "s" : "") + "."); + if (getLog().isInfoEnabled()) { + getLog().info("Compiled " + classes.size() + " file" + (classes.size() != 1 ? "s" : "") + "."); + } } /** @@ -343,7 +345,9 @@ protected Object setupCompilationUnit(final Set sources, final Class co getLog().debug("Adding Groovy to compile:"); Method addSourceMethod = findMethod(compilationUnitClass, "addSource", File.class); for (File source : sources) { - getLog().debug(" " + source); + if (getLog().isDebugEnabled()) { + getLog().debug(" " + source); + } invokeMethod(addSourceMethod, compilationUnit, source); } @@ -366,9 +370,13 @@ protected Object setupCompilerConfiguration(final File compileOutputDirectory, f Object compilerConfiguration = invokeConstructor(findConstructor(compilerConfigurationClass)); if (configScript != null) { if (!configScript.exists()) { - getLog().warn("Configuration script file (" + configScript.getAbsolutePath() + ") doesn't exist. Ignoring configScript parameter."); + if (getLog().isWarnEnabled()) { + getLog().warn("Configuration script file (" + configScript.getAbsolutePath() + ") doesn't exist. Ignoring configScript parameter."); + } } else if (groovyOlderThan(GROOVY_2_1_0_BETA1)) { - getLog().warn("Requested to use configScript, but your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support it (must be " + GROOVY_2_1_0_BETA1 + " or newer). Ignoring configScript parameter."); + if (getLog().isWarnEnabled()) { + getLog().warn("Requested to use configScript, but your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support it (must be " + GROOVY_2_1_0_BETA1 + " or newer). Ignoring configScript parameter."); + } } else { Class bindingClass = classWrangler.getClass("groovy.lang.Binding"); Class importCustomizerClass = classWrangler.getClass("org.codehaus.groovy.control.customizers.ImportCustomizer"); @@ -382,7 +390,9 @@ protected Object setupCompilerConfiguration(final File compileOutputDirectory, f List compilationCustomizers = (List) invokeMethod(findMethod(compilerConfigurationClass, "getCompilationCustomizers"), shellCompilerConfiguration); compilationCustomizers.add(importCustomizer); Object shell = invokeConstructor(findConstructor(groovyShellClass, bindingClass, compilerConfigurationClass), binding, shellCompilerConfiguration); - getLog().debug("Using configuration script " + configScript + " for compilation."); + if (getLog().isDebugEnabled()) { + getLog().debug("Using configuration script " + configScript + " for compilation."); + } invokeMethod(findMethod(groovyShellClass, "evaluate", File.class), shell, configScript); } } @@ -394,12 +404,16 @@ protected Object setupCompilerConfiguration(final File compileOutputDirectory, f if (previewFeatures) { if (isJavaSupportPreviewFeatures()) { if (groovyOlderThan(GROOVY_2_5_7) || (groovyAtLeast(GROOVY_2_6_0_ALPHA1) && groovyOlderThan(GROOVY_3_0_0_BETA1))) { - getLog().warn("Requested to use preview features, but your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support it (must be " + GROOVY_2_5_7 + "/" + GROOVY_3_0_0_BETA1 + " or newer. No 2.6 version is supported. Ignoring previewFeatures parameter."); + if (getLog().isWarnEnabled()) { + getLog().warn("Requested to use preview features, but your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support it (must be " + GROOVY_2_5_7 + "/" + GROOVY_3_0_0_BETA1 + " or newer. No 2.6 version is supported. Ignoring previewFeatures parameter."); + } } else { invokeMethod(findMethod(compilerConfigurationClass, "setPreviewFeatures", boolean.class), compilerConfiguration, previewFeatures); } } else { - getLog().warn("Requested to use to use preview features, but your Java version (" + getJavaVersionString() + ") doesn't support it. Ignoring previewFeatures parameter."); + if (getLog().isWarnEnabled()) { + getLog().warn("Requested to use to use preview features, but your Java version (" + getJavaVersionString() + ") doesn't support it. Ignoring previewFeatures parameter."); + } } } if (sourceEncoding != null) { @@ -415,13 +429,17 @@ protected Object setupCompilerConfiguration(final File compileOutputDirectory, f optimizationOptions.put("int", false); getLog().info("invokedynamic enabled."); } else { - getLog().warn("Requested to use to use invokedynamic, but your Java version (" + getJavaVersionString() + ") doesn't support it. Ignoring invokeDynamic parameter."); + if (getLog().isWarnEnabled()) { + getLog().warn("Requested to use to use invokedynamic, but your Java version (" + getJavaVersionString() + ") doesn't support it. Ignoring invokeDynamic parameter."); + } } } else { getLog().warn("Requested to use invokedynamic, but your Groovy version doesn't support it (must use have indy classifier). Ignoring invokeDynamic parameter."); } } else { - getLog().warn("Requested to use invokeDynamic, but your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support it (must be " + GROOVY_2_0_0_BETA3 + " or newer). Ignoring invokeDynamic parameter."); + if (getLog().isWarnEnabled()) { + getLog().warn("Requested to use invokeDynamic, but your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support it (must be " + GROOVY_2_0_0_BETA3 + " or newer). Ignoring invokeDynamic parameter."); + } } } if (parameters) { @@ -429,10 +447,14 @@ protected Object setupCompilerConfiguration(final File compileOutputDirectory, f if (isJavaSupportParameters()) { invokeMethod(findMethod(compilerConfigurationClass, "setParameters", boolean.class), compilerConfiguration, parameters); } else { - getLog().warn("Requested to use to use parameters, but your Java version (" + getJavaVersionString() + ") doesn't support it. Ignoring parameters parameter."); + if (getLog().isWarnEnabled()) { + getLog().warn("Requested to use to use parameters, but your Java version (" + getJavaVersionString() + ") doesn't support it. Ignoring parameters parameter."); + } } } else { - getLog().warn("Requested to use parameters, but your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support it (must be " + GROOVY_2_5_0_ALPHA1 + " or newer). Ignoring parameters parameter."); + if (getLog().isWarnEnabled()) { + getLog().warn("Requested to use parameters, but your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support it (must be " + GROOVY_2_5_0_ALPHA1 + " or newer). Ignoring parameters parameter."); + } } } if (groovyAtLeast(GROOVY_3_0_5)) { diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java index 172a6ab9..22129e46 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java @@ -313,14 +313,18 @@ protected void addGroovySources(final Set stubSources, final Class comp for (File stubSource : stubSources) { scriptExtensions.add(FileUtils.getFileExtension(stubSource)); } - getLog().debug("Detected Groovy file extensions: " + scriptExtensions + "."); + if (getLog().isDebugEnabled()) { + getLog().debug("Detected Groovy file extensions: " + scriptExtensions + "."); + } if (supportsSettingExtensions()) { invokeMethod(findMethod(compilerConfigurationClass, "setScriptExtensions", Set.class), compilerConfiguration, scriptExtensions); } getLog().debug("Adding Groovy to generate stubs for:"); Method addSource = findMethod(javaStubCompilationUnitClass, "addSource", File.class); for (File stubSource : stubSources) { - getLog().debug(" " + stubSource); + if (getLog().isDebugEnabled()) { + getLog().debug(" " + stubSource); + } if (supportsSettingExtensions()) { invokeMethod(addSource, javaStubCompilationUnit, stubSource); } else { @@ -346,7 +350,9 @@ protected boolean supportsSettingExtensions() { */ protected void logGeneratedStubs(File outputDirectory) { Set stubs = getStubs(outputDirectory); - getLog().info("Generated " + stubs.size() + " stub" + (stubs.size() != 1 ? "s" : "") + "."); + if (getLog().isInfoEnabled()) { + getLog().info("Generated " + stubs.size() + " stub" + (stubs.size() != 1 ? "s" : "") + "."); + } } /** @@ -361,7 +367,9 @@ protected void resetStubModifiedDates(final Set stubs) { for (File stub : stubs) { boolean success = stub.setLastModified(0L); if (!success) { - getLog().warn("Unable to set modified time on stub " + stub.getAbsolutePath() + "."); + if (getLog().isWarnEnabled()) { + getLog().warn("Unable to set modified time on stub " + stub.getAbsolutePath() + "."); + } } } } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyDocMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyDocMojo.java index 0631a2cd..3bbd203b 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyDocMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyDocMojo.java @@ -280,7 +280,9 @@ protected synchronized void doGroovyDocGeneration(final FileSet[] sourceDirector } if (groovyIs(GROOVY_1_6_0_RC1) || groovyIs(GROOVY_1_5_8)) { // Groovy 1.5.8 and 1.6-RC-1 are blacklisted because of their dependency on org.apache.tools.ant.types.Path in GroovyDocTool constructor - getLog().warn("Groovy " + GROOVY_1_5_8 + " and " + GROOVY_1_6_0_RC1 + " are blacklisted from the supported GroovyDoc versions because of their dependency on Ant. Skipping GroovyDoc generation."); + if (getLog().isWarnEnabled()) { + getLog().warn("Groovy " + GROOVY_1_5_8 + " and " + GROOVY_1_6_0_RC1 + " are blacklisted from the supported GroovyDoc versions because of their dependency on Ant. Skipping GroovyDoc generation."); + } return; } @@ -296,7 +298,9 @@ protected synchronized void doGroovyDocGeneration(final FileSet[] sourceDirector if (groovyAtLeast(GROOVY_3_0_0_ALPHA_4)) { System.setProperty("runtimeGroovydoc", "true"); } else { - getLog().warn("Requested to enable attaching GroovyDoc annotation, but your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support it (must be " + GROOVY_3_0_0_ALPHA_4 + " or newer). Ignoring enableGroovyDocAnnotation parameter."); + if (getLog().isWarnEnabled()) { + getLog().warn("Requested to enable attaching GroovyDoc annotation, but your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support it (must be " + GROOVY_3_0_0_ALPHA_4 + " or newer). Ignoring enableGroovyDocAnnotation parameter."); + } } } Properties docProperties = setupProperties(); @@ -310,7 +314,9 @@ protected synchronized void doGroovyDocGeneration(final FileSet[] sourceDirector GroovyDocTemplateInfo groovyDocTemplateInfo = new GroovyDocTemplateInfo(classWrangler.getGroovyVersion()); List groovyDocLinks = setupLinks(); if (groovyOlderThan(GROOVY_1_6_0_RC2)) { - getLog().warn("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support GroovyDoc documentation properties (docTitle, footer, header, displayAuthor, overviewFile, and scope). You need Groovy 1.6-RC-2 or newer to support this. Ignoring properties."); + if (getLog().isWarnEnabled()) { + getLog().warn("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support GroovyDoc documentation properties (docTitle, footer, header, displayAuthor, overviewFile, and scope). You need Groovy 1.6-RC-2 or newer to support this. Ignoring properties."); + } } // prevent Java stubs (which lack Javadoc) from overwriting GroovyDoc by removing Java sources @@ -353,7 +359,9 @@ protected Properties setupProperties() { properties.setProperty("privateScope", "true"); } } catch (IllegalArgumentException e) { - getLog().warn("Scope (" + scope + ") was not recognized. Skipping argument."); + if (getLog().isWarnEnabled()) { + getLog().warn("Scope (" + scope + ") was not recognized. Skipping argument."); + } } return properties; @@ -392,7 +400,9 @@ protected List setupLinks() throws ClassNotFoundException, InvocationTargetEx linksList.add(linkArgument); } } else { - getLog().warn("Requested to use GroovyDoc links, but your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support it (must be 1.5.2 or newer). Ignoring links parameter."); + if (getLog().isWarnEnabled()) { + getLog().warn("Requested to use GroovyDoc links, but your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support it (must be 1.5.2 or newer). Ignoring links parameter."); + } } } @@ -436,7 +446,9 @@ protected Object createGroovyDocTool(final Class groovyDocToolClass, final Cl groovyDocLinks ); if (sourceDirectories.size() > 1) { - getLog().warn("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support more than one GroovyDoc source directory (must be 1.6-RC-2 or newer). Only using first source directory (" + sourceDirectories.get(0) + ")."); + if (getLog().isWarnEnabled()) { + getLog().warn("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support more than one GroovyDoc source directory (must be 1.6-RC-2 or newer). Only using first source directory (" + sourceDirectories.get(0) + ")."); + } } } else { groovyDocTool = invokeConstructor(findConstructor(groovyDocToolClass, resourceManagerClass, String.class, String[].class, String[].class, String[].class), @@ -447,7 +459,9 @@ protected Object createGroovyDocTool(final Class groovyDocToolClass, final Cl defaultClassTemplates == null ? groovyDocTemplateInfo.defaultClassTemplates() : defaultClassTemplates ); if (sourceDirectories.size() > 1) { - getLog().warn("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support more than one GroovyDoc source directory (must be 1.6-RC-2 or newer). Only using first source directory (" + sourceDirectories.get(0) + ")."); + if (getLog().isWarnEnabled()) { + getLog().warn("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support more than one GroovyDoc source directory (must be 1.6-RC-2 or newer). Only using first source directory (" + sourceDirectories.get(0) + ")."); + } } } @@ -500,7 +514,9 @@ protected void generateGroovyDoc(final File outputDirectory, final Class groo getLog().debug("Adding sources to generate GroovyDoc for:"); if (getLog().isDebugEnabled()) { for (String groovyDocSource : groovyDocSources) { - getLog().debug(" " + groovyDocSource); + if (getLog().isDebugEnabled()) { + getLog().debug(" " + groovyDocSource); + } } } if (groovyAtLeast(GROOVY_1_6_0_RC2)) { @@ -520,7 +536,9 @@ protected void generateGroovyDoc(final File outputDirectory, final Class groo * @param outputDirectory The output directory to copy the stylesheet to */ protected void copyStylesheet(final File outputDirectory) { - getLog().info("Using stylesheet from " + stylesheetFile.getAbsolutePath() + "."); + if (getLog().isInfoEnabled()) { + getLog().info("Using stylesheet from " + stylesheetFile.getAbsolutePath() + "."); + } try { BufferedReader bufferedReader = null; BufferedWriter bufferedWriter = null; @@ -547,7 +565,9 @@ protected void copyStylesheet(final File outputDirectory) { FileUtils.closeQuietly(bufferedWriter); } } catch (IOException e) { - getLog().warn("Unable to copy specified stylesheet (" + stylesheetFile.getAbsolutePath() + ")."); + if (getLog().isWarnEnabled()) { + getLog().warn("Unable to copy specified stylesheet (" + stylesheetFile.getAbsolutePath() + ")."); + } } } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyMojo.java index 5f71a0d0..997907ea 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyMojo.java @@ -118,7 +118,9 @@ protected void logPluginClasspath() { sb.append(", "); } } - getLog().debug("Plugin classpath:\n" + sb.toString()); + if (getLog().isDebugEnabled()) { + getLog().debug("Plugin classpath:\n" + sb.toString()); + } } } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AddSourcesMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AddSourcesMojo.java index 2f35c906..a436c60b 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AddSourcesMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AddSourcesMojo.java @@ -55,7 +55,9 @@ public void execute() { */ protected void addSourcePath(final String path) { if (!project.getCompileSourceRoots().contains(path)) { - getLog().debug("Added source directory: " + path); + if (getLog().isDebugEnabled()) { + getLog().debug("Added source directory: " + path); + } project.addCompileSourceRoot(path); } } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AddStubSourcesMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AddStubSourcesMojo.java index 1bd1f330..6cc4063a 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AddStubSourcesMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AddStubSourcesMojo.java @@ -42,7 +42,9 @@ public class AddStubSourcesMojo extends AbstractGroovyStubSourcesMojo { */ @Override public void execute() { - getLog().debug("Added stub directory " + stubsOutputDirectory.getAbsolutePath() + " to project sources."); + if (getLog().isDebugEnabled()) { + getLog().debug("Added stub directory " + stubsOutputDirectory.getAbsolutePath() + " to project sources."); + } project.addCompileSourceRoot(stubsOutputDirectory.getAbsolutePath()); } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AddTestSourcesMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AddTestSourcesMojo.java index a700b362..3684961f 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AddTestSourcesMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AddTestSourcesMojo.java @@ -55,7 +55,9 @@ public void execute() { */ protected void addTestSourcePath(final String path) { if (!project.getTestCompileSourceRoots().contains(path)) { - getLog().debug("Added test source directory: " + path); + if (getLog().isDebugEnabled()) { + getLog().debug("Added test source directory: " + path); + } project.addTestCompileSourceRoot(path); } } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AddTestStubSourcesMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AddTestStubSourcesMojo.java index fa2960e8..7221a870 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AddTestStubSourcesMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AddTestStubSourcesMojo.java @@ -49,7 +49,9 @@ public class AddTestStubSourcesMojo extends AbstractGroovyStubSourcesMojo { @Override public void execute() { if (!skipTests) { - getLog().debug("Added test stub directory " + testStubsOutputDirectory.getAbsolutePath() + " to project test sources."); + if (getLog().isDebugEnabled()) { + getLog().debug("Added test stub directory " + testStubsOutputDirectory.getAbsolutePath() + " to project test sources."); + } project.addTestCompileSourceRoot(testStubsOutputDirectory.getAbsolutePath()); } } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/CompileMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/CompileMojo.java index 21f702ad..554ce3cd 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/CompileMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/CompileMojo.java @@ -62,7 +62,9 @@ public class CompileMojo extends AbstractCompileMojo { public void execute() throws MojoExecutionException { try { try { - getLog().debug("Project compile classpath:\n" + project.getCompileClasspathElements()); + if (getLog().isDebugEnabled()) { + getLog().debug("Project compile classpath:\n" + project.getCompileClasspathElements()); + } } catch (DependencyResolutionRequiredException e) { getLog().debug("Unable to log project compile classpath"); } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/CompileTestsMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/CompileTestsMojo.java index 5644260a..60bfe6c4 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/CompileTestsMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/CompileTestsMojo.java @@ -69,7 +69,9 @@ public void execute() throws MojoExecutionException { if (!skipTests) { try { try { - getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); + if (getLog().isDebugEnabled()) { + getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); + } } catch (DependencyResolutionRequiredException e) { getLog().debug("Unable to log project test classpath"); } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/ConsoleMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/ConsoleMojo.java index 018a7784..c66a9b48 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/ConsoleMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/ConsoleMojo.java @@ -74,7 +74,9 @@ public void execute() throws MojoExecutionException, MojoFailureException { classWrangler.logGroovyVersion(mojoExecution.getMojoDescriptor().getGoal()); try { - getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); + if (getLog().isDebugEnabled()) { + getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); + } } catch (DependencyResolutionRequiredException e) { getLog().debug("Unable to log project test classpath"); } @@ -142,10 +144,14 @@ protected void loadScript(Class consoleClass, Object console) throws Invocati if (consoleScriptFile.isFile()) { invokeMethod(loadScriptFile, console, consoleScriptFile); } else { - getLog().warn("consoleScript ('" + consoleScript + "') doesn't exist in project properties or as a file."); + if (getLog().isWarnEnabled()) { + getLog().warn("consoleScript ('" + consoleScript + "') doesn't exist in project properties or as a file."); + } } } else { - getLog().warn("consoleScript ('" + consoleScript + "') doesn't exist in project properties or as a file."); + if (getLog().isWarnEnabled()) { + getLog().warn("consoleScript ('" + consoleScript + "') doesn't exist in project properties or as a file."); + } } } } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/ExecuteMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/ExecuteMojo.java index f8503647..ee735707 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/ExecuteMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/ExecuteMojo.java @@ -118,7 +118,9 @@ protected synchronized void doExecute() throws MojoExecutionException { classWrangler.logGroovyVersion(mojoExecution.getMojoDescriptor().getGoal()); try { - getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); + if (getLog().isDebugEnabled()) { + getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); + } } catch (DependencyResolutionRequiredException e) { getLog().debug("Unable to log project test classpath"); } @@ -210,7 +212,9 @@ protected void executeScripts(final Class groovyShellClass, final Object shel // it's not a URL to a script, try as a filename File scriptFile = new File(script); if (scriptFile.isFile()) { - getLog().info("Running Groovy script from " + scriptFile.getCanonicalPath() + "."); + if (getLog().isInfoEnabled()) { + getLog().info("Running Groovy script from " + scriptFile.getCanonicalPath() + "."); + } Method evaluateFile = findMethod(groovyShellClass, "evaluate", File.class); invokeMethod(evaluateFile, shell, scriptFile); } else { @@ -242,7 +246,9 @@ protected void executeScripts(final Class groovyShellClass, final Object shel */ protected void executeScriptFromUrl(Class groovyShellClass, Object shell, String script) throws IOException, InvocationTargetException, IllegalAccessException { URL url = new URL(script); - getLog().info("Running Groovy script from " + url + "."); + if (getLog().isInfoEnabled()) { + getLog().info("Running Groovy script from " + url + "."); + } if (groovyAtLeast(GROOVY_1_7_0)) { Method evaluateUrlWithReader = findMethod(groovyShellClass, "evaluate", Reader.class); BufferedReader reader = null; diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/GenerateStubsMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/GenerateStubsMojo.java index 22d7dc5e..d595a98c 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/GenerateStubsMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/GenerateStubsMojo.java @@ -64,7 +64,9 @@ public void execute() throws MojoExecutionException { try { try { - getLog().debug("Project compile classpath:\n" + project.getCompileClasspathElements()); + if (getLog().isDebugEnabled()) { + getLog().debug("Project compile classpath:\n" + project.getCompileClasspathElements()); + } } catch (DependencyResolutionRequiredException e) { getLog().debug("Unable to log project compile classpath"); } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/GenerateTestStubsMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/GenerateTestStubsMojo.java index 87dae0dd..d57f0b73 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/GenerateTestStubsMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/GenerateTestStubsMojo.java @@ -70,7 +70,9 @@ public void execute() throws MojoExecutionException { minGroovyVersion = GROOVY_1_8_2; try { try { - getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); + if (getLog().isDebugEnabled()) { + getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); + } } catch (DependencyResolutionRequiredException e) { getLog().debug("Unable to log project test classpath"); } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocJarMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocJarMojo.java index 006c402a..80a69345 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocJarMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocJarMojo.java @@ -167,7 +167,9 @@ protected File generateArchive(File groovydocFiles, String jarFileName) throws A } if (useDefaultManifestFile && defaultManifestFile.exists() && archive.getManifestFile() == null) { - getLog().info("Adding existing MANIFEST to archive. Found under: " + defaultManifestFile.getPath()); + if (getLog().isInfoEnabled()) { + getLog().info("Adding existing MANIFEST to archive. Found under: " + defaultManifestFile.getPath()); + } archive.setManifestFile(defaultManifestFile); } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocMojo.java index 2d18e0d9..d4895687 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocMojo.java @@ -67,7 +67,9 @@ public class GroovyDocMojo extends AbstractGroovyDocMojo { public void execute() throws MojoExecutionException { try { try { - getLog().debug("Project compile classpath:\n" + project.getCompileClasspathElements()); + if (getLog().isDebugEnabled()) { + getLog().debug("Project compile classpath:\n" + project.getCompileClasspathElements()); + } } catch (DependencyResolutionRequiredException e) { getLog().debug("Unable to log project compile classpath"); } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsJarMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsJarMojo.java index d35d8eb6..ce0f9a5a 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsJarMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsJarMojo.java @@ -167,7 +167,9 @@ protected File generateArchive(File groovydocFiles, String jarFileName) throws A } if (useDefaultManifestFile && defaultManifestFile.exists() && archive.getManifestFile() == null) { - getLog().info("Adding existing MANIFEST to archive. Found under: " + defaultManifestFile.getPath()); + if (getLog().isInfoEnabled()) { + getLog().info("Adding existing MANIFEST to archive. Found under: " + defaultManifestFile.getPath()); + } archive.setManifestFile(defaultManifestFile); } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsMojo.java index 8b892535..d1f9222e 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsMojo.java @@ -67,7 +67,9 @@ public class GroovyDocTestsMojo extends AbstractGroovyDocMojo { public void execute() throws MojoExecutionException { try { try { - getLog().debug("Project test classpath:\n" + project.getCompileClasspathElements()); + if (getLog().isDebugEnabled()) { + getLog().debug("Project test classpath:\n" + project.getCompileClasspathElements()); + } } catch (DependencyResolutionRequiredException e) { getLog().debug("Unable to log project tset classpath"); } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/ShellMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/ShellMojo.java index ed28e136..a921900b 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/ShellMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/ShellMojo.java @@ -79,7 +79,9 @@ public void execute() throws MojoExecutionException { classWrangler.logGroovyVersion(mojoExecution.getMojoDescriptor().getGoal()); try { - getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); + if (getLog().isDebugEnabled()) { + getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); + } } catch (DependencyResolutionRequiredException e) { getLog().debug("Unable to log project test classpath"); }