本文整理汇总了Java中org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter类的典型用法代码示例。如果您正苦于以下问题:Java ExcludesArtifactFilter类的具体用法?Java ExcludesArtifactFilter怎么用?Java ExcludesArtifactFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExcludesArtifactFilter类属于org.apache.maven.artifact.resolver.filter包,在下文中一共展示了ExcludesArtifactFilter类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCompilerDependencies
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; //导入依赖的package包/类
private List<File> getCompilerDependencies( Artifact scalaCompilerArtifact, Artifact scalaLibraryArtifact )
throws ArtifactNotFoundException, ArtifactResolutionException
{
ArtifactFilter scalaLibraryFilter =
new ExcludesArtifactFilter( Collections.singletonList( scalaLibraryArtifact.getGroupId() + ":"
+ scalaLibraryArtifact.getArtifactId() ) );
List<File> d = new ArrayList<File>();
for ( Artifact artifact : getAllDependencies( scalaCompilerArtifact, scalaLibraryFilter ) )
{
if ( !scalaCompilerArtifact.getGroupId().equals( artifact.getGroupId() )
|| !scalaCompilerArtifact.getArtifactId().equals( artifact.getArtifactId() ) )
{
d.add( artifact.getFile() ); // don't add scalaCompilerArtifact file
}
}
return d;
}
开发者ID:sbt-compiler-maven-plugin,项目名称:sbt-compiler-maven-plugin,代码行数:18,代码来源:AbstractSBTCompileMojo.java
示例2: detectExcludedGwtModules
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; //导入依赖的package包/类
/**
* Detects the GWT modules that should be excluded from the IDE GWT app.
*
* @return detected GWT modules
*/
private Set<String> detectExcludedGwtModules() throws IOException {
Set<String> modules = new HashSet<>();
ArtifactFilter dependencyFilter = fullIdeArtifact.getDependencyFilter();
if (dependencyFilter instanceof ExcludesArtifactFilter) {
ExcludesArtifactFilter excludesDependencyFilter = (ExcludesArtifactFilter) dependencyFilter;
for (String pattern : excludesDependencyFilter.getPatterns()) {
String[] split = pattern.split(":");
String groupId = split[0];
String artifactId = split[1];
String version = fullIdeArtifact.getVersion();
Artifact artifact = repositorySystem.createArtifact(groupId, artifactId, version, "jar");
String gwtModule = readGwtModuleName(artifact);
modules.add(gwtModule);
getLog().info("Detected GWT module to exclude: " + gwtModule);
}
}
return modules;
}
开发者ID:eclipse,项目名称:che,代码行数:31,代码来源:ProcessExcludesMojo.java
示例3: testCacheKey
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; //导入依赖的package包/类
public void testCacheKey()
throws Exception
{
Artifact a1 = repositorySystem.createArtifact( "testGroup", "testArtifact", "1.2.3", "jar" );
@SuppressWarnings( "deprecation" )
ArtifactRepository lr1 = new DelegatingLocalArtifactRepository( repositorySystem.createDefaultLocalRepository() );
ArtifactRepository rr1 = repositorySystem.createDefaultRemoteRepository();
a1.setDependencyFilter( new ExcludesArtifactFilter( Arrays.asList( "foo" ) ) );
Artifact a2 = repositorySystem.createArtifact( "testGroup", "testArtifact", "1.2.3", "jar" );
@SuppressWarnings( "deprecation" )
ArtifactRepository lr2 = new DelegatingLocalArtifactRepository( repositorySystem.createDefaultLocalRepository() );
ArtifactRepository rr2 = repositorySystem.createDefaultRemoteRepository();
a2.setDependencyFilter( new ExcludesArtifactFilter( Arrays.asList( "foo" ) ) );
// sanity checks
assertNotSame( a1, a2 );
assertNotSame( lr1, lr2 );
assertNotSame( rr1, rr2 );
CacheKey k1 = new CacheKey( a1, false, lr1, Collections.singletonList( rr1 ) );
CacheKey k2 = new CacheKey( a2, false, lr2, Collections.singletonList( rr2 ) );
assertEquals(k1.hashCode(), k2.hashCode());
}
开发者ID:gems-uff,项目名称:oceano,代码行数:26,代码来源:DefaultMavenMetadataCacheTest.java
示例4: setupDependencyArtifacts
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; //导入依赖的package包/类
private void setupDependencyArtifacts(Model model) {
Set<Artifact> artifacts = new HashSet<>();
ArtifactStubFactory artifactStubFactory = new ArtifactStubFactory();
for (Dependency dependency : model.getDependencies()) {
Artifact artifact;
try {
artifact =
artifactStubFactory.createArtifact(
dependency.getGroupId(),
dependency.getArtifactId(),
System.getProperty("currentVersion"));
} catch (IOException e) {
throw new RuntimeException(e);
}
List<String> patterns =
dependency
.getExclusions()
.stream()
.map(exclusion -> exclusion.getGroupId() + ":" + exclusion.getArtifactId())
.collect(Collectors.toList());
artifact.setDependencyFilter(new ExcludesArtifactFilter(patterns));
artifacts.add(artifact);
}
setDependencyArtifacts(artifacts);
}
开发者ID:eclipse,项目名称:che,代码行数:31,代码来源:ProjectStub.java
示例5: processDependencies
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; //导入依赖的package包/类
/**
* Iterate through all the top level and transitive dependencies declared in the project and
* collect all the runtime scope dependencies for inclusion in the .zip and signing.
*
* @throws MojoExecutionException if could not process dependencies
*/
private void processDependencies()
throws MojoExecutionException
{
processDependency( getProject().getArtifact() );
AndArtifactFilter filter = new AndArtifactFilter();
// filter.add( new ScopeArtifactFilter( dependencySet.getScope() ) );
if ( dependencies != null && dependencies.getIncludes() != null && !dependencies.getIncludes().isEmpty() )
{
filter.add( new IncludesArtifactFilter( dependencies.getIncludes() ) );
}
if ( dependencies != null && dependencies.getExcludes() != null && !dependencies.getExcludes().isEmpty() )
{
filter.add( new ExcludesArtifactFilter( dependencies.getExcludes() ) );
}
Collection<Artifact> artifacts =
isExcludeTransitive() ? getProject().getDependencyArtifacts() : getProject().getArtifacts();
for ( Artifact artifact : artifacts )
{
if ( filter.include( artifact ) )
{
processDependency( artifact );
}
}
}
开发者ID:mojohaus,项目名称:webstart,代码行数:36,代码来源:AbstractJnlpMojo.java
示例6: toDependencyArtifact
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; //导入依赖的package包/类
/**
* Convert Dependency to Artifact
*
* @param artifactFactory standard Maven's factory to create artifacts
* @param dependency dependency
* @return artifact
* @throws InvalidVersionSpecificationException if VersionRange is invalid
*/
private Artifact toDependencyArtifact(ArtifactFactory artifactFactory, Dependency dependency) throws InvalidVersionSpecificationException {
// instantiate
Artifact dependencyArtifact = artifactFactory.createDependencyArtifact(dependency.getGroupId(),
dependency.getArtifactId(),
VersionRange.createFromVersionSpec(dependency.getVersion()),
dependency.getType(),
dependency.getClassifier(),
dependency.getScope() == null ? Artifact.SCOPE_COMPILE : dependency.getScope(),
null,
dependency.isOptional()
);
// apply exclusions is needed
if (!dependency.getExclusions().isEmpty()) {
List<String> exclusions = new ArrayList<String>();
for (Exclusion exclusion : dependency.getExclusions())
exclusions.add(exclusion.getGroupId() + ":" + exclusion.getArtifactId());
dependencyArtifact.setDependencyFilter(new ExcludesArtifactFilter(exclusions));
}
// additional
if (Artifact.SCOPE_SYSTEM.equalsIgnoreCase(dependency.getScope()))
dependencyArtifact.setFile(new File(dependency.getSystemPath()));
return dependencyArtifact;
}
开发者ID:zhve,项目名称:idea-maven-plugin,代码行数:36,代码来源:ArtifactDependencyResolver.java
示例7: createDependencyArtifact
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; //导入依赖的package包/类
public Artifact createDependencyArtifact( Dependency d )
{
VersionRange versionRange;
try
{
versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
}
catch ( InvalidVersionSpecificationException e )
{
return null;
}
Artifact artifact =
artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange, d.getType(),
d.getClassifier(), d.getScope(), d.isOptional() );
if ( Artifact.SCOPE_SYSTEM.equals( d.getScope() ) && d.getSystemPath() != null )
{
artifact.setFile( new File( d.getSystemPath() ) );
}
if ( !d.getExclusions().isEmpty() )
{
List<String> exclusions = new ArrayList<String>();
for ( Exclusion exclusion : d.getExclusions() )
{
exclusions.add( exclusion.getGroupId() + ':' + exclusion.getArtifactId() );
}
artifact.setDependencyFilter( new ExcludesArtifactFilter( exclusions ) );
}
return artifact;
}
开发者ID:gems-uff,项目名称:oceano,代码行数:36,代码来源:LegacyRepositorySystem.java
示例8: setDependencyFilter
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; //导入依赖的package包/类
/**
* A setter method made especially for Jackson. Artifact's dependency filter is used for the exclusion list. As
* the filter cannot be created directly by Jackson, we do the job directly here.
*
* @param filter the Json representation of the filter
*/
public void setDependencyFilter(ObjectNode filter) {
if (filter == null) {
return;
}
final JsonNode patterns = filter.get("patterns");
if (patterns != null && patterns.isArray()) {
List<String> ids = new ArrayList<>();
for (JsonNode exclusion : patterns) {
ids.add(exclusion.asText());
}
setDependencyFilter(new ExcludesArtifactFilter(ids));
}
}
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:20,代码来源:MavenArtifact.java
示例9: getAllDependencies
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; //导入依赖的package包/类
private Collection<Artifact> getAllDependencies() throws MojoExecutionException {
List<Artifact> artifacts = new ArrayList<Artifact>();
for (Iterator<?> dependencies = project.getDependencies().iterator(); dependencies.hasNext();) {
Dependency dependency = (Dependency)dependencies.next();
String groupId = dependency.getGroupId();
String artifactId = dependency.getArtifactId();
VersionRange versionRange;
try {
versionRange = VersionRange.createFromVersionSpec(dependency.getVersion());
} catch (InvalidVersionSpecificationException e) {
throw new MojoExecutionException("unable to parse version", e);
}
String type = dependency.getType();
if (type == null) {
type = "jar";
}
String classifier = dependency.getClassifier();
boolean optional = dependency.isOptional();
String scope = dependency.getScope();
if (scope == null) {
scope = Artifact.SCOPE_COMPILE;
}
Artifact art = this.artifactFactory.createDependencyArtifact(groupId, artifactId, versionRange,
type, classifier, scope, null, optional);
if (scope.equalsIgnoreCase(Artifact.SCOPE_SYSTEM)) {
art.setFile(new File(dependency.getSystemPath()));
}
List<String> exclusions = new ArrayList<String>();
for (Exclusion exclusion : dependency.getExclusions()) {
exclusions.add(exclusion.getGroupId() + ":" + exclusion.getArtifactId());
}
ArtifactFilter newFilter = new ExcludesArtifactFilter(exclusions);
art.setDependencyFilter(newFilter);
artifacts.add(art);
}
return artifacts;
}
开发者ID:HydAu,项目名称:Camel,代码行数:49,代码来源:RunMojo.java
示例10: getAllDependencies
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; //导入依赖的package包/类
private Collection<Artifact> getAllDependencies() throws MojoExecutionException {
List<Artifact> artifacts = new ArrayList<Artifact>();
for (Iterator<?> dependencies = project.getDependencies().iterator(); dependencies.hasNext();) {
Dependency dependency = (Dependency)dependencies.next();
String groupId = dependency.getGroupId();
String artifactId = dependency.getArtifactId();
VersionRange versionRange;
try {
versionRange = VersionRange.createFromVersionSpec(dependency.getVersion());
} catch (InvalidVersionSpecificationException e) {
throw new MojoExecutionException("unable to parse version", e);
}
String type = dependency.getType();
if (type == null) {
type = "jar";
}
String classifier = dependency.getClassifier();
boolean optional = dependency.isOptional();
String scope = dependency.getScope();
if (scope == null) {
scope = Artifact.SCOPE_COMPILE;
}
Artifact art = this.artifactFactory.createDependencyArtifact(groupId, artifactId, versionRange,
type, classifier, scope, null, optional);
if (scope.equalsIgnoreCase(Artifact.SCOPE_SYSTEM)) {
art.setFile(new File(dependency.getSystemPath()));
}
List<String> exclusions = new ArrayList<String>();
for (Exclusion exclusion : dependency.getExclusions()) {
exclusions.add(exclusion.getGroupId() + ":" + exclusion.getArtifactId());
}
ArtifactFilter newFilter = new ExcludesArtifactFilter(exclusions);
art.setDependencyFilter(newFilter);
artifacts.add(art);
}
return artifacts;
}
开发者ID:astefanutti,项目名称:camel-cdi,代码行数:49,代码来源:RunMojo.java
示例11: processTransitiveDependencies
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; //导入依赖的package包/类
private Set<Artifact> processTransitiveDependencies( Dependency dependency, boolean sharedLibraries )
throws MojoExecutionException
{
log.debug( "Processing transitive dependencies for : " + dependency );
try
{
final Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
final List<String> exclusionPatterns = new ArrayList<String>();
if ( dependency.getExclusions() != null && !dependency.getExclusions().isEmpty() )
{
for ( final Exclusion exclusion : dependency.getExclusions() )
{
exclusionPatterns.add( exclusion.getGroupId() + ":" + exclusion.getArtifactId() );
}
}
final ArtifactFilter optionalFilter = new ArtifactFilter()
{
@Override
public boolean include( Artifact artifact )
{
return !artifact.isOptional();
}
};
final AndArtifactFilter filter = new AndArtifactFilter();
filter.add( new ExcludesArtifactFilter( exclusionPatterns ) );
filter.add( new OrArtifactFilter( Arrays.<ArtifactFilter>asList( new ScopeArtifactFilter( "compile" ),
new ScopeArtifactFilter( "runtime" ),
new ScopeArtifactFilter( "test" ) ) ) );
filter.add( optionalFilter );
final DependencyNode node = dependencyGraphBuilder.buildDependencyGraph( project, filter );
final CollectingDependencyNodeVisitor collectingVisitor = new CollectingDependencyNodeVisitor();
node.accept( collectingVisitor );
final List<DependencyNode> dependencies = collectingVisitor.getNodes();
for ( final DependencyNode dep : dependencies )
{
final boolean isNativeLibrary = isNativeLibrary( sharedLibraries, dep.getArtifact().getType() );
log.debug( "Processing library : " + dep.getArtifact() + " isNative=" + isNativeLibrary );
if ( isNativeLibrary )
{
artifacts.add( dep.getArtifact() );
}
}
return artifacts;
}
catch ( Exception e )
{
throw new MojoExecutionException( "Error while processing transitive dependencies", e );
}
}
开发者ID:simpligility,项目名称:android-ndk-maven-plugin,代码行数:56,代码来源:NativeHelper.java
注:本文中的org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论