use of org.apache.maven.plugins.assembly.model.DependencySet in project maven-plugins by apache.
the class ModuleSetAssemblyPhase method getDependencySets.
public static List<DependencySet> getDependencySets(final ModuleBinaries binaries) {
List<DependencySet> depSets = binaries.getDependencySets();
if (((depSets == null) || depSets.isEmpty()) && binaries.isIncludeDependencies()) {
final DependencySet impliedDependencySet = new DependencySet();
impliedDependencySet.setOutputDirectory(binaries.getOutputDirectory());
//impliedDependencySet.setOutputFileNameMapping( binaries.getOutputFileNameMapping() );
impliedDependencySet.setFileMode(binaries.getFileMode());
impliedDependencySet.setDirectoryMode(binaries.getDirectoryMode());
impliedDependencySet.setExcludes(binaries.getExcludes());
impliedDependencySet.setIncludes(binaries.getIncludes());
impliedDependencySet.setUnpack(binaries.isUnpack());
// unpackOptions is handled in the first stage of dependency-set handling, below.
depSets = Collections.singletonList(impliedDependencySet);
}
return depSets;
}
use of org.apache.maven.plugins.assembly.model.DependencySet in project maven-plugins by apache.
the class DefaultDependencyResolver method resolveDependencySets.
@Override
public Map<DependencySet, Set<Artifact>> resolveDependencySets(final Assembly assembly, ModuleSet moduleSet, final AssemblerConfigurationSource configSource, List<DependencySet> dependencySets) throws DependencyResolutionException {
Map<DependencySet, Set<Artifact>> result = new LinkedHashMap<DependencySet, Set<Artifact>>();
for (DependencySet dependencySet : dependencySets) {
final MavenProject currentProject = configSource.getProject();
final ResolutionManagementInfo info = new ResolutionManagementInfo(currentProject);
updateRepositoryResolutionRequirements(assembly, info);
final AssemblyId assemblyId = AssemblyId.createAssemblyId(assembly);
updateDependencySetResolutionRequirements(dependencySet, info, assemblyId, configSource.getMavenSession().getProjectBuildingRequest(), currentProject);
updateModuleSetResolutionRequirements(assemblyId, moduleSet, dependencySet, info, configSource);
resolve(assembly, configSource, result, dependencySet, info);
}
return result;
}
use of org.apache.maven.plugins.assembly.model.DependencySet in project maven-plugins by apache.
the class AddDependencySetsTaskTest method testGetDependencyArtifacts_ShouldFilterOneDependencyArtifactViaInclude.
public void testGetDependencyArtifacts_ShouldFilterOneDependencyArtifactViaInclude() throws ArchiveCreationException, InvalidAssemblerConfigurationException {
final MavenProject project = new MavenProject(new Model());
final Set<Artifact> artifacts = new HashSet<Artifact>();
final ArtifactMock am = new ArtifactMock(mockManager, "group", "artifact", "1.0", "jar", false);
am.setDependencyTrail(Collections.singletonList(project.getId()));
artifacts.add(am.getArtifact());
final ArtifactMock am2 = new ArtifactMock(mockManager, "group2", "artifact2", "1.0", "jar", false);
am2.setDependencyTrail(Collections.singletonList(project.getId()));
artifacts.add(am2.getArtifact());
final DependencySet dependencySet = new DependencySet();
dependencySet.addInclude("group:artifact");
dependencySet.setUseTransitiveFiltering(true);
final Logger logger = new ConsoleLogger(Logger.LEVEL_DEBUG, "test");
mockManager.replayAll();
final AddDependencySetsTask task = new AddDependencySetsTask(Collections.singletonList(dependencySet), artifacts, project, null, logger);
final Set<Artifact> result = task.resolveDependencyArtifacts(dependencySet);
assertNotNull(result);
assertEquals(1, result.size());
assertSame(am.getArtifact(), result.iterator().next());
mockManager.verifyAll();
}
use of org.apache.maven.plugins.assembly.model.DependencySet in project maven-plugins by apache.
the class AssemblyInterpolator2Test method testDependencyOutputFileNameMappingsAreNotInterpolated.
public void testDependencyOutputFileNameMappingsAreNotInterpolated() throws IOException, AssemblyInterpolationException {
AssemblyInterpolator interpolator = new AssemblyInterpolator();
Model model = new Model();
model.setArtifactId("artifact-id");
model.setGroupId("group.id");
model.setVersion("1");
Assembly assembly = new Assembly();
DependencySet set = new DependencySet();
set.setOutputFileNameMapping("${artifact.artifactId}.${artifact.extension}");
assembly.addDependencySet(set);
Assembly outputAssembly = interpolator.interpolate(assembly, model, Collections.EMPTY_MAP, DefaultAssemblyReader.create(model));
List outputDependencySets = outputAssembly.getDependencySets();
assertEquals(1, outputDependencySets.size());
DependencySet outputSet = (DependencySet) outputDependencySets.get(0);
assertEquals(set.getOutputFileNameMapping(), outputSet.getOutputFileNameMapping());
}
use of org.apache.maven.plugins.assembly.model.DependencySet in project maven-plugins by apache.
the class DefaultDependencyResolverTest method test_getDependencySetResolutionRequirements.
public void test_getDependencySetResolutionRequirements() throws DependencyResolutionException {
final DependencySet ds1 = new DependencySet();
ds1.setScope(Artifact.SCOPE_COMPILE);
ds1.setUseTransitiveDependencies(false);
final DependencySet ds2 = new DependencySet();
ds2.setScope(Artifact.SCOPE_SYSTEM);
ds2.setUseTransitiveDependencies(false);
final MavenProject project = createMavenProject("main-group", "main-artifact", "1", null);
final ResolutionManagementInfo info = new ResolutionManagementInfo(project);
final Assembly assembly = new Assembly();
ProjectBuildingRequest buildingRequest = newMavenSession(project).getProjectBuildingRequest();
resolver.updateDependencySetResolutionRequirements(ds1, info, AssemblyId.createAssemblyId(assembly), buildingRequest, project);
assertTrue(info.isResolutionRequired());
assertFalse(info.isResolvedTransitively());
assertTrue(info.getScopeFilter().getIncluded().contains(Artifact.SCOPE_COMPILE));
assertTrue(info.getScopeFilter().getIncluded().contains(Artifact.SCOPE_SYSTEM));
assertTrue(info.getScopeFilter().getIncluded().contains(Artifact.SCOPE_PROVIDED));
assertFalse(info.getScopeFilter().getIncluded().contains(Artifact.SCOPE_RUNTIME));
assertFalse(info.getScopeFilter().getIncluded().contains(Artifact.SCOPE_TEST));
}
Aggregations