List of usage examples for org.apache.maven.plugin.logging Log debug
void debug(Throwable error);
From source file:org.spdx.maven.SnippetInfo.java
License:Apache License
public void logInfo(Log log) { log.debug("Snippet information follows:"); if (this.name != null) { log.debug("Name: " + this.name); }//from ww w . j ava 2 s.co m log.debug("Byte range: " + this.byteRange); if (this.comment != null) { log.debug("Comment: " + this.comment); } log.debug("Concluded license: " + this.concludedLicense); if (this.copyrightText != null) { log.debug("Copyright: " + this.copyrightText); } if (this.licenseComment != null) { log.debug("License comment: " + this.licenseComment); } log.debug("License info in Snippet: " + this.licenseInfoInSnippet); if (this.lineRange != null) { log.debug("Line range: " + this.lineRange); } }
From source file:org.spdx.maven.SpdxDefaultFileInformation.java
License:Apache License
/** * Primarily for debugging purposes. Dump all the field information to the log Info * @param log// w w w.ja v a 2 s . com */ public void logInfo(Log log) { log.debug("Default File Comment: " + getComment()); log.debug("Default File Copyright: " + getCopyright()); log.debug("Default File License Comment: " + getLicenseComment()); log.debug("Default File Notice: " + getNotice()); log.debug("Default File Concluded License: " + getConcludedLicense().toString()); log.debug("Default File Declared License: " + getDeclaredLicense().toString()); String[] contributors = getContributors(); if (contributors != null) { for (int i = 0; i < contributors.length; i++) { log.debug("Default File Contributors: " + contributors[i]); } } if (this.snippets != null) { for (SnippetInfo snippet : snippets) { snippet.logInfo(log); } } }
From source file:org.spdx.maven.SpdxProjectInformation.java
License:Apache License
/** * Log information on all fields - typically used for debugging * @param log//from w ww . j av a 2 s . com */ public void logInfo(Log log) { log.debug("SPDX Project Name: " + this.getName()); log.debug("SPDX Document comment: " + this.getDocumentComment()); log.debug("SPDX Creator comment: " + this.getCreatorComment()); log.debug("SPDX Description: " + this.getDescription()); log.debug("SPDX License comment: " + this.getLicenseComment()); log.debug("SPDX Originator: " + this.getOriginator()); log.debug("SPDX PackageArchiveFileName: " + this.getPackageArchiveFileName()); log.debug("SPDX SHA1: " + this.getSha1()); log.debug("SPDX Short description: " + this.getShortDescription()); log.debug("SPDX Supplier: " + this.getSupplier()); log.debug("SPDX Source Info: " + this.getSourceInfo()); log.debug("SPDX Version info: " + this.getVersionInfo()); log.debug("SPDX Concluded license: " + this.getConcludedLicense().toString()); log.debug("SPDX Declared license: " + this.getDeclaredLicense().toString()); log.debug("SPDX Download URL: " + this.getDownloadUrl()); log.debug("SPDX Home page: " + this.getHomePage()); if (this.documentAnnotations != null && this.documentAnnotations.length > 0) { log.debug("Document annotations: "); for (Annotation annotation : documentAnnotations) { annotation.logInfo(log); } } if (this.packageAnnotations != null && this.packageAnnotations.length > 0) { log.debug("Package annotations: "); for (Annotation annotation : packageAnnotations) { annotation.logInfo(log); } } String[] creators = this.getCreators(); if (creators != null) { for (int i = 0; i < creators.length; i++) { log.debug("SPDX Creator: " + creators[i]); } } if (this.externalRefs != null) { for (ExternalReference externalReference : externalRefs) { ExternalRef externalRef; try { externalRef = externalReference.getExternalRef(); StringBuilder externalRefString = new StringBuilder(); externalRefString.append(externalRef.getReferenceCategory().getTag()); externalRefString.append(' '); try { externalRefString.append(ListedReferenceTypes.getListedReferenceTypes() .getListedReferenceName(externalRef.getReferenceType().getReferenceTypeUri())); } catch (InvalidSPDXAnalysisException e) { externalRefString.append("Invalid Reference Type"); } externalRefString.append(' '); externalRefString.append(externalRef.getReferenceLocator()); log.debug("External Ref: " + externalRefString.toString()); } catch (MojoExecutionException e1) { log.error("Invalid external reference", e1); } } } }
From source file:org.spiffyui.maven.plugins.GZipMojo.java
License:Apache License
private void gzip(File path, String[] exts) throws MojoExecutionException, MojoFailureException { List<File> files = new ArrayList<File>(FileUtils.listFiles(path, exts, false)); Log log = getLog(); log.info("GZIP: Compressing artifacts from " + path); for (File file : files) { log.debug("GZIP: " + file.toString()); }/*from www. j a v a 2 s.c o m*/ try { GzipListUtil.zipFileList(files, path); } catch (IOException e) { throw new MojoExecutionException(e.getMessage()); } }
From source file:org.spiffyui.maven.plugins.HTMLPropsMojo.java
License:Apache License
@Override public void execute() throws MojoExecutionException, MojoFailureException { Log log = getLog(); if (!sourceDirectory.exists()) { log.debug("HTMLPROPS: " + sourceDirectory.getAbsolutePath() + " does not exist. Skipping"); return;//from w w w. j a va 2 s . c o m } /* * normalize the packageName string into an java package safe variant * (e.g. no dashes) */ String safePackageName = packageName.replace("-", "_"); try { /* First we generate the properties files and the Java file into the generated sources directory so they can be used in the compiler. */ generateProps(new File(outputDirectory, safePackageName.replace(".", File.separator)), safePackageName); /* Then we call it a second time generating just the properties files for runtime locale resolution. */ generateProps(new File(outputDirectory, safePackageName.replace(".", File.separator)), null); } catch (IOException e) { throw new MojoExecutionException(e.getMessage()); } }
From source file:org.spiffyui.maven.plugins.StubsPropsMojo.java
License:Apache License
@Override public void execute() throws MojoExecutionException, MojoFailureException { Log log = getLog(); if (!sourceDirectory.exists()) { log.debug("Stubs properties: " + sourceDirectory.getAbsolutePath() + " does not exist. Skipping"); return;/* ww w .j a v a 2 s . c om*/ } /* * normalize the packageName string into an java package safe variant * (e.g. no dashes) */ String safePackageName = packageName.replace("-", "_"); try { /* First we generate the properties files and the Java file into the generated sources directory so they can be used in the compiler. */ generateProps(new File(outputDirectory, safePackageName.replace(".", File.separator)), safePackageName); /* Then we call it a second time generating just the properties files for runtime locale resolution. */ generateProps(new File(outputDirectory, safePackageName.replace(".", File.separator)), null); } catch (IOException e) { throw new MojoExecutionException(e.getMessage(), e); } }
From source file:org.symphonyoss.maven.enforcer.RequireGroupIdRule.java
License:Apache License
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException { Log log = helper.getLog(); try {/*from ww w . j a v a 2s.co m*/ String groupId = (String) helper.evaluate("${project.groupId}"); log.debug("Retrieved groupId: " + groupId); if (!groupId.equals(this.groupIdPrefix) && !groupId.startsWith(this.groupIdPrefix + ".")) { throw new EnforcerRuleException( "RequireGroupIdRule is failing because " + groupId + " should start with " + groupIdPrefix); } } catch (ExpressionEvaluationException e) { throw new EnforcerRuleException( "RequireGroupIdRule is unable to lookup an expression " + e.getLocalizedMessage(), e); } }
From source file:org.teatrove.maven.plugins.teacompiler.TeaCompilerMojo.java
License:Apache License
public void execute() throws MojoExecutionException, MojoFailureException { final Log logger = getLog(); // Create the Helper for the Context Class Builder ContextClassBuilderHelper helper = new DefaultContextClassBuilderHelper(session, new TeaCompilerExpressionEvaluator(session, translator, project), logger, container, this.getClass().getClassLoader(), rootPackage); // Merge the contexts final Class<?> contextClass; try {/*from w w w . j av a2 s .c o m*/ if (this.context == null) { if (contextClassBuilder == null) { throw new MojoExecutionException( "Either context or contextClassBuilder parameter is required."); } contextClass = contextClassBuilder.getContextClass(helper); } else { contextClass = Class.forName(this.context); } } catch (ContextClassBuilderException e) { throw new MojoExecutionException("Unable to find or create the Context.", e); } catch (ClassNotFoundException e) { throw new MojoExecutionException("Unable to load the Context.", e); } final File realOutputDirectory = new File(outputDirectory, rootPackage.replace('.', File.separatorChar)); realOutputDirectory.mkdirs(); if (sourceDirectories == null || sourceDirectories.length == 0) { sourceDirectories = new File[] { defaultSourceDirectory }; } else { // Filter out any that don't exist List<File> existing = new ArrayList<File>(sourceDirectories.length); for (File sourceDirectory : sourceDirectories) { if (sourceDirectory.exists()) { existing.add(sourceDirectory); } else if (logger.isDebugEnabled()) { logger.debug("Removing source directory because it does not exist. [" + sourceDirectory + "]."); } } sourceDirectories = existing.toArray(new File[existing.size()]); } final Compiler compiler = new Compiler(rootPackage, realOutputDirectory, encoding, 0); for (File sourceDirectory : sourceDirectories) { compiler.addCompilationProvider(new FileCompilationProvider(sourceDirectory)); } compiler.setClassLoader(contextClass.getClassLoader()); compiler.setRuntimeContext(contextClass); compiler.setForceCompile(force); compiler.addCompileListener(new CompileListener() { public void compileError(CompileEvent e) { logger.error(e.getDetailedMessage()); } public void compileWarning(CompileEvent e) { logger.warn(e.getDetailedMessage()); } }); compiler.setExceptionGuardianEnabled(guardian); final String[] names; try { if (includes == null || includes.length == 0) { names = compiler.compileAll(true); } else { names = compiler.compile(includes); } } catch (IOException e) { throw new MojoExecutionException("I/O error while compiling templates.", e); } final int errorCount = compiler.getErrorCount(); if (errorCount > 0) { String msg = errorCount + " error" + (errorCount != 1 ? "s" : ""); if (failOnError) { throw new MojoFailureException(msg); } else if (logger.isWarnEnabled()) { logger.warn(msg); } } final int warningCount = compiler.getWarningCount(); if (warningCount > 0) { String msg = warningCount + " warning" + (warningCount != 1 ? "s" : ""); if (failOnWarning) { throw new MojoFailureException(msg); } else if (logger.isWarnEnabled()) { logger.warn(msg); } } if (logger.isInfoEnabled()) { logger.info("Compiled the following templates:"); Arrays.sort(names); for (String name : names) { logger.info(name); } } }
From source file:org.universAAL.support.directives.checks.ModulesCheckFix.java
License:Apache License
/** * Checks the project is a POM and a parent POM (ie it has no source). * @param mavenProject2// w w w . jav a 2 s . c o m * @param log log element to output log info. * @return */ private boolean isAparentPOM(MavenProject mavenProject2, Log log) { boolean isAPOM = mavenProject2.getPackaging().equals("pom"); boolean containsSRC = false; for (File f : mavenProject2.getBasedir().listFiles()) { if (f.isDirectory()) { containsSRC |= f.getName().contains("src"); log.debug(f.getName()); log.debug(Boolean.toString(containsSRC)); } } return isAPOM & !containsSRC; }
From source file:org.universAAL.support.directives.checks.ModulesCheckFix.java
License:Apache License
/** * Check whether the pom modules are in the following disposition: * <br>//from www .j a va 2 s. co m * <pre> * parentFolder * L pom.xml * L Module1 * L pom.xml * : * L ModuleN * L pom.xml * </pre> * ie: all of the modules of the pom are children. * @param mavenProject2 * @param log * @return */ private boolean isOfCommonType(MavenProject mp, Log log) { List<String> listed = (List<String>) mp.getModules(); boolean common = true; for (String m : listed) { File mDir = new File(mp.getBasedir(), m); log.debug("checking \n -" + mp.getBasedir().getAbsolutePath() + "\n -" + mDir.getAbsolutePath()); try { /* * for all of the modules: * the parent folder of the module is the same as the parent POMs folder */ common &= mp.getBasedir().equals(mDir.getCanonicalFile().getParentFile()); } catch (IOException e) { log.error(e); } log.debug(Boolean.toString(common)); } return listed.size() > 0 && common; }