List of usage examples for org.apache.maven.project MavenProject getBasedir
public File getBasedir()
From source file:org.ebayopensource.turmeric.maven.banrefs.reports.ConsoleReport.java
License:Open Source License
public ConsoleReport(MavenProject project) { this.basedir = FilenameUtils.normalize(project.getBasedir().getAbsolutePath()); this.entryCount = 0; this.errorCount = 0; }
From source file:org.ebayopensource.turmeric.maven.banrefs.reports.XmlReport.java
License:Open Source License
public XmlReport(Console console, MavenProject project, File outputFile) throws IOException { this.console = console; this.entryCount = 0; this.errorCount = 0; this.writer = new FileWriter(outputFile); this.out = new PrintWriter(writer); this.out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); this.out.printf("<banned-references-report module-root=\"%s\" module-name=\"%s\">%n", XmlUtil.escaped(project.getBasedir().getAbsolutePath()), XmlUtil.escaped(project.getName())); }
From source file:org.ebayopensource.turmeric.maven.config.reports.ConsoleReport.java
License:Open Source License
public ConsoleReport(Console console, MavenProject project) { super(console); this.basedir = FilenameUtils.normalize(project.getBasedir().getAbsolutePath()); }
From source file:org.ebayopensource.turmeric.maven.config.reports.XmlReport.java
License:Open Source License
public XmlReport(Console console, MavenProject project, File outputFile) throws IOException { super(console); this.writer = new FileWriter(outputFile); this.out = new PrintWriter(writer); this.out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); this.out.printf("<config-validation-report module-root=\"%s\" module-name=\"%s\">%n", XmlUtil.escaped(project.getBasedir().getAbsolutePath()), XmlUtil.escaped(project.getName())); }
From source file:org.ebayopensource.turmeric.maven.license.reports.ConsoleReport.java
License:Open Source License
public ConsoleReport(MavenProject project) { this.basedir = FilenameUtils.normalize(project.getBasedir().getAbsolutePath()); this.entryCount = 0; this.passCount = 0; this.violationCount = 0; this.failureCount = 0; }
From source file:org.ebayopensource.turmeric.maven.license.reports.XmlReport.java
License:Open Source License
public XmlReport(Console console, MavenProject project, File outputFile) throws IOException { this.console = console; this.entryCount = 0; this.passCount = 0; this.violationCount = 0; this.failureCount = 0; this.writer = new FileWriter(outputFile); this.out = new PrintWriter(writer); this.out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); this.out.printf("<license-report module-root=\"%s\" module-name=\"%s\">%n", XmlUtil.escaped(project.getBasedir().getAbsolutePath()), XmlUtil.escaped(project.getName())); }
From source file:org.ebayopensource.turmeric.plugins.maven.util.ProjectClassLoader.java
License:Open Source License
private static URL[] getMavenProjectClassLoaderURLS(MavenProject project) throws MalformedURLException { List<File> searchPaths = new ArrayList<File>(); // Project Compile Artifacts @SuppressWarnings("unchecked") final List<Artifact> arts = project.getCompileArtifacts(); if (arts != null) { for (Artifact arti : arts) { File artiFile = arti.getFile(); if ((artiFile != null) && (artiFile.exists())) { searchPaths.add(artiFile); }//from w w w.j a va 2s . c o m } } // Project Resources @SuppressWarnings("unchecked") final List<Resource> resources = project.getBuild().getResources(); for (Resource resource : resources) { String resDir = resource.getDirectory(); File dir = new File(resDir); if (!dir.isAbsolute()) { dir = new File(project.getBasedir(), resDir); } searchPaths.add(dir); } // The Classes Dir File classesDir = new File(project.getBuild().getOutputDirectory()); if (!classesDir.isAbsolute()) { classesDir = new File(project.getBasedir(), project.getBuild().getOutputDirectory()); } searchPaths.add(classesDir); // Compile Source Roots - (needed for codegen javac) @SuppressWarnings("unchecked") List<String> sourceRoots = project.getCompileSourceRoots(); if (sourceRoots != null) { for (String srcRoot : sourceRoots) { if (StringUtils.isBlank(srcRoot)) { // skip continue; } File src = new File(srcRoot); if (src.exists()) { searchPaths.add(new File(srcRoot)); } } } int count = searchPaths.size(); URL urls[] = new URL[count]; for (int i = 0; i < count; i++) { urls[i] = searchPaths.get(i).toURI().toURL(); System.out.printf("### ProjectClassLoader[%d]: %s%n", i, urls[i].toExternalForm()); } return urls; }
From source file:org.ebayopensource.turmeric.plugins.stubs.ProjectClassLoader.java
License:Open Source License
private static URL[] getMavenProjectClassLoaderURLS(MavenProject project) throws MalformedURLException { List<File> searchPaths = new ArrayList<File>(); // Project Compile Artifacts @SuppressWarnings("unchecked") final List<Artifact> arts = project.getCompileArtifacts(); if (arts != null) { for (Artifact arti : arts) { File artiFile = arti.getFile(); if ((artiFile != null) && (artiFile.exists())) { searchPaths.add(artiFile); }/*from ww w. j a v a 2 s .c o m*/ } } // Project Resources final List<Resource> resources = project.getBuild().getResources(); for (Resource resource : resources) { String resDir = resource.getDirectory(); File dir = new File(resDir); if (!dir.isAbsolute()) { dir = new File(project.getBasedir(), resDir); } searchPaths.add(dir); } // The Classes Dir File classesDir = new File(project.getBuild().getOutputDirectory()); if (!classesDir.isAbsolute()) { classesDir = new File(project.getBasedir(), project.getBuild().getOutputDirectory()); } searchPaths.add(classesDir); // Compile Source Roots - (needed for codegen javac) @SuppressWarnings("unchecked") List<String> sourceRoots = project.getCompileSourceRoots(); if (sourceRoots != null) { for (String srcRoot : sourceRoots) { if (StringUtils.isBlank(srcRoot)) { // skip continue; } File src = new File(srcRoot); if (src.exists()) { searchPaths.add(new File(srcRoot)); } } } int count = searchPaths.size(); URL urls[] = new URL[count]; for (int i = 0; i < count; i++) { urls[i] = searchPaths.get(i).toURI().toURL(); System.out.printf("### ProjectClassLoader[%d]: %s%n", i, urls[i].toExternalForm()); } return urls; }
From source file:org.eclipse.m2e.core.internal.embedder.MavenImpl.java
License:Open Source License
public void interpolateModel(MavenProject project, Model model) throws CoreException { ModelBuildingRequest request = new DefaultModelBuildingRequest(); request.setUserProperties(project.getProperties()); ModelProblemCollector problems = new ModelProblemCollector() { public void add(ModelProblem.Severity severity, String message, InputLocation location, Exception cause) { }//from w w w. j a va2 s. co m }; lookup(ModelInterpolator.class).interpolateModel(model, project.getBasedir(), request, problems); }
From source file:org.eclipse.m2e.editor.xml.internal.lifecycle.LifecycleMappingDialog.java
License:Open Source License
private MavenProject locatePlugin() { MavenProject project = facade.getMavenProject(); // if we got here, facade.getMavenProject cannot be null Plugin plugin = project.getPlugin(pluginGroupId + ":" + pluginArtifactId); if (plugin == null) { return null; // can't really happy }// w w w . j a v a 2 s . com InputLocation location = plugin.getLocation(""); if (location == null || location.getSource() == null || location.getSource().getLocation() == null) { // that's odd. where does this come from??? return null; } File basedir = new File(location.getSource().getLocation()).getParentFile(); // should be canonical file already for (MavenProject other : pomComposite.getHierarchy()) { if (basedir.equals(other.getBasedir())) { return other; } } return null; }