protected URLClassLoader createClassLoader() throws DependencyResolutionRequiredException, MalformedURLException { List<URL> urls = appendElements(project.getRuntimeClasspathElements()); urls.addAll(appendElements(project.getTestClasspathElements())); return new URLClassLoader(urls.toArray(new URL[urls.size()]), Thread.currentThread().getContextClassLoader()); }
String [] troots = project.getTestClasspathElements().toArray(new String[0]);
@SuppressWarnings("unchecked") private List<File> getCompiledDirs(final MavenProject project) throws Exception { final List<String> sourceRoots = new ArrayList<>(); for (final Object artifactObj : FCollection .filter(project.getPluginArtifactMap().values(), new DependencyFilter( new PluginServices(this.getClass().getClassLoader())))) { final Artifact artifact = (Artifact) artifactObj; sourceRoots.add(artifact.getFile().getAbsolutePath()); } return convertToRootDirs(project.getTestClasspathElements(), Arrays.asList(project.getBuild().getOutputDirectory(), project.getBuild().getTestOutputDirectory()), sourceRoots); } }
public ReportOptions convert() { final List<String> classPath = new ArrayList<>(); try { classPath.addAll(this.mojo.getProject().getTestClasspathElements()); } catch (final DependencyResolutionRequiredException e1) { this.log.info(e1); } addOwnDependenciesToClassPath(classPath); classPath.addAll(this.mojo.getAdditionalClasspathElements()); for (Object artifact : this.mojo.getProject().getArtifacts()) { final Artifact dependency = (Artifact) artifact; if (this.mojo.getClasspathDependencyExcludes().contains( dependency.getGroupId() + ":" + dependency.getArtifactId())) { classPath.remove(dependency.getFile().getPath()); } } ReportOptions option = parseReportOptions(classPath); return updateFromSurefire(option); }
@Override protected List<String> getClassPathElements() throws DependencyResolutionRequiredException { return project.getTestClasspathElements(); }
@SuppressWarnings("unchecked") @Override protected List<String> getClasspathElements() throws Exception { return project.getTestClasspathElements(); }
@Override protected List<String> getClasspathElements() throws DependencyResolutionRequiredException { return project.getTestClasspathElements(); } }
protected List getProjectClasspathElements() throws DependencyResolutionRequiredException { return project.getTestClasspathElements(); }
protected List getProjectClasspathElements() throws DependencyResolutionRequiredException { return project.getTestClasspathElements(); }
/** {@inheritDoc} */ @Override protected List<String> getCompileClasspathElements( MavenProject p ) throws DependencyResolutionRequiredException { return ( p.getTestClasspathElements() == null ? Collections.<String>emptyList() : new LinkedList<>( p.getTestClasspathElements() ) ); }
@SuppressWarnings( "unchecked" ) private List<String> classpathElements() throws MojoExecutionException { try { // todo : should we combine both compile and test scoped elements? return ( List<String> ) project.getTestClasspathElements(); } catch ( DependencyResolutionRequiredException e ) { throw new MojoExecutionException( "Call to Project#getCompileClasspathElements required dependency resolution" ); } }
protected List<String> getProjectClasspath() throws DependencyResolutionRequiredException { if (addProjectClasspath) { return project.getTestClasspathElements(); } else { return new ArrayList<String>(); } }
protected List<String> getProjectClasspath() throws DependencyResolutionRequiredException { if (addProjectClasspath) { return project.getTestClasspathElements(); } else { return new ArrayList<String>(); } }
private List<String> testClasspathElements() { try { return (List<String>) project.getTestClasspathElements(); } catch (DependencyResolutionRequiredException e) { // There's really no known way this exception can happen since // the @requiresDependencyResolution at the top of the class // defines test-scoped resolution. throw new IllegalStateException("Dependency resolution should be test-scoped.", e); } }
/** * {@inheritDoc} */ @Override protected List<String> getClasspath() throws MojoExecutionException { try { return (List<String>) getProject().getTestClasspathElements(); } catch (DependencyResolutionRequiredException e) { throw new MojoExecutionException("Could not retrieve Compile classpath.", e); } }
/** * {@inheritDoc} */ @Override protected List<String> getClasspath() throws MojoExecutionException { try { return (List<String>) getProject().getTestClasspathElements(); } catch (DependencyResolutionRequiredException e) { throw new MojoExecutionException("Could not retrieve Compile classpath.", e); } }
public static URLClassLoader getTestClassLoader(MavenProject project) { try { List<String> classpathElements = project.getTestClasspathElements(); return createClassLoader(classpathElements, project.getBuild().getTestOutputDirectory()); } catch (DependencyResolutionRequiredException e) { throw new IllegalArgumentException("Cannot resolve artifact from test classpath", e); } }
@Override protected List<String> getClasspathElements() { try { return getMavenProject().getTestClasspathElements(); } catch (DependencyResolutionRequiredException e) { getLog().error(e); } return null; } }
private List<String> getClasspathForScope( ProjectBuildingResult projectBuildingResult, String scope) throws DependencyResolutionRequiredException { MavenProject project = projectBuildingResult.getProject(); if ("compile".equalsIgnoreCase(scope)) { return project.getCompileClasspathElements(); } else if ("runtime".equalsIgnoreCase(scope)) { return project.getRuntimeClasspathElements(); } return project.getTestClasspathElements(); }
public void addRuntime(PluginAbstractMojo mojo) { try { if (mojo.getProject() == null) { return; } add(mojo.getProject().getTestClasspathElements()); add(mojo.getProject().getRuntimeClasspathElements()); } catch (DependencyResolutionRequiredException e) { throw new RuntimeException(e); } }