List of usage examples for org.apache.maven.plugin.logging Log debug
void debug(Throwable error);
From source file:npanday.plugin.libraryimporter.model.NugetPackage.java
License:Apache License
public Iterable<NugetPackageLibrary> getLibraries(Log log, File mavenProjectsCacheDirectory) throws MojoExecutionException { List<File> libDirectories = getLibraryDirectories(); List<NugetPackageLibrary> libImports = Lists.newArrayList(); for (File libDir : libDirectories) { for (File libFile : LibImporterPathUtils.getLibraries(libDir)) { NugetPackageLibrary lib = new NugetPackageLibrary(this, libFile, mavenProjectsCacheDirectory); ReferenceMapping referenceMapping = tryFindReferenceMappingFor(lib.getAssemblyInfo()); if (referenceMapping != null && referenceMapping.getMapToPackage() != null) { if (log.isDebugEnabled()) { log.debug("NPANDAY-142-004: Will skip inclusion for " + lib + " since references to it are mapped to a different package (" + referenceMapping.getMapToPackage().getId() + ", v" + referenceMapping.getMapToPackage().getVersion() + ")."); }//from w w w .j av a 2s .co m continue; } libImports.add(lib); } } return libImports; }
From source file:npanday.vendor.SettingsUtil.java
License:Apache License
/** * Replaces npanday settings from the given path or file. * * @param failIfFileNotFound//from w w w. j av a2 s. c o m * If <code>true</code>, fails, if the file can't be found. Else, * just leaves the settings untouched. * @return The new Settings Repository. * @throws MojoExecutionException If anything goes wrong reading or initializing the settings */ private static boolean overrideDefaultSettings(Log log, RepositoryRegistry repositoryRegistry, String settingsPathOrFile, boolean failIfFileNotFound) throws MojoExecutionException { File settingsFile = PathUtil.buildSettingsFilePath(settingsPathOrFile); if (!settingsFile.exists()) { if (failIfFileNotFound) { throw new MojoExecutionException( "NPANDAY-108-005: Configured settings file does not exist: " + settingsFile); } else { log.warn("NPANDAY-108-006: Settings file does not exist: " + settingsFile + "; current Mojo will adhere to configured defaults."); return false; } } SettingsRepository settingsRepository = findSettingsFromRegistry(repositoryRegistry); try { settingsRepository.clearAll(); } catch (OperationNotSupportedException e) { throw new MojoExecutionException("NPANDAY-108-006: Error clearing settings repository.", e); } try { settingsRepository.load(settingsFile.toURI().toURL()); log.debug("NPANDAY-108-007: Replaced default npanday-settings with contents from '" + settingsFile + "'."); return true; } catch (IOException e) { throw new MojoExecutionException("NPANDAY-108-003: Error loading " + settingsFile.getAbsolutePath(), e); } catch (NPandayRepositoryException e) { throw new MojoExecutionException("NPANDAY-108-004: Error loading settings repository.", e); } }
From source file:org.acmsl.queryj.tools.maven.AntProjectAdapter.java
License:Open Source License
/** * See {@link Project#log(String)}./*w w w . j a v a2 s . co m*/ * @param message the message. * @param msgLevel either {@link Project#MSG_ERR}, {@link Project#MSG_WARN}, * {@link Project#MSG_INFO}, {@link Project#MSG_VERBOSE}, or {@link Project#MSG_DEBUG}. * @param log the {@link Log} instance. */ protected void log(@NotNull final String message, final int msgLevel, @NotNull final Log log) { switch (msgLevel) { case MSG_ERR: log.error(message); break; case MSG_WARN: log.warn(message); break; case MSG_VERBOSE: case MSG_DEBUG: log.debug(message); break; default: log.info(message); break; } }
From source file:org.acmsl.queryj.tools.maven.AntProjectAdapter.java
License:Open Source License
/** * See {@link Project#log(Task, String, int)}. * @param task the task./* w ww . j av a2 s . co m*/ * @param message the message. * @param msgLevel either {@link Project#MSG_ERR}, {@link Project#MSG_WARN}, * {@link Project#MSG_INFO}, {@link Project#MSG_VERBOSE}, or {@link Project#MSG_DEBUG}. * @param log the {@link Log} instance. */ protected void log(@NotNull final Task task, @NotNull final String message, final int msgLevel, @NotNull final Log log) { @NotNull final String t_strMessage = "[" + task.getTaskName() + "] " + message; switch (msgLevel) { case MSG_ERR: log.error(t_strMessage); break; case MSG_WARN: log.warn(t_strMessage); break; case MSG_VERBOSE: case MSG_DEBUG: log.debug(t_strMessage); break; default: log.info(t_strMessage); break; } }
From source file:org.acmsl.queryj.tools.maven.AntProjectAdapter.java
License:Open Source License
/** * See {@link Project#log(Target, String, int)}. * @param target the target.//from w w w . j a v a 2s. c om * @param message the message. * @param msgLevel either {@link Project#MSG_ERR}, {@link Project#MSG_WARN}, * {@link Project#MSG_INFO}, {@link Project#MSG_VERBOSE}, or {@link Project#MSG_DEBUG}. * @param log the {@link Log} instance. */ protected void log(@NotNull final Target target, @NotNull final String message, final int msgLevel, @NotNull final Log log) { @NotNull final String t_strMessage = "[" + target.getName() + "] " + message; switch (msgLevel) { case MSG_ERR: log.error(t_strMessage); break; case MSG_WARN: log.warn(t_strMessage); break; case MSG_VERBOSE: case MSG_DEBUG: log.debug(t_strMessage); break; default: log.info(t_strMessage); break; } }
From source file:org.acmsl.queryj.tools.maven.CommonsLoggingMavenLogAdapter.java
License:Open Source License
/** * <p> Log a message with trace log level. </p> * @param message log this message.//from w w w.ja va 2 s .co m * @param mavenLog the actual {@link Log} used for logging. */ protected void trace(@NotNull final Object message, @NotNull final Log mavenLog) { mavenLog.debug(message.toString()); }
From source file:org.acmsl.queryj.tools.maven.CommonsLoggingMavenLogAdapter.java
License:Open Source License
/** * <p> Log a message with trace log level. </p> * @param error the error to log.//from w ww . j a v a 2s. c om * @param mavenLog the actual {@link Log} used for logging. */ protected void trace(@NotNull final Throwable error, @NotNull final Log mavenLog) { mavenLog.debug(error); }
From source file:org.acmsl.queryj.tools.maven.CommonsLoggingMavenLogAdapter.java
License:Open Source License
/** * <p> Log a message with debug log level. </p> * @param message log this message./*from www . j av a2 s . c o m*/ * @param mavenLog the actual {@link Log} used for logging. */ protected void debug(@NotNull final Object message, @NotNull final Log mavenLog) { mavenLog.debug(message.toString()); }
From source file:org.acmsl.queryj.tools.maven.CommonsLoggingMavenLogAdapter.java
License:Open Source License
/** * <p> Log a message with debug log level. </p> * @param error the error to log./* ww w .j a v a 2s . c o m*/ * @param mavenLog the actual {@link Log} used for logging. */ protected void debug(@NotNull final Throwable error, @NotNull final Log mavenLog) { mavenLog.debug(error); }
From source file:org.antlr.mojo.antlr4.Antlr4Mojo.java
License:BSD License
/** * The main entry point for this Mojo, it is responsible for converting * ANTLR 4.x grammars into the target language specified by the grammar. * * @exception MojoExecutionException if a configuration or grammar error causes * the code generation process to fail//from w w w . ja v a 2 s .com * @exception MojoFailureException if an instance of the ANTLR 4 {@link Tool} * cannot be created */ @Override public void execute() throws MojoExecutionException, MojoFailureException { Log log = getLog(); if (log.isDebugEnabled()) { for (String e : excludes) { log.debug("ANTLR: Exclude: " + e); } for (String e : includes) { log.debug("ANTLR: Include: " + e); } log.debug("ANTLR: Output: " + outputDirectory); log.debug("ANTLR: Library: " + libDirectory); } if (!sourceDirectory.isDirectory()) { log.info("No ANTLR 4 grammars to compile in " + sourceDirectory.getAbsolutePath()); return; } // Ensure that the output directory path is all in tact so that // ANTLR can just write into it. // File outputDir = getOutputDirectory(); if (!outputDir.exists()) { outputDir.mkdirs(); } // Now pick up all the files and process them with the Tool // List<List<String>> argumentSets; try { List<String> args = getCommandArguments(); argumentSets = processGrammarFiles(args, sourceDirectory); } catch (InclusionScanException ie) { log.error(ie); throw new MojoExecutionException( "Fatal error occured while evaluating the names of the grammar files to analyze", ie); } log.debug("Output directory base will be " + outputDirectory.getAbsolutePath()); log.info("ANTLR 4: Processing source directory " + sourceDirectory.getAbsolutePath()); for (List<String> args : argumentSets) { try { // Create an instance of the ANTLR 4 build tool tool = new CustomTool(args.toArray(new String[args.size()])); } catch (Exception e) { log.error("The attempt to create the ANTLR 4 build tool failed, see exception report for details", e); throw new MojoFailureException("Error creating an instanceof the ANTLR tool.", e); } // Set working directory for ANTLR to be the base source directory tool.inputDirectory = sourceDirectory; tool.processGrammarsOnCommandLine(); // If any of the grammar files caused errors but did nto throw exceptions // then we should have accumulated errors in the counts if (tool.getNumErrors() > 0) { throw new MojoExecutionException("ANTLR 4 caught " + tool.getNumErrors() + " build errors."); } } if (project != null) { // Tell Maven that there are some new source files underneath the output directory. addSourceRoot(this.getOutputDirectory()); } }