List of usage examples for org.apache.maven.plugin.logging Log debug
void debug(Throwable error);
From source file:org.phpmaven.project.impl.PhpProject.java
License:Apache License
/** * @param info//w ww . ja v a 2 s. com * @param dep */ private void performBootstrap(Log log, final DependencyInformation info, final Artifact dep, BootstrapInfo bootstrapInfo) { final String depKey = getDepKey(dep); log.debug("Dependency " + depKey + " will be passed to bootstrap."); final BootstrapFileInfo fileInfo = new BootstrapFileInfo(); fileInfo.setGroupId(dep.getGroupId()); fileInfo.setArtifactId(dep.getArtifactId()); fileInfo.setVersion(dep.getVersion()); fileInfo.setPharFile(dep.getFile()); DependencyArtifact artifact = info.get(depKey); if (artifact == null || !artifact.getActionStatement().equals("bootstrap")) { fileInfo.setNew(true); artifact = new DependencyArtifact(); artifact.setDepKey(depKey); artifact.setActionStatement("bootstrap"); artifact.setFileTimestamp(dep.getFile().lastModified()); artifact.setReposFile(dep.getFile()); } else if (artifact.getFileTimestamp() != dep.getFile().lastModified() || !artifact.getReposFile().equals(dep.getFile())) { fileInfo.setChanged(true); artifact.setFileTimestamp(dep.getFile().lastModified()); artifact.setReposFile(dep.getFile()); } bootstrapInfo.add(fileInfo); }
From source file:org.phpmaven.project.impl.PhpProject.java
License:Apache License
/** * @param log//from w ww . j a va2 s . c om * @param targetDir * @param dep * @param packedElements * @param info * @throws IOException */ private void performClassic(final Log log, File targetDir, final Artifact dep, final List<String> packedElements, DependencyInformation info) throws IOException { try { final String depKey = getDepKey(dep); if (this.getProjectFromArtifact(dep).getFile() != null) { // Reference to a local project; should only happen in IDEs or multi-project-poms log.debug("Dependency " + depKey + " resolved to a local project. skipping."); // the maven-php-project plugin will fix it by adding the include paths } else { final DependencyArtifact depArtifact = new DependencyArtifact(); depArtifact.setDepKey(depKey); depArtifact.setActionStatement("classic"); depArtifact.setFileTimestamp(dep.getFile().lastModified()); depArtifact.setReposFile(dep.getFile()); if (info.containsKey(depKey) && info.get(depKey).equals(depArtifact)) { // check info for changes on that dependency log.info("Dependency " + depKey + " is up to date. skipping..."); } else { log.info("Extracting " + dep.getFile().getAbsolutePath() + " to target directory"); FileHelper.unzipElements(log, targetDir, packedElements, factory, session); info.put(depKey, depArtifact); } } } catch (ProjectBuildingException ex) { throw new IOException("Problems creating maven project from dependency", ex); } }
From source file:org.pitest.maven.report.ReportSourceLocator.java
License:Apache License
private File executeLocator(File reportsDirectory, Log log) { File[] subdirectories = reportsDirectory.listFiles(TIMESTAMPED_REPORTS_FILE_FILTER); File latest = reportsDirectory; log.debug("ReportSourceLocator starting search in directory [" + reportsDirectory.getAbsolutePath() + "]"); if (subdirectories != null) { LastModifiedFileComparator c = new LastModifiedFileComparator(); for (File f : subdirectories) { log.debug("comparing directory [" + f.getAbsolutePath() + "] with the current latest directory of [" + latest.getAbsolutePath() + "]"); if (c.compare(latest, f) < 0) { latest = f;/* w ww .j ava 2 s . c o m*/ log.debug("directory [" + f.getAbsolutePath() + "] is now the latest"); } } } else { throw new PitError("could not list files in directory [" + reportsDirectory.getAbsolutePath() + "] because of an unknown I/O error"); } log.debug("ReportSourceLocator determined directory [" + latest.getAbsolutePath() + "] is the directory containing the latest pit reports"); return latest; }
From source file:org.renjin.gcc.maven.GccBridgeHelper.java
License:Open Source License
public static void extractHeaders(Log log, Artifact artifact, File unpackedIncludeDir) throws MojoExecutionException { if (artifact.getFile() == null) { throw new MojoExecutionException("Depedency " + artifact.getId() + " has not been resolved."); }/*from w w w. ja v a 2 s .c o m*/ try (JarInputStream in = new JarInputStream(new FileInputStream(artifact.getFile()))) { JarEntry entry; while ((entry = in.getNextJarEntry()) != null) { if (!entry.isDirectory()) { File destFile = new File(unpackedIncludeDir + File.separator + entry.getName()); log.debug("Unpacking " + entry.getName() + " to " + destFile); ensureDirExists(destFile.getParentFile()); org.renjin.repackaged.guava.io.Files.asByteSink(destFile).writeFrom(in); } } } catch (IOException e) { throw new MojoExecutionException("Exception unpacking headers", e); } }
From source file:org.renjin.gcc.maven.GccBridgeHelper.java
License:Open Source License
public static ClassLoader getLinkClassLoader(MavenProject project, Log log) throws MojoExecutionException { try {/*from w w w .j av a2 s . c om*/ log.debug("GCC-Bridge Link Classpath: "); List<URL> classpathURLs = Lists.newArrayList(); classpathURLs.add(new File(project.getBuild().getOutputDirectory()).toURI().toURL()); for (Artifact artifact : (List<Artifact>) project.getCompileArtifacts()) { log.debug(" " + artifact.getFile()); classpathURLs.add(artifact.getFile().toURI().toURL()); } ClassLoader parent = GccBridgeHelper.class.getClassLoader(); return new URLClassLoader(classpathURLs.toArray(new URL[classpathURLs.size()]), parent); } catch (MalformedURLException e) { throw new MojoExecutionException("Exception resolving classpath", e); } }
From source file:org.rhq.core.tool.pluginvalidator.PluginValidatorMojo.java
License:Open Source License
public void execute() throws MojoExecutionException, MojoFailureException { Log log = getLog(); log.info("Validating RHQ Plugin"); // Determine where the plugin is String pluginJarName = project.getArtifactId() + "-" + project.getVersion() + ".jar"; String pluginDirectory = project.getBasedir().getAbsolutePath(); log.debug("Plugin JAR: " + pluginJarName); log.debug("Plugin Directory: " + pluginDirectory); File pluginFile = new File(pluginDirectory, pluginJarName); if (!pluginFile.exists()) { throw new MojoFailureException("Cannot find plugin"); }//from ww w . j a va2 s . c o m // Load into validator URL pluginUrl; try { pluginUrl = pluginFile.toURL(); } catch (MalformedURLException e) { throw new MojoFailureException("Could not load URL for plugin file: " + pluginFile); } log.info("Plugin descriptor directory URL:" + pluginUrl); SimplePluginFinder finder = new SimplePluginFinder(pluginUrl); // Validate boolean success = PluginValidator.validatePlugins(finder); if (success) { log.info("--------------------------"); log.info("Plugin Validation: SUCCESS"); log.info("--------------------------"); } else { log.info("--------------------------"); log.info("Plugin Validation: FAILURE"); log.info("--------------------------"); throw new MojoFailureException( "Plugin validation failed. Check the rest of the log for more information."); } }
From source file:org.richfaces.cdk.rd.mojo.ResourceDependencyMojo.java
License:Open Source License
public ComponentsHandler findComponents(File webSourceDir, Map<String, Components> components, String[] includes, String[] excludes) throws Exception { if (includes == null) { includes = PluginUtils.DEFAULT_PROCESS_INCLUDES; }/*from ww w. j av a 2 s.co m*/ if (excludes == null) { excludes = new String[0]; } DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir(webSourceDir); scanner.setIncludes(includes); scanner.setExcludes(excludes); scanner.addDefaultExcludes(); getLog().info("search *.xhtml files"); scanner.scan(); String[] collectedFiles = scanner.getIncludedFiles(); for (String collectedFile : collectedFiles) { getLog().info(collectedFile + " found"); } ComponentsHandler handler = new ComponentsHandler(getLog()); handler.setComponents(components); handler.setScriptIncludes(scriptIncludes); handler.setScriptExcludes(scriptExcludes); handler.setStyleIncludes(styleIncludes); handler.setStyleExcludes(styleExcludes); handler.setComponentIncludes(componentIncludes); handler.setComponentExcludes(componentExcludes); handler.setNamespaceIncludes(namespaceIncludes); handler.setNamespaceExcludes(namespaceExcludes); SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); saxParserFactory.setNamespaceAware(true); Log log = getLog(); for (String processFile : collectedFiles) { SAXParser saxParser = saxParserFactory.newSAXParser(); File file = new File(webSourceDir, processFile); if (file.exists()) { if (log.isDebugEnabled()) { log.debug("start process file: " + file.getPath()); } try { saxParser.parse(file, handler); } catch (Exception e) { if (log.isDebugEnabled()) { log.error("Error process file: " + file.getPath() + "\n" + e.getMessage(), e); } else { log.error("Error process file: " + file.getPath() + "\n" + e.getMessage()); } } } } return handler; }
From source file:org.sonatype.maven.polyglot.plugin.ExecuteMojo.java
License:Open Source License
@Override public void execute() throws MojoExecutionException, MojoFailureException { Log log = getLog(); Model model = project.getModel();/*from w w w . jav a2 s . c o m*/ if (log.isDebugEnabled()) { log.debug("Executing task '" + taskId + "' for model: " + model.getId()); } assert manager != null; List<ExecuteTask> tasks = manager.getTasks(model); // if there are no tasks that means we run in proper maven and // have to load the nativePom to setup the ExecuteManager if (tasks.size() == 0 && nativePom != null) { // TODO avoid parsing the nativePom for each task tasks = manager.getTasks(modelFromNativePom(log)); } ExecuteContext ctx = new ExecuteContext() { @Override public MavenProject getProject() { return project; } @Override public File basedir() { return project.getBasedir(); } @Override public Log log() { return getLog(); } }; for (ExecuteTask task : tasks) { if (taskId.equals(task.getId())) { log.debug("Executing task: " + task.getId()); try { task.execute(ctx); return; } catch (Exception e) { throw new MojoExecutionException(e.getMessage(), e); } } } throw new MojoFailureException("Unable to find task for id: " + taskId); }
From source file:org.sonatype.maven.polyglot.plugin.ExecuteMojo.java
License:Open Source License
protected Model modelFromNativePom(Log log) throws MojoExecutionException, MojoFailureException { Map<String, ModelSource> options = new HashMap<String, ModelSource>(); options.put(ModelProcessor.SOURCE, new FileModelSource(nativePom)); assert modelManager != null; try {/* w ww . j av a 2s . c om*/ ModelReader reader = modelManager.getReaderFor(options); if (reader == null) { throw new MojoExecutionException("no model reader found for " + nativePom); } if (log.isDebugEnabled()) { log.debug("Parsing native pom " + nativePom); } return reader.read(nativePom, options); } catch (IOException e) { throw new MojoFailureException("error parsing " + nativePom, e); } }
From source file:org.spdx.maven.Annotation.java
License:Apache License
public void logInfo(Log log) { log.debug("Annotator: " + this.annotator + ", Date: " + this.annotationDate + ", Type: " + this.annotationType); }