本文整理了Java中org.apache.maven.artifact.Artifact.getScope()
方法的一些代码示例,展示了Artifact.getScope()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Artifact.getScope()
方法的具体详情如下:
包路径:org.apache.maven.artifact.Artifact
类名称:Artifact
方法名:getScope
暂无
代码示例来源:origin: org.apache.maven/maven-project
/** {@inheritDoc} */
public String getScope()
{
return artifact.getScope();
}
代码示例来源:origin: org.apache.maven/maven-project
public String getScope()
{
return parent.getScope();
}
代码示例来源:origin: apache/maven
/** {@inheritDoc} */
public String getScope()
{
return artifact.getScope();
}
代码示例来源:origin: apache/maven
public String getScope()
{
return parent.getScope();
}
代码示例来源:origin: apache/maven
public void manageArtifactScope( Artifact artifact, Artifact replacement )
{
// only show msg if a change is actually taking place
if ( !replacement.getScope().equals( artifact.getScope() ) )
{
String msg = indent + artifact + " (applying artifactScope: " + replacement.getScope() + ")";
logger.debug( msg );
}
}
代码示例来源:origin: apache/maven
public void manageArtifactSystemPath( Artifact artifact, Artifact replacement )
{
// only show msg if a change is actually taking place
if ( !replacement.getScope().equals( artifact.getScope() ) )
{
String msg = indent + artifact + " (applying system path: " + replacement.getFile() + ")";
logger.debug( msg );
}
}
代码示例来源:origin: konsoletyper/teavm
private boolean filterByScope(Artifact artifact) {
return compileScopes == null ? isSupportedScope(artifact.getScope())
: compileScopes.contains(artifact.getScope());
}
代码示例来源:origin: apache/maven
public void includeArtifact( Artifact artifact )
{
logger.debug( indent + artifact + " (selected for " + artifact.getScope() + ")" );
}
代码示例来源:origin: apache/maven
public void updateScopeCurrentPom( Artifact artifact, String ignoredScope )
{
logger.debug( indent + artifact + " (not setting artifactScope to: " + ignoredScope + "; local artifactScope "
+ artifact.getScope() + " wins)" );
// TODO better way than static? this might hide messages in a reactor
if ( !ignoredArtifacts.contains( artifact ) )
{
logger.warn( "\n\tArtifact " + artifact + " retains local artifactScope '" + artifact.getScope()
+ "' overriding broader artifactScope '" + ignoredScope + "'\n"
+ "\tgiven by a dependency. If this is not intended, modify or remove the local artifactScope.\n" );
ignoredArtifacts.add( artifact );
}
}
代码示例来源:origin: org.apache.maven/maven-project
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;
}
代码示例来源:origin: apache/maven
@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;
}
代码示例来源:origin: org.apache.maven/maven-project
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;
}
代码示例来源:origin: org.apache.maven/maven-project
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;
}
代码示例来源:origin: apache/maven
private static int artifactHashCode( Artifact a )
{
int result = 17;
result = 31 * result + a.getGroupId().hashCode();
result = 31 * result + a.getArtifactId().hashCode();
result = 31 * result + a.getType().hashCode();
if ( a.getVersion() != null )
{
result = 31 * result + a.getVersion().hashCode();
}
result = 31 * result + ( a.getClassifier() != null ? a.getClassifier().hashCode() : 0 );
result = 31 * result + ( a.getScope() != null ? a.getScope().hashCode() : 0 );
result = 31 * result + ( a.getDependencyFilter() != null ? a.getDependencyFilter().hashCode() : 0 );
result = 31 * result + ( a.isOptional() ? 1 : 0 );
return result;
}
代码示例来源:origin: org.apache.maven/maven-project
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;
}
代码示例来源:origin: org.apache.maven/maven-project
public AttachedArtifact( Artifact parent, String type, String classifier, ArtifactHandler artifactHandler )
{
super( parent.getGroupId(), parent.getArtifactId(), parent.getVersionRange(), parent.getScope(), type,
classifier, artifactHandler, parent.isOptional() );
setDependencyTrail( Collections.singletonList( parent.getId() ) );
this.parent = parent;
if ( getId().equals( parent.getId() ) )
{
throw new InvalidArtifactRTException( parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), parent.getType(), "An attached artifact must have a different ID than its corresponding main artifact." );
}
}
代码示例来源:origin: apache/maven
public AttachedArtifact( Artifact parent, String type, String classifier, ArtifactHandler artifactHandler )
{
super( parent.getGroupId(), parent.getArtifactId(), parent.getVersionRange(), parent.getScope(), type,
classifier, artifactHandler, parent.isOptional() );
setDependencyTrail( Collections.singletonList( parent.getId() ) );
this.parent = parent;
if ( getId().equals( parent.getId() ) )
{
throw new InvalidArtifactRTException( parent.getGroupId(), parent.getArtifactId(), parent.getVersion(),
parent.getType(), "An attached artifact must have a different ID"
+ " than its corresponding main artifact." );
}
}
代码示例来源:origin: apache/maven
private static boolean artifactEquals( Artifact a1, Artifact a2 )
{
if ( a1 == a2 )
{
return true;
}
return eq( a1.getGroupId(), a2.getGroupId() )
&& eq( a1.getArtifactId(), a2.getArtifactId() )
&& eq( a1.getType(), a2.getType() )
&& eq( a1.getVersion(), a2.getVersion() )
&& eq( a1.getClassifier(), a2.getClassifier() )
&& eq( a1.getScope(), a2.getScope() )
&& eq( a1.getDependencyFilter(), a2.getDependencyFilter() )
&& a1.isOptional() == a2.isOptional();
}
代码示例来源:origin: jeremylong/DependencyCheck
/**
* 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;
}
代码示例来源:origin: apache/maven
private Artifact createDependencyArtifact( Dependency dependency, Artifact owner, Artifact pom )
throws ArtifactMetadataRetrievalException
{
try
{
String inheritedScope = ( owner != null ) ? owner.getScope() : null;
ArtifactFilter inheritedFilter = ( owner != null ) ? owner.getDependencyFilter() : null;
return createDependencyArtifact( repositorySystem, dependency, inheritedScope, inheritedFilter );
}
catch ( InvalidVersionSpecificationException e )
{
throw new ArtifactMetadataRetrievalException( "Invalid version for dependency "
+ dependency.getManagementKey() + ": " + e.getMessage(), e, pom );
}
}
内容来源于网络,如有侵权,请联系作者删除!