本文整理汇总了Java中org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException类的典型用法代码示例。如果您正苦于以下问题:Java ArtifactFilterException类的具体用法?Java ArtifactFilterException怎么用?Java ArtifactFilterException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ArtifactFilterException类属于org.apache.maven.shared.artifact.filter.collection包,在下文中一共展示了ArtifactFilterException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filterMarkedDependencies
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
/**
* Filter the marked dependencies
*
* @param artifacts
* @return
* @throws MojoExecutionException
*/
protected DependencyStatusSets filterMarkedDependencies( Set artifacts )
throws MojoExecutionException
{
// remove files that have markers already
FilterArtifacts filter = new FilterArtifacts();
filter.clearFilters();
filter.addFilter( getMarkedArtifactFilter() );
Set unMarkedArtifacts;
try
{
unMarkedArtifacts = filter.filter( artifacts );
}
catch ( ArtifactFilterException e )
{
throw new MojoExecutionException(e.getMessage(),e);
}
// calculate the skipped artifacts
Set skippedArtifacts = new HashSet();
skippedArtifacts.addAll( artifacts );
skippedArtifacts.removeAll( unMarkedArtifacts );
return new DependencyStatusSets( unMarkedArtifacts, null, skippedArtifacts );
}
示例2: filter
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
public Set filter( Set artifacts )
throws ArtifactFilterException
{
Set result = new HashSet();
Iterator iter = artifacts.iterator();
while ( iter.hasNext() )
{
Artifact artifact = (Artifact) iter.next();
if ( isArtifactIncluded( new ArtifactItem( artifact ) ) )
{
result.add( artifact );
}
}
return result;
}
示例3: filter
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
public Set filter( Set artifacts )
throws ArtifactFilterException
{
Set result = new HashSet();
Iterator iter = artifacts.iterator();
while ( iter.hasNext() )
{
Artifact artifact = (Artifact) iter.next();
if ( isArtifactIncluded( new ArtifactItem( artifact ) ) )
{
result.add( artifact );
}
}
return result;
}
示例4: testMarkerSnapshots
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
public void testMarkerSnapshots() throws ArtifactFilterException, MojoExecutionException, IOException
{
DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler( fact.getSnapshotArtifact(), outputFolder );
handler.setMarker();
MarkerFileFilter filter = new MarkerFileFilter( true, false, false, new DefaultFileMarkerHandler( outputFolder ) );
Set result = filter.filter( artifacts );
assertEquals( 1, result.size() );
filter.setOverWriteSnapshots( true );
result = filter.filter( artifacts );
assertEquals( 2, result.size() );
assertTrue( handler.clearMarker() );
DependencyTestUtils.removeDirectory( outputFolder );
assertFalse( outputFolder.exists() );
}
示例5: testMarkerRelease
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
public void testMarkerRelease()
throws IOException, ArtifactFilterException, MojoExecutionException
{
DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler( fact.getReleaseArtifact(), outputFolder );
handler.setMarker();
MarkerFileFilter filter = new MarkerFileFilter( false, false, false,
new DefaultFileMarkerHandler( outputFolder ) );
Set result = filter.filter( artifacts);
assertEquals( 1, result.size() );
filter.setOverWriteReleases( true );
result = filter.filter( artifacts);
assertEquals( 2, result.size() );
assertTrue( handler.clearMarker() );
DependencyTestUtils.removeDirectory( outputFolder );
assertFalse( outputFolder.exists() );
}
示例6: testDestFileOverwriteIfNewer
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
public void testDestFileOverwriteIfNewer()
throws MojoExecutionException, IOException, ArtifactFilterException
{
DestFileFilter filter = new DestFileFilter( outputFolder );
fact.setCreateFiles( true );
Artifact artifact = fact.getSnapshotArtifact();
File artifactFile = artifact.getFile();
artifactFile.setLastModified( artifactFile.lastModified() );
filter.overWriteIfNewer = true;
// should pass because the file doesn't exist yet.
assertTrue( filter.isArtifactIncluded( artifact) );
// create the file in the destination
File destFile = createFile( artifact, false, false, false );
// set the last modified timestamp to be older than the source
destFile.setLastModified( artifactFile.lastModified() - 1000 );
assertTrue( filter.isArtifactIncluded( artifact ) );
// now set the last modified timestamp to be newer than the source
destFile.setLastModified( artifactFile.lastModified() + 1000 );
assertFalse( filter.isArtifactIncluded( artifact ) );
}
示例7: filterDependencies
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
@Override
protected Set<Artifact> filterDependencies(Set<Artifact> dependencies,
FilterArtifacts filters) throws MojoExecutionException {
try {
Set<Artifact> filtered = new LinkedHashSet<Artifact>(dependencies);
@SuppressWarnings("unchecked")
Collection<ArtifactsFilter> filtersToUse = filters.getFilters();
filtersToUse.addAll(getAdditionalFilters());
filtered.retainAll(filters.filter(dependencies));
return filtered;
}
catch (ArtifactFilterException ex) {
throw new MojoExecutionException(ex.getMessage(), ex);
}
}
示例8: getMarkedArtifactFilter
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected ArtifactsFilter getMarkedArtifactFilter() {
return new ArtifactsFilter() {
@Override
public boolean isArtifactIncluded(Artifact artifact) throws ArtifactFilterException {
return true;
}
@Override
@SuppressWarnings("rawtypes")
public Set filter(Set artifacts) throws ArtifactFilterException {
return artifacts;
}
};
}
示例9: filterMarkedDependencies
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
protected DependencyStatusSets filterMarkedDependencies(Set artifacts) throws MojoExecutionException {
// remove files that have markers already
FilterArtifacts filter = new FilterArtifacts();
filter.clearFilters();
filter.addFilter(getMarkedArtifactFilter());
Set unMarkedArtifacts;
try {
unMarkedArtifacts = filter.filter(artifacts);
} catch (ArtifactFilterException e) {
throw new MojoExecutionException(e.getMessage(), e);
}
// calculate the skipped artifacts
Set skippedArtifacts = new HashSet();
skippedArtifacts.addAll(artifacts);
skippedArtifacts.removeAll(unMarkedArtifacts);
return new DependencyStatusSets(unMarkedArtifacts, null, skippedArtifacts);
}
示例10: resolvePluginArtifacts
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
/**
* This method resolves the plugin artifacts from the project.
*
* @return set of resolved plugin artifacts.
* @throws ArtifactResolutionException
* @throws ArtifactNotFoundException
* @throws ArtifactFilterException
*/
@SuppressWarnings( "unchecked" )
protected Set<Artifact> resolvePluginArtifacts()
throws ArtifactResolutionException, ArtifactNotFoundException, ArtifactFilterException
{
final Set<Artifact> plugins = project.getPluginArtifacts();
final Set<Artifact> reports = project.getReportArtifacts();
Set<Artifact> artifacts = new HashSet<Artifact>();
artifacts.addAll( reports );
artifacts.addAll( plugins );
final FilterArtifacts filter = getPluginArtifactsFilter();
artifacts = filter.filter( artifacts );
// final ArtifactFilter filter = getPluginFilter();
for ( final Artifact artifact : new HashSet<Artifact>( artifacts ) )
{
// resolve the new artifact
this.resolver.resolve( artifact, this.remotePluginRepositories, this.getLocal() );
}
return artifacts;
}
示例11: filter
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public Set<?> filter(Set artifacts) throws ArtifactFilterException {
if (!filterP2) {
// allow all
return artifacts;
} else {
// exclude group IDs starting with "p2."
Set<Artifact> filtered = new HashSet<Artifact>();
for (Object artifactObj : artifacts) {
if (!((Artifact) artifactObj).getGroupId().startsWith("p2.")) {
filtered.add((Artifact) artifactObj);
}
}
return filtered;
}
}
示例12: getDependencySets
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
/**
*
* Method creates filters and filters the projects dependencies. This method
* also transforms the dependencies if classifier is set. The dependencies
* are filtered in least specific to most specific order
*
* @param stopOnFailure
* @return DependencyStatusSets - Bean of TreeSets that contains information
* on the projects dependencies
* @throws MojoExecutionException
*/
protected DependencyStatusSets getDependencySets( boolean stopOnFailure )
throws MojoExecutionException
{
// add filters in well known order, least specific to most specific
FilterArtifacts filter = new FilterArtifacts();
filter.addFilter( new TransitivityFilter( project.getDependencyArtifacts(), this.excludeTransitive ) );
filter.addFilter( new ScopeFilter( this.includeScope, this.excludeScope ) );
filter.addFilter( new TypeFilter( this.includeTypes, this.excludeTypes ) );
filter.addFilter( new ClassifierFilter( this.includeClassifiers, this.excludeClassifiers ) );
filter.addFilter( new GroupIdFilter( this.includeGroupIds, this.excludeGroupIds ) );
filter.addFilter( new ArtifactIdFilter( this.includeArtifactIds, this.excludeArtifactIds ) );
// start with all artifacts.
Set artifacts = project.getArtifacts();
// perform filtering
try
{
artifacts = filter.filter( artifacts );
}
catch ( ArtifactFilterException e )
{
throw new MojoExecutionException(e.getMessage(),e);
}
// transform artifacts if classifier is set
DependencyStatusSets status = null;
if ( StringUtils.isNotEmpty( classifier ) )
{
status = getClassifierTranslatedDependencies( artifacts, stopOnFailure );
}
else
{
status = filterMarkedDependencies( artifacts );
}
return status;
}
示例13: isArtifactIncluded
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
public boolean isArtifactIncluded( ArtifactItem item )
throws ArtifactFilterException
{
Artifact artifact = item.getArtifact();
boolean overWrite = false;
boolean result = false;
if ( ( artifact.isSnapshot() && this.overWriteSnapshots )
|| ( !artifact.isSnapshot() && this.overWriteReleases ) )
{
overWrite = true;
}
handler.setArtifact( artifact );
try
{
if ( overWrite || ( !handler.isMarkerSet() || ( overWriteIfNewer && handler.isMarkerOlder( artifact ) ) ) )
{
result = true;
}
}
catch ( MojoExecutionException e )
{
throw new ArtifactFilterException (e.getMessage(),e);
}
return result;
}
示例14: isArtifactIncluded
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
public boolean isArtifactIncluded( ArtifactItem item ) throws ArtifactFilterException
{
handler.setArtifact( item.getArtifact() );
try
{
return ( !handler.isMarkerSet() );
}
catch ( MojoExecutionException e )
{
throw new ArtifactFilterException( e.getMessage(),e);
}
}
示例15: checkIfProcessingNeeded
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; //导入依赖的package包/类
private boolean checkIfProcessingNeeded( ArtifactItem item )
throws MojoExecutionException, ArtifactFilterException
{
boolean result = false;
if ( StringUtils.equalsIgnoreCase( item.getOverWrite(), "true" ) )
{
result = true;
}
else
{
ArtifactItemFilter filter = getMarkedArtifactFilter( item );
result = filter.isArtifactIncluded( item );
}
return result;
}