From 50a75209f95bbe37ae0e4099b1d0bb466ac3b5a7 Mon Sep 17 00:00:00 2001 From: Keegan Witt Date: Wed, 6 Jul 2022 22:36:19 -0400 Subject: [PATCH] Remove needless log level checks --- pom.xml | 7 -- .../gmavenplus/mojo/AbstractCompileMojo.java | 72 +++++-------------- .../mojo/AbstractGenerateStubsMojo.java | 28 ++------ .../mojo/AbstractGroovyDocMojo.java | 56 ++++----------- .../gmavenplus/mojo/AbstractGroovyMojo.java | 16 ++--- .../gmavenplus/mojo/AbstractToolsMojo.java | 16 ++--- .../gmavenplus/mojo/AddSourcesMojo.java | 4 +- .../gmavenplus/mojo/AddStubSourcesMojo.java | 4 +- .../gmavenplus/mojo/AddTestSourcesMojo.java | 4 +- .../mojo/AddTestStubSourcesMojo.java | 4 +- .../codehaus/gmavenplus/mojo/CompileMojo.java | 8 +-- .../gmavenplus/mojo/CompileTestsMojo.java | 12 +--- .../codehaus/gmavenplus/mojo/ConsoleMojo.java | 24 ++----- .../codehaus/gmavenplus/mojo/ExecuteMojo.java | 36 +++------- .../gmavenplus/mojo/GenerateStubsMojo.java | 8 +-- .../mojo/GenerateTestStubsMojo.java | 12 +--- .../gmavenplus/mojo/GroovyDocJarMojo.java | 12 +--- .../gmavenplus/mojo/GroovyDocMojo.java | 8 +-- .../mojo/GroovyDocTestsJarMojo.java | 12 +--- .../gmavenplus/mojo/GroovyDocTestsMojo.java | 8 +-- .../codehaus/gmavenplus/mojo/ShellMojo.java | 12 +--- .../gmavenplus/util/ClassWrangler.java | 4 +- 22 files changed, 90 insertions(+), 277 deletions(-) diff --git a/pom.xml b/pom.xml index e9dc6ba42..67b99fc4b 100644 --- a/pom.xml +++ b/pom.xml @@ -74,13 +74,6 @@ 3.4.2 runtime - - - commons-io - commons-io - 2.7 - runtime - org.fusesource.jansi diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java index 245e41ae1..cb387b1f7 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java @@ -305,9 +305,7 @@ public abstract class AbstractCompileMojo extends AbstractGroovySourcesMojo { protected synchronized void doCompile(final Set sources, final List classpath, final File compileOutputDirectory) throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, MalformedURLException { if (sources == null || sources.isEmpty()) { - if (getLog().isInfoEnabled()) { - getLog().info("No sources specified for compilation. Skipping."); - } + getLog().info("No sources specified for compilation. Skipping."); return; } @@ -319,9 +317,7 @@ protected synchronized void doCompile(final Set sources, final List classp if (groovyVersionSupportsAction() && !skipBytecodeCheck) { verifyGroovyVersionSupportsTargetBytecode(); } else { - if (getLog().isErrorEnabled()) { - getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support compilation. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping compiling."); - } + getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support compilation. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping compiling."); return; } @@ -343,9 +339,7 @@ protected synchronized void doCompile(final Set sources, final List classp // log compiled classes List classes = (List) invokeMethod(findMethod(compilationUnitClass, "getClasses"), compilationUnit); - if (getLog().isInfoEnabled()) { - getLog().info("Compiled " + classes.size() + " file" + (classes.size() != 1 ? "s" : "") + "."); - } + getLog().info("Compiled " + classes.size() + " file" + (classes.size() != 1 ? "s" : "") + "."); } private static String translateJavacTargetToTargetBytecode(String targetBytecode) { @@ -380,14 +374,10 @@ protected Object setupCompilationUnit(final Set sources, final Class co } else { compilationUnit = invokeConstructor(findConstructor(compilationUnitClass, compilerConfigurationClass, CodeSource.class, groovyClassLoaderClass), compilerConfiguration, null, groovyClassLoader); } - if (getLog().isDebugEnabled()) { - getLog().debug("Adding Groovy to compile:"); - } + getLog().debug("Adding Groovy to compile:"); Method addSourceMethod = findMethod(compilationUnitClass, "addSource", File.class); for (File source : sources) { - if (getLog().isDebugEnabled()) { - getLog().debug(" " + source); - } + getLog().debug(" " + source); invokeMethod(addSourceMethod, compilationUnit, source); } @@ -410,13 +400,9 @@ protected Object setupCompilerConfiguration(final File compileOutputDirectory, f Object compilerConfiguration = invokeConstructor(findConstructor(compilerConfigurationClass)); if (configScript != null) { if (!configScript.exists()) { - if (getLog().isWarnEnabled()) { - getLog().warn("Configuration script file (" + configScript.getAbsolutePath() + ") doesn't exist. Ignoring configScript parameter."); - } + getLog().warn("Configuration script file (" + configScript.getAbsolutePath() + ") doesn't exist. Ignoring configScript parameter."); } else if (groovyOlderThan(GROOVY_2_1_0_BETA1)) { - 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."); - } + 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"); @@ -430,9 +416,7 @@ protected Object setupCompilerConfiguration(final File compileOutputDirectory, f List compilationCustomizers = (List) invokeMethod(findMethod(compilerConfigurationClass, "getCompilationCustomizers"), shellCompilerConfiguration); compilationCustomizers.add(importCustomizer); Object shell = invokeConstructor(findConstructor(groovyShellClass, ClassLoader.class, bindingClass, compilerConfigurationClass), classWrangler.getClassLoader(), binding, shellCompilerConfiguration); - if (getLog().isDebugEnabled()) { - getLog().debug("Using configuration script " + configScript + " for compilation."); - } + getLog().debug("Using configuration script " + configScript + " for compilation."); invokeMethod(findMethod(groovyShellClass, "evaluate", File.class), shell, configScript); } } @@ -444,16 +428,12 @@ 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))) { - 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."); - } + 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 { - if (getLog().isWarnEnabled()) { - getLog().warn("Requested to use to use preview features, but your Java version (" + getJavaVersionString() + ") doesn't support it. Ignoring previewFeatures parameter."); - } + getLog().warn("Requested to use to use preview features, but your Java version (" + getJavaVersionString() + ") doesn't support it. Ignoring previewFeatures parameter."); } } if (sourceEncoding != null) { @@ -467,23 +447,15 @@ protected Object setupCompilerConfiguration(final File compileOutputDirectory, f Map optimizationOptions = (Map) invokeMethod(findMethod(compilerConfigurationClass, "getOptimizationOptions"), compilerConfiguration); optimizationOptions.put("indy", true); optimizationOptions.put("int", false); - if (getLog().isInfoEnabled()) { - getLog().info("invokedynamic enabled."); - } + getLog().info("invokedynamic enabled."); } else { - if (getLog().isWarnEnabled()) { - getLog().warn("Requested to use to use invokedynamic, but your Java version (" + getJavaVersionString() + ") doesn't support it. Ignoring invokeDynamic parameter."); - } + getLog().warn("Requested to use to use invokedynamic, but your Java version (" + getJavaVersionString() + ") doesn't support it. Ignoring invokeDynamic parameter."); } } else { - if (getLog().isWarnEnabled()) { - getLog().warn("Requested to use invokedynamic, but your Groovy version doesn't support it (must use have indy classifier). Ignoring invokeDynamic parameter."); - } + getLog().warn("Requested to use invokedynamic, but your Groovy version doesn't support it (must use have indy classifier). Ignoring invokeDynamic parameter."); } } else { - 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."); - } + 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) { @@ -491,27 +463,19 @@ protected Object setupCompilerConfiguration(final File compileOutputDirectory, f if (isJavaSupportParameters()) { invokeMethod(findMethod(compilerConfigurationClass, "setParameters", boolean.class), compilerConfiguration, parameters); } else { - if (getLog().isWarnEnabled()) { - getLog().warn("Requested to use to use parameters, but your Java version (" + getJavaVersionString() + ") doesn't support it. Ignoring parameters parameter."); - } + getLog().warn("Requested to use to use parameters, but your Java version (" + getJavaVersionString() + ") doesn't support it. Ignoring parameters parameter."); } } else { - 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."); - } + 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)) { if ((parallelParsing == null && groovyAtLeast(GROOVY_4_0_0_ALPHA1)) || (parallelParsing != null && parallelParsing)) { Map optimizationOptions = (Map) invokeMethod(findMethod(compilerConfigurationClass, "getOptimizationOptions"), compilerConfiguration); optimizationOptions.put("parallelParse", true); - if (getLog().isInfoEnabled()) { - getLog().info("Parallel parsing enabled."); - } + getLog().info("Parallel parsing enabled."); } else { - if (getLog().isInfoEnabled()) { - getLog().info("Parallel parsing disabled."); - } + getLog().info("Parallel parsing disabled."); } } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java index f7c5143d8..a615b7338 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java @@ -268,9 +268,7 @@ public abstract class AbstractGenerateStubsMojo extends AbstractGroovyStubSource */ protected synchronized void doStubGeneration(final Set stubSources, final List classpath, final File outputDirectory) throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, InstantiationException, MalformedURLException { if (stubSources == null || stubSources.isEmpty()) { - if (getLog().isInfoEnabled()) { - getLog().info("No sources specified for stub generation. Skipping."); - } + getLog().info("No sources specified for stub generation. Skipping."); return; } @@ -282,9 +280,7 @@ protected synchronized void doStubGeneration(final Set stubSources, final if (groovyVersionSupportsAction() && !skipBytecodeCheck) { verifyGroovyVersionSupportsTargetBytecode(); } else { - if (getLog().isErrorEnabled()) { - getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support stub generation. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping stub generation."); - } + getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support stub generation. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping stub generation."); return; } @@ -349,20 +345,14 @@ protected void addGroovySources(final Set stubSources, final Class comp for (File stubSource : stubSources) { scriptExtensions.add(FileUtils.getFileExtension(stubSource)); } - if (getLog().isDebugEnabled()) { - getLog().debug("Detected Groovy file extensions: " + scriptExtensions + "."); - } + getLog().debug("Detected Groovy file extensions: " + scriptExtensions + "."); if (supportsSettingExtensions()) { invokeMethod(findMethod(compilerConfigurationClass, "setScriptExtensions", Set.class), compilerConfiguration, scriptExtensions); } - if (getLog().isDebugEnabled()) { - getLog().debug("Adding Groovy to generate stubs for:"); - } + getLog().debug("Adding Groovy to generate stubs for:"); Method addSource = findMethod(javaStubCompilationUnitClass, "addSource", File.class); for (File stubSource : stubSources) { - if (getLog().isDebugEnabled()) { - getLog().debug(" " + stubSource); - } + getLog().debug(" " + stubSource); if (supportsSettingExtensions()) { invokeMethod(addSource, javaStubCompilationUnit, stubSource); } else { @@ -388,9 +378,7 @@ protected boolean supportsSettingExtensions() { */ protected void logGeneratedStubs(File outputDirectory) { Set stubs = getStubs(outputDirectory); - if (getLog().isInfoEnabled()) { - getLog().info("Generated " + stubs.size() + " stub" + (stubs.size() != 1 ? "s" : "") + "."); - } + getLog().info("Generated " + stubs.size() + " stub" + (stubs.size() != 1 ? "s" : "") + "."); } /** @@ -405,9 +393,7 @@ protected void resetStubModifiedDates(final Set stubs) { for (File stub : stubs) { boolean success = stub.setLastModified(0L); if (!success) { - if (getLog().isWarnEnabled()) { - getLog().warn("Unable to set modified time on stub " + stub.getAbsolutePath() + "."); - } + 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 d31568be2..3236efcb7 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyDocMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyDocMojo.java @@ -271,16 +271,12 @@ public abstract class AbstractGroovyDocMojo extends AbstractGroovySourcesMojo { */ protected synchronized void doGroovyDocGeneration(final FileSet[] sourceDirectories, final List classpath, final File outputDirectory) throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, InstantiationException, MalformedURLException { if (skipGroovyDoc) { - if (getLog().isInfoEnabled()) { - getLog().info("Skipping generation of GroovyDoc because ${skipGroovydoc} was set to true."); - } + getLog().info("Skipping generation of GroovyDoc because ${skipGroovydoc} was set to true."); return; } if (sourceDirectories == null || sourceDirectories.length == 0) { - if (getLog().isInfoEnabled()) { - getLog().info("No source directories specified for GroovyDoc generation. Skipping."); - } + getLog().info("No source directories specified for GroovyDoc generation. Skipping."); return; } @@ -290,16 +286,12 @@ protected synchronized void doGroovyDocGeneration(final FileSet[] sourceDirector logPluginClasspath(); if (!groovyVersionSupportsAction()) { - if (getLog().isErrorEnabled()) { - getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support GroovyDoc. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping GroovyDoc generation."); - } + getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support GroovyDoc. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping GroovyDoc generation."); return; } 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 - 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."); - } + 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; } @@ -315,9 +307,7 @@ protected synchronized void doGroovyDocGeneration(final FileSet[] sourceDirector if (groovyAtLeast(GROOVY_3_0_0_ALPHA_4)) { System.setProperty("runtimeGroovydoc", "true"); } else { - 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."); - } + 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(); @@ -331,9 +321,7 @@ protected synchronized void doGroovyDocGeneration(final FileSet[] sourceDirector GroovyDocTemplateInfo groovyDocTemplateInfo = new GroovyDocTemplateInfo(classWrangler.getGroovyVersion()); List groovyDocLinks = setupLinks(); if (groovyOlderThan(GROOVY_1_6_0_RC2)) { - 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."); - } + 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 @@ -376,9 +364,7 @@ protected Properties setupProperties() { properties.setProperty("privateScope", "true"); } } catch (IllegalArgumentException e) { - if (getLog().isWarnEnabled()) { - getLog().warn("Scope (" + scope + ") was not recognized. Skipping argument."); - } + getLog().warn("Scope (" + scope + ") was not recognized. Skipping argument."); } return properties; @@ -417,9 +403,7 @@ protected List setupLinks() throws ClassNotFoundException, InvocationTargetEx linksList.add(linkArgument); } } else { - 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."); - } + 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."); } } @@ -463,9 +447,7 @@ protected Object createGroovyDocTool(final Class groovyDocToolClass, final Cl groovyDocLinks ); if (sourceDirectories.size() > 1) { - 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) + ")."); - } + 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), @@ -476,9 +458,7 @@ protected Object createGroovyDocTool(final Class groovyDocToolClass, final Cl defaultClassTemplates == null ? groovyDocTemplateInfo.defaultClassTemplates() : defaultClassTemplates ); if (sourceDirectories.size() > 1) { - 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) + ")."); - } + 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) + ")."); } } @@ -528,14 +508,10 @@ protected List setupGroovyDocSources(final FileSet[] sourceDirectories, * @throws InvocationTargetException when a reflection invocation needed for GroovyDoc generation cannot be completed */ protected void generateGroovyDoc(final File outputDirectory, final Class groovyDocToolClass, final Class outputToolClass, final Object fileOutputTool, final List groovyDocSources, final Object groovyDocTool) throws InvocationTargetException, IllegalAccessException { - if (getLog().isDebugEnabled()) { - getLog().debug("Adding sources to generate GroovyDoc for:"); - } + getLog().debug("Adding sources to generate GroovyDoc for:"); if (getLog().isDebugEnabled()) { for (String groovyDocSource : groovyDocSources) { - if (getLog().isDebugEnabled()) { - getLog().debug(" " + groovyDocSource); - } + getLog().debug(" " + groovyDocSource); } } if (groovyAtLeast(GROOVY_1_6_0_RC2)) { @@ -555,9 +531,7 @@ 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) { - if (getLog().isInfoEnabled()) { - getLog().info("Using stylesheet from " + stylesheetFile.getAbsolutePath() + "."); - } + getLog().info("Using stylesheet from " + stylesheetFile.getAbsolutePath() + "."); try { BufferedReader bufferedReader = null; BufferedWriter bufferedWriter = null; @@ -584,9 +558,7 @@ protected void copyStylesheet(final File outputDirectory) { FileUtils.closeQuietly(bufferedWriter); } } catch (IOException e) { - if (getLog().isWarnEnabled()) { - getLog().warn("Unable to copy specified stylesheet (" + stylesheetFile.getAbsolutePath() + ")."); - } + 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 9c3750785..5f96489b2 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyMojo.java @@ -120,9 +120,7 @@ protected void logPluginClasspath() { sb.append(", "); } } - if (getLog().isDebugEnabled()) { - getLog().debug("Plugin classpath:\n" + sb); - } + getLog().debug("Plugin classpath:\n" + sb); } } @@ -239,19 +237,13 @@ protected boolean isGroovyIndy() { */ protected void setupClassWrangler(List classpath, IncludeClasspath includeClasspath) throws MalformedURLException { if (IncludeClasspath.PROJECT_ONLY.equals(includeClasspath)) { - if (getLog().isInfoEnabled()) { - getLog().info("Using isolated classloader, without GMavenPlus classpath."); - } + getLog().info("Using isolated classloader, without GMavenPlus classpath."); classWrangler = new ClassWrangler(classpath, ClassLoader.getSystemClassLoader(), getLog()); } else if (IncludeClasspath.PROJECT_AND_PLUGIN.equals(includeClasspath)) { - if (getLog().isInfoEnabled()) { - getLog().info("Using plugin classloader, includes GMavenPlus and project classpath."); - } + getLog().info("Using plugin classloader, includes GMavenPlus and project classpath."); classWrangler = new ClassWrangler(classpath, getClass().getClassLoader(), getLog()); } else { - if (getLog().isInfoEnabled()) { - getLog().info("Using plugin classloader, includes GMavenPlus classpath, but not project classpath."); - } + getLog().info("Using plugin classloader, includes GMavenPlus classpath, but not project classpath."); classWrangler = new ClassWrangler(emptyList(), getClass().getClassLoader(), getLog()); } } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractToolsMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractToolsMojo.java index cfe09364a..8eaa0cfb5 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractToolsMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractToolsMojo.java @@ -158,9 +158,7 @@ protected void initializeProperties() { try { antBuilder = invokeConstructor(findConstructor(classWrangler.getClass("groovy.ant.AntBuilder"))); } catch (ClassNotFoundException e1) { - if (getLog().isDebugEnabled()) { - getLog().debug("groovy.ant.AntBuilder not available, trying groovy.util.AntBuilder."); - } + getLog().debug("groovy.ant.AntBuilder not available, trying groovy.util.AntBuilder."); try { antBuilder = invokeConstructor(findConstructor(classWrangler.getClass("groovy.util.AntBuilder"))); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | InvocationTargetException e2) { @@ -174,14 +172,10 @@ protected void initializeProperties() { } } if (bindSessionUserOverrideProperties && !bindAllProjectProperties) { - if (getLog().isWarnEnabled()) { - getLog().warn("bindSessionUserOverrideProperties set without bindAllProjectProperties, ignoring."); - } + getLog().warn("bindSessionUserOverrideProperties set without bindAllProjectProperties, ignoring."); } if (bindAllSessionUserProperties && bindSessionUserOverrideProperties) { - if (getLog().isWarnEnabled()) { - getLog().warn("bindAllSessionUserProperties and bindSessionUserOverrideProperties both set, bindAllSessionUserProperties will take precedence."); - } + getLog().warn("bindAllSessionUserProperties and bindSessionUserOverrideProperties both set, bindAllSessionUserProperties will take precedence."); } if (bindAllProjectProperties && project != null) { properties.putAll(project.getProperties()); @@ -205,9 +199,7 @@ protected void initializeProperties() { * @param e the exception causing the failure */ protected void logUnableToInitializeAntBuilder(final Throwable e) { - if (getLog().isWarnEnabled()) { - getLog().warn("Unable to initialize 'ant' with a new AntBuilder object. Is Groovy a dependency? If you are using Groovy >= 2.3.0-rc-1, remember to include groovy-ant as a dependency."); - } + getLog().warn("Unable to initialize 'ant' with a new AntBuilder object. Is Groovy a dependency? If you are using Groovy >= 2.3.0-rc-1, remember to include groovy-ant as a dependency."); } } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AddSourcesMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AddSourcesMojo.java index a436c60b6..2f35c9063 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AddSourcesMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AddSourcesMojo.java @@ -55,9 +55,7 @@ public void execute() { */ protected void addSourcePath(final String path) { if (!project.getCompileSourceRoots().contains(path)) { - if (getLog().isDebugEnabled()) { - getLog().debug("Added source directory: " + path); - } + 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 6cc4063aa..1bd1f3300 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AddStubSourcesMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AddStubSourcesMojo.java @@ -42,9 +42,7 @@ public class AddStubSourcesMojo extends AbstractGroovyStubSourcesMojo { */ @Override public void execute() { - if (getLog().isDebugEnabled()) { - getLog().debug("Added stub directory " + stubsOutputDirectory.getAbsolutePath() + " to project sources."); - } + 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 3684961f9..a700b362e 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AddTestSourcesMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AddTestSourcesMojo.java @@ -55,9 +55,7 @@ public void execute() { */ protected void addTestSourcePath(final String path) { if (!project.getTestCompileSourceRoots().contains(path)) { - if (getLog().isDebugEnabled()) { - getLog().debug("Added test source directory: " + path); - } + 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 7221a8700..fa2960e8f 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AddTestStubSourcesMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AddTestStubSourcesMojo.java @@ -49,9 +49,7 @@ public class AddTestStubSourcesMojo extends AbstractGroovyStubSourcesMojo { @Override public void execute() { if (!skipTests) { - if (getLog().isDebugEnabled()) { - getLog().debug("Added test stub directory " + testStubsOutputDirectory.getAbsolutePath() + " to project test sources."); - } + 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 4d4c95c26..5333ea547 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/CompileMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/CompileMojo.java @@ -61,13 +61,9 @@ public class CompileMojo extends AbstractCompileMojo { public void execute() throws MojoExecutionException { try { try { - if (getLog().isDebugEnabled()) { - getLog().debug("Project compile classpath:\n" + project.getCompileClasspathElements()); - } + getLog().debug("Project compile classpath:\n" + project.getCompileClasspathElements()); } catch (DependencyResolutionRequiredException e) { - if (getLog().isDebugEnabled()) { - getLog().debug("Unable to log project compile classpath"); - } + getLog().debug("Unable to log project compile classpath"); } doCompile(getFiles(sources, false), project.getCompileClasspathElements(), outputDirectory); } catch (ClassNotFoundException e) { diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/CompileTestsMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/CompileTestsMojo.java index e148ff542..5b40f2f4d 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/CompileTestsMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/CompileTestsMojo.java @@ -68,13 +68,9 @@ public void execute() throws MojoExecutionException { if (!skipTests) { try { try { - if (getLog().isDebugEnabled()) { - getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); - } + getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); } catch (DependencyResolutionRequiredException e) { - if (getLog().isDebugEnabled()) { - getLog().debug("Unable to log project test classpath"); - } + getLog().debug("Unable to log project test classpath"); } doCompile(getTestFiles(testSources, false), project.getTestClasspathElements(), testOutputDirectory); } catch (ClassNotFoundException e) { @@ -91,9 +87,7 @@ public void execute() throws MojoExecutionException { throw new MojoExecutionException("Unable to add project test dependencies to classpath.", e); } } else { - if (getLog().isInfoEnabled()) { - getLog().info("Compilation of tests is skipped."); - } + getLog().info("Compilation of tests is skipped."); } } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/ConsoleMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/ConsoleMojo.java index b8f9338ca..49da7cf05 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/ConsoleMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/ConsoleMojo.java @@ -80,13 +80,9 @@ public void execute() throws MojoExecutionException, MojoFailureException { classWrangler.logGroovyVersion(mojoExecution.getMojoDescriptor().getGoal()); try { - if (getLog().isDebugEnabled()) { - getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); - } + getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); } catch (DependencyResolutionRequiredException e) { - if (getLog().isDebugEnabled()) { - getLog().debug("Unable to log project test classpath"); - } + getLog().debug("Unable to log project test classpath"); } if (groovyVersionSupportsAction()) { @@ -137,9 +133,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { } } } else { - if (getLog().isErrorEnabled()) { - getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support running a console. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping console startup."); - } + getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support running a console. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping console startup."); } } @@ -154,14 +148,10 @@ protected void loadScript(Class consoleClass, Object console) throws Invocati if (consoleScriptFile.isFile()) { invokeMethod(loadScriptFile, console, consoleScriptFile); } else { - if (getLog().isWarnEnabled()) { - getLog().warn("consoleScript ('" + consoleScript + "') doesn't exist in project properties or as a file."); - } - } - } else { - 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."); } } } @@ -214,9 +204,7 @@ protected void bindAntBuilder(Class consoleClass, Class bindingClass, Obje try { antBuilder = invokeConstructor(findConstructor(classWrangler.getClass("groovy.ant.AntBuilder"))); } catch (ClassNotFoundException e1) { - if (getLog().isDebugEnabled()) { - getLog().debug("groovy.ant.AntBuilder not available, trying groovy.util.AntBuilder."); - } + getLog().debug("groovy.ant.AntBuilder not available, trying groovy.util.AntBuilder."); try { antBuilder = invokeConstructor(findConstructor(classWrangler.getClass("groovy.util.AntBuilder"))); } catch (ClassNotFoundException | IllegalAccessException | InvocationTargetException | InstantiationException e2) { diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/ExecuteMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/ExecuteMojo.java index eda9241e5..976b26184 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/ExecuteMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/ExecuteMojo.java @@ -110,16 +110,12 @@ public void execute() throws MojoExecutionException { */ protected synchronized void doExecute() throws MojoExecutionException { if (skipScriptExecution) { - if (getLog().isInfoEnabled()) { - getLog().info("Skipping script execution because ${skipScriptExecution} was set to true."); - } + getLog().info("Skipping script execution because ${skipScriptExecution} was set to true."); return; } if (scripts == null || scripts.length == 0) { - if (getLog().isInfoEnabled()) { - getLog().info("No scripts specified for execution. Skipping."); - } + getLog().info("No scripts specified for execution. Skipping."); return; } @@ -135,13 +131,9 @@ protected synchronized void doExecute() throws MojoExecutionException { classWrangler.logGroovyVersion(mojoExecution.getMojoDescriptor().getGoal()); try { - if (getLog().isDebugEnabled()) { - getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); - } + getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); } catch (DependencyResolutionRequiredException e) { - if (getLog().isDebugEnabled()) { - getLog().debug("Unable to log project test classpath"); - } + getLog().debug("Unable to log project test classpath"); } if (groovyVersionSupportsAction()) { @@ -173,9 +165,7 @@ protected synchronized void doExecute() throws MojoExecutionException { } } } else { - if (getLog().isErrorEnabled()) { - getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support script execution. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping script execution."); - } + getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support script execution. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping script execution."); } } @@ -237,9 +227,7 @@ 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()) { - if (getLog().isInfoEnabled()) { - getLog().info("Running Groovy script from " + scriptFile.getCanonicalPath() + "."); - } + getLog().info("Running Groovy script from " + scriptFile.getCanonicalPath() + "."); Method evaluateFile = findMethod(groovyShellClass, "evaluate", File.class); invokeMethod(evaluateFile, shell, scriptFile); } else { @@ -250,9 +238,7 @@ protected void executeScripts(final Class groovyShellClass, final Object shel } } catch (IOException ioe) { if (continueExecuting) { - if (getLog().isErrorEnabled()) { - getLog().error("An Exception occurred while executing script " + scriptNum + ". Continuing to execute remaining scripts.", ioe); - } + getLog().error("An Exception occurred while executing script " + scriptNum + ". Continuing to execute remaining scripts.", ioe); } else { throw new MojoExecutionException("An Exception occurred while executing script " + scriptNum + ".", ioe); } @@ -273,9 +259,7 @@ 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); - if (getLog().isInfoEnabled()) { - getLog().info("Running Groovy script from " + url + "."); - } + getLog().info("Running Groovy script from " + url + "."); if (groovyAtLeast(GROOVY_1_7_0)) { Method evaluateUrlWithReader = findMethod(groovyShellClass, "evaluate", Reader.class); BufferedReader reader = null; @@ -294,9 +278,7 @@ protected void executeScriptFromUrl(Class groovyShellClass, Object shell, Str InputStream inputStream = null; try { if (sourceEncoding != null) { - if (getLog().isWarnEnabled()) { - getLog().warn("Source encoding does not apply to Groovy versions previous to 1.7.0, ignoring."); - } + getLog().warn("Source encoding does not apply to Groovy versions previous to 1.7.0, ignoring."); } inputStream = url.openStream(); invokeMethod(evaluateUrlWithStream, shell, inputStream); diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/GenerateStubsMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/GenerateStubsMojo.java index 3910fc5b2..e9031b305 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/GenerateStubsMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/GenerateStubsMojo.java @@ -63,13 +63,9 @@ public void execute() throws MojoExecutionException { try { try { - if (getLog().isDebugEnabled()) { - getLog().debug("Project compile classpath:\n" + project.getCompileClasspathElements()); - } + getLog().debug("Project compile classpath:\n" + project.getCompileClasspathElements()); } catch (DependencyResolutionRequiredException e) { - if (getLog().isDebugEnabled()) { - getLog().debug("Unable to log project compile classpath"); - } + getLog().debug("Unable to log project compile classpath"); } doStubGeneration(getFiles(sources, false), project.getCompileClasspathElements(), stubsOutputDirectory); diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/GenerateTestStubsMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/GenerateTestStubsMojo.java index 39cb7bf47..5a7c2d933 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/GenerateTestStubsMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/GenerateTestStubsMojo.java @@ -69,13 +69,9 @@ public void execute() throws MojoExecutionException { minGroovyVersion = GROOVY_1_8_2; try { try { - if (getLog().isDebugEnabled()) { - getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); - } + getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); } catch (DependencyResolutionRequiredException e) { - if (getLog().isDebugEnabled()) { - getLog().debug("Unable to log project test classpath"); - } + getLog().debug("Unable to log project test classpath"); } doStubGeneration(getTestFiles(testSources, false), project.getTestClasspathElements(), testStubsOutputDirectory); @@ -98,9 +94,7 @@ public void execute() throws MojoExecutionException { throw new MojoExecutionException("Unable to add project test dependencies to classpath.", e); } } else { - if (getLog().isInfoEnabled()) { - getLog().info("Generation of test stubs is skipped."); - } + getLog().info("Generation of test stubs is skipped."); } } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocJarMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocJarMojo.java index e8ad28ed7..e5d9a9cb6 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocJarMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocJarMojo.java @@ -132,9 +132,7 @@ public void execute() throws MojoExecutionException { if (attach) { projectHelper.attachArtifact(project, artifactType, classifier, outputFile); } else { - if (getLog().isInfoEnabled()) { - getLog().info("Not adding GroovyDoc jar to attached artifacts list."); - } + getLog().info("Not adding GroovyDoc jar to attached artifacts list."); } } catch (ArchiverException e) { throw new MojoExecutionException("ArchiverException: Error while creating archive", e); @@ -166,17 +164,13 @@ protected File generateArchive(File groovydocFiles, String jarFileName) throws A archiver.setOutputFile(groovydocJar); if (!groovydocFiles.exists()) { - if (getLog().isWarnEnabled()) { - getLog().warn("JAR will be empty - no content was marked for inclusion!"); - } + getLog().warn("JAR will be empty - no content was marked for inclusion!"); } else { archiver.getArchiver().addDirectory(groovydocFiles); } if (useDefaultManifestFile && defaultManifestFile.exists() && archive.getManifestFile() == null) { - if (getLog().isInfoEnabled()) { - getLog().info("Adding existing MANIFEST to archive. Found under: " + defaultManifestFile.getPath()); - } + 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 6083f2d33..ac175101d 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocMojo.java @@ -67,13 +67,9 @@ public class GroovyDocMojo extends AbstractGroovyDocMojo { public void execute() throws MojoExecutionException { try { try { - if (getLog().isDebugEnabled()) { - getLog().debug("Project compile classpath:\n" + project.getCompileClasspathElements()); - } + getLog().debug("Project compile classpath:\n" + project.getCompileClasspathElements()); } catch (DependencyResolutionRequiredException e) { - if (getLog().isDebugEnabled()) { - getLog().debug("Unable to log project compile classpath"); - } + getLog().debug("Unable to log project compile classpath"); } doGroovyDocGeneration(getFilesets(sources, groovyDocJavaSources), project.getRuntimeClasspathElements(), groovyDocOutputDirectory); } catch (ClassNotFoundException e) { diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsJarMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsJarMojo.java index 1dc70a23b..48eb3076a 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsJarMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsJarMojo.java @@ -132,9 +132,7 @@ public void execute() throws MojoExecutionException { if (attach) { projectHelper.attachArtifact(project, testArtifactType, testClassifier, outputFile); } else { - if (getLog().isInfoEnabled()) { - getLog().info("Not adding test GroovyDoc jar to attached artifacts list."); - } + getLog().info("Not adding test GroovyDoc jar to attached artifacts list."); } } catch (ArchiverException e) { throw new MojoExecutionException("ArchiverException: Error while creating archive", e); @@ -166,17 +164,13 @@ protected File generateArchive(File groovydocFiles, String jarFileName) throws A archiver.setOutputFile(groovydocJar); if (!groovydocFiles.exists()) { - if (getLog().isWarnEnabled()) { - getLog().warn("JAR will be empty - no content was marked for inclusion!"); - } + getLog().warn("JAR will be empty - no content was marked for inclusion!"); } else { archiver.getArchiver().addDirectory(groovydocFiles); } if (useDefaultManifestFile && defaultManifestFile.exists() && archive.getManifestFile() == null) { - if (getLog().isInfoEnabled()) { - getLog().info("Adding existing MANIFEST to archive. Found under: " + defaultManifestFile.getPath()); - } + 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 3a065f13c..996ad4e5e 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsMojo.java @@ -67,13 +67,9 @@ public class GroovyDocTestsMojo extends AbstractGroovyDocMojo { public void execute() throws MojoExecutionException { try { try { - if (getLog().isDebugEnabled()) { - getLog().debug("Project test classpath:\n" + project.getCompileClasspathElements()); - } + getLog().debug("Project test classpath:\n" + project.getCompileClasspathElements()); } catch (DependencyResolutionRequiredException e) { - if (getLog().isDebugEnabled()) { - getLog().debug("Unable to log project tset classpath"); - } + getLog().debug("Unable to log project tset classpath"); } doGroovyDocGeneration(getTestFilesets(testSources, testGroovyDocJavaSources), project.getTestClasspathElements(), testGroovyDocOutputDirectory); } catch (ClassNotFoundException e) { diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/ShellMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/ShellMojo.java index f40b2c6f8..112bf639b 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/ShellMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/ShellMojo.java @@ -85,13 +85,9 @@ public void execute() throws MojoExecutionException { classWrangler.logGroovyVersion(mojoExecution.getMojoDescriptor().getGoal()); try { - if (getLog().isDebugEnabled()) { - getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); - } + getLog().debug("Project test classpath:\n" + project.getTestClasspathElements()); } catch (DependencyResolutionRequiredException e) { - if (getLog().isDebugEnabled()) { - getLog().debug("Unable to log project test classpath"); - } + getLog().debug("Unable to log project test classpath"); } if (groovyVersionSupportsAction()) { @@ -131,9 +127,7 @@ public void execute() throws MojoExecutionException { } } } else { - if (getLog().isErrorEnabled()) { - getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support running a shell. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping shell startup."); - } + getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support running a shell. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping shell startup."); } } diff --git a/src/main/java/org/codehaus/gmavenplus/util/ClassWrangler.java b/src/main/java/org/codehaus/gmavenplus/util/ClassWrangler.java index b62f6793b..6fef3d1df 100644 --- a/src/main/java/org/codehaus/gmavenplus/util/ClassWrangler.java +++ b/src/main/java/org/codehaus/gmavenplus/util/ClassWrangler.java @@ -219,9 +219,7 @@ public boolean isGroovyIndy() { * @param goal The goal to mention in the log statement showing Groovy version */ public void logGroovyVersion(final String goal) { - if (log.isInfoEnabled()) { - log.info("Using Groovy " + getGroovyVersionString() + " to perform " + goal + "."); - } + log.info("Using Groovy " + getGroovyVersionString() + " to perform " + goal + "."); } /**