List of usage examples for org.apache.maven.plugin.logging Log isDebugEnabled
boolean isDebugEnabled();
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 va2s . c o m*/ * @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()); } }
From source file:org.apache.axis2.maven2.wsdl2code.WSDL2CodeMojo.java
License:Apache License
private void showDependencies() { Log log = getLog(); if (!log.isDebugEnabled()) { return;// w ww .jav a 2s . com } log.debug("The projects dependency artifacts are: "); for (Iterator iter = project.getDependencyArtifacts().iterator(); iter.hasNext();) { Artifact artifact = (Artifact) iter.next(); log.debug(" " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() + ":" + artifact.getClassifier() + ":" + artifact.getScope() + ":" + artifact.getType()); } log.debug("The projects transitive artifacts are: "); for (Iterator iter = project.getArtifacts().iterator(); iter.hasNext();) { Artifact artifact = (Artifact) iter.next(); log.debug(" " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() + ":" + artifact.getClassifier() + ":" + artifact.getScope() + ":" + artifact.getType()); } }
From source file:org.apache.felix.bundleplugin.BundlePlugin.java
License:Apache License
protected static void dumpInstructions(String title, Properties properties, Log log) { if (log.isDebugEnabled()) { log.debug(title);/*w w w .j a v a2 s . com*/ log.debug("------------------------------------------------------------------------"); for (Enumeration e = properties.propertyNames(); e.hasMoreElements();) { String key = (String) e.nextElement(); log.debug(key + ": " + properties.getProperty(key)); } log.debug("------------------------------------------------------------------------"); } }
From source file:org.apache.felix.bundleplugin.BundlePlugin.java
License:Apache License
protected static void dumpClasspath(String title, List classpath, Log log) { if (log.isDebugEnabled()) { log.debug(title);/*from w w w . j av a 2s . c om*/ log.debug("------------------------------------------------------------------------"); for (Iterator i = classpath.iterator(); i.hasNext();) { File path = ((Jar) i.next()).getSource(); log.debug(null == path ? "null" : path.toString()); } log.debug("------------------------------------------------------------------------"); } }
From source file:org.apache.felix.bundleplugin.BundlePlugin.java
License:Apache License
protected static void dumpManifest(String title, Manifest manifest, Log log) { if (log.isDebugEnabled()) { log.debug(title);// w w w.ja v a2 s . c o m log.debug("------------------------------------------------------------------------"); for (Iterator i = manifest.getMainAttributes().entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); log.debug(entry.getKey() + ": " + entry.getValue()); } log.debug("------------------------------------------------------------------------"); } }
From source file:org.apache.james.mailet.DefaultDescriptorsExtractor.java
License:Apache License
private void addDescriptor(Log log, final URLClassLoader classLoader, final Class<?> mailetClass, final Class<?> matcherClass, final JavaClass nextClass) { final String nameOfNextClass = nextClass.getFullyQualifiedName(); if (log.isDebugEnabled()) { log.debug("Class: " + nameOfNextClass); }//from ww w . j av a 2s .c o m try { final Class<?> klass = classLoader.loadClass(nameOfNextClass); logConstructor(log, klass); final List<Class<?>> allInterfaces = getAllInterfaces(klass); if (allInterfaces.contains(mailetClass)) { final MailetMatcherDescriptor descriptor = describeMailet(log, nextClass, nameOfNextClass, klass); descriptors.add(descriptor); } else if (allInterfaces.contains(matcherClass)) { final MailetMatcherDescriptor descriptor = describeMatcher(log, nextClass, nameOfNextClass, klass); descriptors.add(descriptor); } else { logInterfaces(log, klass, allInterfaces); } } catch (NoClassDefFoundError e) { log.error("NotFound: " + e.getMessage()); } catch (ClassNotFoundException e) { log.error("NotFound: " + e.getMessage()); } catch (SecurityException e) { log.error("SE: " + e.getMessage()); } catch (IllegalArgumentException e) { log.error("IAE2: " + e.getMessage()); } logInterfacesImplemented(log, nextClass); }
From source file:org.apache.james.mailet.DefaultDescriptorsExtractor.java
License:Apache License
private void logInterfaces(Log log, Class<?> klass, final List<Class<?>> allInterfaces) { if (log.isDebugEnabled()) { if (allInterfaces.size() > 0) { log.debug("Interfaces for " + klass.getName()); for (Class<?> allInterface : allInterfaces) { log.debug("Interface: " + allInterface.getName()); }/* w ww .j a v a 2 s. c om*/ } else { log.debug("No interfaces for " + klass.getName()); } } }
From source file:org.apache.james.mailet.DefaultDescriptorsExtractor.java
License:Apache License
private void logInterfacesImplemented(Log log, JavaClass nextClass) { if (log.isDebugEnabled()) { final List<JavaClass> implementedInterfaces = getAllInterfacesQdox(nextClass); for (JavaClass implemented : implementedInterfaces) { log.debug("Interface implemented: " + implemented); }//from w w w. jav a 2 s . c o m } }
From source file:org.apache.james.mailet.DefaultDescriptorsExtractor.java
License:Apache License
private void logConstructor(Log log, Class<?> klass) { if (log.isDebugEnabled()) { try {/*from w w w . j a v a2s .c om*/ log.debug("Constructor(empty): " + klass.getConstructor((Class<?>) null)); } catch (SecurityException e) { log.debug("Cannot introspect empty constructor", e); } catch (NoSuchMethodException e) { log.debug("Cannot introspect empty constructor", e); } } }
From source file:org.apache.james.mailet.DefaultDescriptorsExtractor.java
License:Apache License
private URLClassLoader classLoader(MavenProject project, Log log) { URLClassLoader classLoader = null; try {// w w w. ja v a 2 s . c om @SuppressWarnings("unchecked") final List<String> cpes = project.getCompileClasspathElements(); final int size = cpes.size(); final URL[] urls = new URL[size]; for (int k = 0; k < size; k++) { if (log.isDebugEnabled()) { log.debug("CPE: " + cpes.get(k)); } urls[k] = new File(cpes.get(k)).toURI().toURL(); } classLoader = new URLClassLoader(urls); } catch (DependencyResolutionRequiredException e) { log.error("Failed to load project dependencies.", e); } catch (MalformedURLException e) { log.error("Cannot build classloader from project URLs.", e); } return classLoader; }