From checking the code of the maven-dependency-plugin, I'm pretty sure this is a bug, in the sense that the filters are not applied for go-offline
. Here's the code that resolves dependencies in the go-offline
mojo implementation (version 3.1.3-SNAPSHOT):
protected Set<Artifact> resolveDependencyArtifacts()
throws DependencyResolverException
{
final Collection<Dependency> dependencies = getProject().getDependencies();
final Set<DependableCoordinate> dependableCoordinates = new HashSet<>();
final ProjectBuildingRequest buildingRequest = newResolveArtifactProjectBuildingRequest();
for ( Dependency dependency : dependencies )
{
dependableCoordinates.add( createDependendableCoordinateFromDependency( dependency ) );
}
return resolveDependableCoordinate( buildingRequest, dependableCoordinates, "dependencies" );
}
In contract, here is the code that resolves dependencies for the resolve
mojo:
@Override
protected void doExecute()
throws MojoExecutionException
{
// get sets of dependencies
results = this.getDependencySets( false, includeParents );
...
}
AbstractDependencyFilterMojo:
protected DependencyStatusSets getDependencySets( boolean stopOnFailure, boolean includeParents )
throws MojoExecutionException
{
// add filters in well known order, least specific to most specific
FilterArtifacts filter = new FilterArtifacts();
filter.addFilter( new ProjectTransitivityFilter( getProject().getDependencyArtifacts(),
this.excludeTransitive ) );
filter.addFilter( new ScopeFilter( DependencyUtil.cleanToBeTokenizedString( this.includeScope ),
DependencyUtil.cleanToBeTokenizedString( this.excludeScope ) ) );
filter.addFilter( new TypeFilter( DependencyUtil.cleanToBeTokenizedString( this.includeTypes ),
DependencyUtil.cleanToBeTokenizedString( this.excludeTypes ) ) );
filter.addFilter( new ClassifierFilter( DependencyUtil.cleanToBeTokenizedString( this.includeClassifiers ),
DependencyUtil.cleanToBeTokenizedString( this.excludeClassifiers ) ) );
filter.addFilter( new GroupIdFilter( DependencyUtil.cleanToBeTokenizedString( this.includeGroupIds ),
DependencyUtil.cleanToBeTokenizedString( this.excludeGroupIds ) ) );
filter.addFilter( new ArtifactIdFilter( DependencyUtil.cleanToBeTokenizedString( this.includeArtifactIds ),
DependencyUtil.cleanToBeTokenizedString( this.excludeArtifactIds ) ) );
...
It's pretty clear that the code of go-offline
is not applying those filters when resolving dependencies. So I've inserted a ticket for the project to confirm: https://issues.apache.org/jira/browse/MDEP-725