public Map getArtifactMap() { if ( artifactMap == null ) { artifactMap = ArtifactUtils.artifactMapByVersionlessId( getArtifacts() ); } return artifactMap; }
public Map<String, Artifact> getArtifactMap() { if ( artifactMap == null ) { artifactMap = ArtifactUtils.artifactMapByVersionlessId( getArtifacts() ); } return artifactMap; }
@Deprecated public List<Artifact> getTestArtifacts() { List<Artifact> list = new ArrayList<>( getArtifacts().size() ); for ( Artifact a : getArtifacts() ) { // TODO classpath check doesn't belong here - that's the other method if ( a.getArtifactHandler().isAddedToClasspath() ) { list.add( a ); } } return list; }
public List getTestArtifacts() { List list = new ArrayList( getArtifacts().size() ); for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) { Artifact a = (Artifact) i.next(); // TODO: classpath check doesn't belong here - that's the other method if ( a.getArtifactHandler().isAddedToClasspath() ) { // TODO: let the scope handler deal with this // NOTE: [jc] scope == 'test' is the widest possible scope, so we don't really need to perform // this check... // if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || Artifact.SCOPE_COMPILE.equals( a.getScope() ) || // Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) // { // list.add( a ); // } list.add( a ); } } return list; }
@SuppressWarnings("unchecked") public List<URL> build() throws MalformedURLException { List<URL> cp = new ArrayList<>(); cp.addAll(resources(project.getResources())); cp.add(new File(project.getBuild().getOutputDirectory()).toURI().toURL()); cp.addAll(jars(project.getArtifacts())); return cp; }
public List getSystemArtifacts() { List list = new ArrayList( getArtifacts().size() ); for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) { Artifact a = (Artifact) i.next(); // TODO: classpath check doesn't belong here - that's the other method if ( a.getArtifactHandler().isAddedToClasspath() ) { // TODO: let the scope handler deal with this if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) { list.add( a ); } } } return list; }
@SuppressWarnings("unchecked") private Set<Artifact> references(final MavenProject project) { MavenProject parent = project.getParent(); if (parent != null) { List<String> modules = parent.getModules(); if (modules != null) { Set<Artifact> artifacts = new LinkedHashSet<Artifact>(mavenProject.getArtifacts()); String groupId = project.getGroupId(); String version = project.getVersion(); return artifacts.stream() .filter(a -> a.getGroupId().equals(groupId) && a.getVersion().equals(version) && modules.contains(a.getArtifactId())) .collect(Collectors.toSet()); } } return Collections.emptySet(); }
@Deprecated public List<Artifact> getSystemArtifacts() { List<Artifact> list = new ArrayList<>( getArtifacts().size() ); for ( Artifact a : getArtifacts() ) { // TODO classpath check doesn't belong here - that's the other method if ( a.getArtifactHandler().isAddedToClasspath() ) { // TODO let the scope handler deal with this if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) { list.add( a ); } } } return list; }
public List getRuntimeArtifacts() { List list = new ArrayList( getArtifacts().size() ); for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) { Artifact a = (Artifact) i.next(); // TODO: classpath check doesn't belong here - that's the other method if ( a.getArtifactHandler().isAddedToClasspath() ) { // TODO: let the scope handler deal with this if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) { list.add( a ); } } } return list; }
public List getSystemClasspathElements() throws DependencyResolutionRequiredException { List list = new ArrayList( getArtifacts().size() ); list.add( getBuild().getOutputDirectory() ); for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) { Artifact a = (Artifact) i.next(); if ( a.getArtifactHandler().isAddedToClasspath() ) { // TODO: let the scope handler deal with this if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) { addArtifactPath( a, list ); } } } return list; }
@Deprecated public List<Artifact> getRuntimeArtifacts() { List<Artifact> list = new ArrayList<>( getArtifacts().size() ); for ( Artifact a : getArtifacts() ) { // TODO classpath check doesn't belong here - that's the other method if ( a.getArtifactHandler().isAddedToClasspath() // TODO let the scope handler deal with this && ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) ) { list.add( a ); } } return list; }
public List getCompileArtifacts() { List list = new ArrayList( getArtifacts().size() ); for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) { Artifact a = (Artifact) i.next(); // TODO: classpath check doesn't belong here - that's the other method if ( a.getArtifactHandler().isAddedToClasspath() ) { // TODO: let the scope handler deal with this if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) { list.add( a ); } } } return list; }
public List getCompileClasspathElements() throws DependencyResolutionRequiredException { List list = new ArrayList( getArtifacts().size() ); list.add( getBuild().getOutputDirectory() ); for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) { Artifact a = (Artifact) i.next(); if ( a.getArtifactHandler().isAddedToClasspath() ) { // TODO: let the scope handler deal with this if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) { addArtifactPath( a, list ); } } } return list; }
public List getRuntimeClasspathElements() throws DependencyResolutionRequiredException { List list = new ArrayList( getArtifacts().size() + 1 ); list.add( getBuild().getOutputDirectory() ); for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) { Artifact a = (Artifact) i.next(); if ( a.getArtifactHandler().isAddedToClasspath() ) { // TODO: let the scope handler deal with this if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) { File file = a.getFile(); if ( file == null ) { throw new DependencyResolutionRequiredException( a ); } list.add( file.getPath() ); } } } return list; }
@Deprecated public List<Artifact> getCompileArtifacts() { List<Artifact> list = new ArrayList<>( getArtifacts().size() ); for ( Artifact a : getArtifacts() ) { // TODO classpath check doesn't belong here - that's the other method if ( a.getArtifactHandler().isAddedToClasspath() ) { // TODO let the scope handler deal with this if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) { list.add( a ); } } } return list; }
public List<String> getRuntimeClasspathElements() throws DependencyResolutionRequiredException { List<String> list = new ArrayList<>( getArtifacts().size() + 1 ); String d = getBuild().getOutputDirectory(); if ( d != null ) { list.add( d ); } for ( Artifact a : getArtifacts() ) { if ( a.getArtifactHandler().isAddedToClasspath() // TODO let the scope handler deal with this && ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) ) { addArtifactPath( a, list ); } } return list; }
/** * Provides transitive dependency artifacts only defined types based on {@code types} argument * or all types if {@code types} argument is empty * * @param filteredScopes List of scopes to be removed (ie filtered out). * @param types Zero or more artifact types to be selected. * @return a {@code List} of all project dependencies. Never {@code null}. * This should maintain dependency order to comply with library project resource precedence. */ protected Set<Artifact> getTransitiveDependencyArtifacts( List<String> filteredScopes, String... types ) { return getArtifactResolverHelper().getFilteredArtifacts( filteredScopes, project.getArtifacts(), types ); }
/** * Provides transitive dependency artifacts having types defined by {@code types} argument * or all types if {@code types} argument is empty * * @param types artifact types to be selected * @return a {@code List} of all project dependencies. Never {@code null}. * This excludes artifacts of the {@link ArtifactResolverHelper.EXCLUDE_NON_PACKAGED_SCOPES} scopes. * This should maintain dependency order to comply with library project resource precedence. */ protected Set<Artifact> getTransitiveDependencyArtifacts( String... types ) { return getArtifactResolverHelper().getFilteredArtifacts( project.getArtifacts(), types ); }
@Deprecated public List<Dependency> getTestDependencies() { Set<Artifact> artifacts = getArtifacts(); if ( ( artifacts == null ) || artifacts.isEmpty() ) { return Collections.emptyList(); } List<Dependency> list = new ArrayList<>( artifacts.size() ); for ( Artifact a : getArtifacts() ) { Dependency dependency = new Dependency(); dependency.setArtifactId( a.getArtifactId() ); dependency.setGroupId( a.getGroupId() ); dependency.setVersion( a.getVersion() ); dependency.setScope( a.getScope() ); dependency.setType( a.getType() ); dependency.setClassifier( a.getClassifier() ); list.add( dependency ); } return Collections.unmodifiableList( list ); }
/** * Returns whether or not a the report can be generated. * * @return <code>true</code> if the report can be generated; otherwise * <code>false</code> */ @Override public boolean canGenerateReport() { populateSettings(); boolean isCapable = false; for (Artifact a : getProject().getArtifacts()) { if (!getArtifactScopeExcluded().passes(a.getScope())) { isCapable = true; break; } } return isCapable; }