List of usage examples for org.apache.maven.plugin.logging Log info
void info(Throwable error);
From source file:org.eclipse.scada.build.helper.DefaultPomHelper.java
License:Open Source License
@Override public Set<MavenProject> expandProjects(final Collection<MavenProject> projects, final Log log, final MavenSession session) { try {//from w ww . ja v a 2 s . c o m final Set<MavenProject> result = new HashSet<MavenProject>(); final Queue<MavenProject> queue = new LinkedList<MavenProject>(projects); while (!queue.isEmpty()) { final MavenProject project = queue.poll(); log.debug("Checking project: " + project); if (project.getFile() == null) { log.info("Skipping non-local project: " + project); continue; } if (!result.add(project)) { // if the project was already in our result, there is no need to process twice continue; } // add all children to the queue queue.addAll(loadChildren(project, log, session)); if (hasLocalParent(project)) { // if we have a parent, add the parent as well queue.add(project.getParent()); } } return result; } catch (final Exception e) { throw new RuntimeException(e); } }
From source file:org.eclipse.xtend.maven.AbstractXtendCompilerMojo.java
License:Open Source License
protected void compile(String classPath, List<String> sourcePaths, String outputPath) throws MojoExecutionException { XtendBatchCompiler compiler = getBatchCompiler(); Log log = getLog(); compiler.setResourceSetProvider(new MavenProjectResourceSetProvider(project)); Iterable<String> filtered = filter(sourcePaths, FILE_EXISTS); if (Iterables.isEmpty(filtered)) { String dir = Iterables.toString(sourcePaths); log.info("skip compiling sources because the configured directory '" + dir + "' does not exist."); return;//from w w w. ja v a 2s .c o m } String baseDir = project.getBasedir().getAbsolutePath(); log.debug("Set Java Compliance Level: " + javaSourceVersion); compiler.setJavaSourceVersion(javaSourceVersion); log.debug("Set generateSyntheticSuppressWarnings: " + generateSyntheticSuppressWarnings); compiler.setGenerateSyntheticSuppressWarnings(generateSyntheticSuppressWarnings); log.debug("Set generateGeneratedAnnotation: " + generateGeneratedAnnotation); compiler.setGenerateGeneratedAnnotation(generateGeneratedAnnotation); log.debug("Set includeDateInGeneratedAnnotation: " + includeDateInGeneratedAnnotation); compiler.setIncludeDateInGeneratedAnnotation(includeDateInGeneratedAnnotation); log.debug("Set generatedAnnotationComment: " + generatedAnnotationComment); compiler.setGeneratedAnnotationComment(generatedAnnotationComment); log.debug("Set baseDir: " + baseDir); compiler.setBasePath(baseDir); log.debug("Set temp directory: " + getTempDirectory()); compiler.setTempDirectory(getTempDirectory()); log.debug("Set DeleteTempDirectory: " + false); compiler.setDeleteTempDirectory(false); log.debug("Set classpath: " + classPath); compiler.setClassPath(classPath); String bootClassPath = getBootClassPath(); log.debug("Set bootClasspath: " + bootClassPath); compiler.setBootClassPath(bootClassPath); log.debug("Set source path: " + concat(File.pathSeparator, newArrayList(filtered))); compiler.setSourcePath(concat(File.pathSeparator, newArrayList(filtered))); log.debug("Set output path: " + outputPath); compiler.setOutputPath(outputPath); log.debug("Set encoding: " + encoding); compiler.setFileEncoding(encoding); log.debug("Set writeTraceFiles: " + writeTraceFiles); compiler.setWriteTraceFiles(writeTraceFiles); if (!compiler.compile()) { String dir = concat(File.pathSeparator, newArrayList(filtered)); throw new MojoExecutionException("Error compiling xtend sources in '" + dir + "'."); } }
From source file:org.eluder.coveralls.maven.plugin.logging.CoverageTracingLogger.java
License:Open Source License
@Override public void log(final Log log) { log.info("Gathered code coverage metrics for " + getFiles() + " source files with " + getLines() + " lines of code:"); log.info("- " + getRelevant() + " relevant lines"); log.info("- " + getCovered() + " covered lines"); log.info("- " + getMissed() + " missed lines"); }
From source file:org.eluder.coveralls.maven.plugin.logging.DryRunLogger.java
License:Open Source License
@Override public void log(final Log log) { if (dryRun) { log.info("Dry run enabled, Coveralls report will NOT be submitted to API"); log.info(coverallsFile.length() + " bytes of data was recorded in " + coverallsFile.getAbsolutePath()); }/*from w w w .j a va2 s. co m*/ }
From source file:org.eluder.coveralls.maven.plugin.logging.JobLogger.java
License:Open Source License
@Override public void log(final Log log) { StringBuilder starting = new StringBuilder("Starting Coveralls job"); if (job.getServiceName() != null) { starting.append(" for " + job.getServiceName()); if (job.getServiceJobId() != null) { starting.append(" (" + job.getServiceJobId() + ")"); } else if (job.getServiceBuildNumber() != null) { starting.append(" (" + job.getServiceBuildNumber()); if (job.getServiceBuildUrl() != null) { starting.append(" / " + job.getServiceBuildUrl()); }/*from w w w. jav a2 s.c om*/ starting.append(")"); } } if (job.isDryRun()) { starting.append(" in dry run mode"); } log.info(starting.toString()); if (job.getRepoToken() != null) { log.info("Using repository token <secret>"); } if (job.getGit() != null) { String commit = job.getGit().getHead().getId(); String branch = (job.getBranch() != null ? job.getBranch() : job.getGit().getBranch()); log.info("Git commit " + commit.substring(0, ABBREV) + " in " + branch); } if (log.isDebugEnabled()) { try { log.debug("Complete Job description:\n" + jsonMapper.writeValueAsString(job)); } catch (JsonProcessingException ex) { throw new RuntimeException(ex); } } }
From source file:org.evosuite.maven.util.EvoSuiteRunner.java
License:Open Source License
private void handleProcessOutput(final Process process, final Log logger) { Thread reader = new Thread() { @Override/*from w w w .j a v a 2 s . co m*/ public void run() { try { BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream())); while (!this.isInterrupted()) { String line = in.readLine(); if (line != null && !line.isEmpty()) { logger.info(line); } } } catch (Exception e) { logger.debug("Exception while reading spawn process output: " + e.toString()); } } }; reader.start(); logger.debug("Started thread to read spawn process output"); }
From source file:org.fornax.toolsupport.ChecksumValidatorMojo.java
License:Apache License
/** * Load checksum from file specified as checksumFile. * * @return checksum HashMap/*from ww w. j ava 2s .c o m*/ * @throws MojoExecutionException */ public static HashMap<String, String> loadChecksums(File dir, String checksumFile, Log log) throws MojoExecutionException { HashMap<String, String> checkMap = new HashMap<String, String>(); File chksumFile = beforeRead(dir, checksumFile); if (!chksumFile.canRead()) { log.info("Could not read checksum file: " + chksumFile.getPath()); return checkMap; } BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(chksumFile)); String line; while ((line = reader.readLine()) != null) { if (!line.startsWith("#")) { String[] splitLine = line.split(":"); if (splitLine.length == 2) { checkMap.put(splitLine[1], splitLine[0]); } } } reader.close(); } catch (IOException e) { log.info("Could not load checksum file: " + chksumFile.getPath()); } finally { try { reader.close(); } catch (Throwable e) { } } return checkMap; }
From source file:org.fornax.toolsupport.ChecksumValidatorMojo.java
License:Apache License
/** * Load ignored files from file specified as ignoreChecksumFile. * * @return checksum HashMap/*from ww w.jav a2s . c om*/ * @throws MojoExecutionException */ public static ArrayList<String> loadIgnoreFile(File dir, String ignoreChecksumFile, Log log) throws MojoExecutionException { ArrayList<String> ignoreArray = new ArrayList<String>(); File ignChksumFile = beforeRead(dir, ignoreChecksumFile); if (!ignChksumFile.canRead()) { log.info("Could not read ignore file: " + ignChksumFile.getPath()); return ignoreArray; } BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(ignChksumFile)); String line; while ((line = reader.readLine()) != null) { if (!line.startsWith("#") && line.length() > 5) { ignoreArray.add(line); } } } catch (IOException e) { log.info("Could not load ignore file: " + ignChksumFile.getPath()); } finally { try { reader.close(); } catch (Throwable e) { } } return ignoreArray; }
From source file:org.genantics.maven.PegGenMojo.java
License:Open Source License
public void execute() throws MojoExecutionException { // NB: This could be more compactly written using PegGen, // but calling the parser and generator separately // allows better debugging. try {// w ww . ja va2 s .co m Log log = getLog(); // FIXME - what is the right way to do this? File file = projectPath != null ? new File(projectPath) : new File("."); // For debugging String canon = file.getCanonicalPath(); if (!grammarExtension.startsWith(".")) grammarExtension = "." + grammarExtension; pegDirName = sourceDirectory; int slash = sourceDirectory.lastIndexOf('/'); if (slash < 0) slash = sourceDirectory.lastIndexOf(File.separatorChar); if (slash >= 0) pegDirName = sourceDirectory.substring(slash + 1); locateGrammars(file); if (grammars.isEmpty()) { log.info("There are no grammars in " + sourceDirectory); return; } for (Grammar grammar : grammars) { char[] buf = new char[(int) grammar.file.length()]; Reader reader = new FileReader(grammar.file); try { reader.read(buf); } finally { reader.close(); } Parser parser = new Parser(); Node[] nodes = parser.parseGrammar(buf, 0, buf.length); if (nodes == null || nodes.length == 0) { log.error("Parsing " + grammar.file.getCanonicalPath()); List list = parser.getErrors(); if (list != null) { for (Object err : list) { log.error(err.toString()); } } throw new MojoExecutionException("Parse errors"); } File target = new File(file, outputDirectory); if (!target.exists()) { if (!target.mkdirs()) { log.error("Can't create " + outputDirectory); return; } } StringBuilder sb = new StringBuilder(); collectRelativePath(grammar.file, sb); String relativePath = sb.toString(); File outFile = new File(target, relativePath); File outDir = outFile.getParentFile(); if (!outDir.exists()) { if (!outDir.mkdirs()) { log.error("Can't create output directory " + outDir.getCanonicalPath()); return; } } int dirEnd = relativePath.lastIndexOf('/'); String pkg = dirEnd < 0 ? "" : relativePath.substring(0, dirEnd).replace('/', '.'); PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(outFile))); String className = outFile.getName(); // extension is always .java className = className.substring(0, className.length() - ".java".length()); try { SimplePegGenerator gen = new SimplePegGenerator(); gen.generate(nodes[0], buf, writer, pkg, className, null, " "); } finally { writer.close(); } log.info("Generated " + outFile.getCanonicalPath()); } } catch (IOException e) { throw new MojoExecutionException("", e); } }
From source file:org.gephi.maven.MetadataUtils.java
License:Apache License
/** * Lookup and return the content of the README.md file for this plugin. * * @param project project//from w w w. ja va 2 s .c o m * @param log log * @return content of REDME.md file or null if not found */ protected static String getReadme(MavenProject project, Log log) { File readmePath = new File(project.getBasedir(), "README.md"); if (readmePath.exists()) { log.debug("README.md file has been found: '" + readmePath.getAbsolutePath() + "'"); try { StringBuilder builder = new StringBuilder(); LineNumberReader fileReader = new LineNumberReader(new FileReader(readmePath)); String line; while ((line = fileReader.readLine()) != null) { builder.append(line); builder.append("\n"); } log.info("File README.md with " + builder.length() + " characters has been attached to project '" + project.getName() + "'"); return builder.toString(); } catch (IOException ex) { log.error("Error while reading README.md file", ex); } } return null; }