List of usage examples for org.apache.maven.project MavenProject getCompileArtifacts
@Deprecated
public List<Artifact> getCompileArtifacts()
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 a2 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.pustefixframework.maven.plugins.Reflection.java
License:Open Source License
@SuppressWarnings("unchecked") private static List<Artifact> extracted(MavenProject project) { return project.getCompileArtifacts(); }
From source file:org.renjin.gcc.maven.GccBridgeHelper.java
License:Open Source License
public static ClassLoader getLinkClassLoader(MavenProject project, Log log) throws MojoExecutionException { try {/* w ww.j a va2 s .co m*/ 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); } }