in src/main/java/org/apache/sling/cpconverter/maven/mojos/ContentPackage.java [90:130]
Collection<Artifact> getMatchingArtifacts(final MavenProject project,
RepositorySystem repoSystem, RepositorySystemSession repoSession,
List<RemoteRepository> remoteRepos) {
// get artifacts depending on whether we exclude transitives or not
final Set<Artifact> artifacts;
// TODO: when I ran the tests the artifacts where only available in the Dependency Artifacts and
// getArtifacts() returned an empty set
if (excludeTransitive) {
// only direct dependencies, transitives excluded
artifacts = project.getDependencyArtifacts();
} else {
// all dependencies, transitives included
artifacts = project.getArtifacts();
}
// Sometimes artifacts don't have their 'file' attribute set, which we need. For those that don't, resolve them
final Set<Artifact> fileArtifacts = new HashSet<>();
for (Artifact a : artifacts) {
if (a.getFile() != null) {
fileArtifacts.add(a);
} else {
if (repoSystem != null && repoSession != null) {
// Resolving the artifact via Aether will fill in the file attribute
Artifact fileArt = resolveArtifact(repoSystem, repoSession, remoteRepos, a);
if (fileArt != null) {
fileArtifacts.add(fileArt);
} else {
throw new RuntimeException("Unable to resolve artifact: " + a);
}
}
}
}
// Add the project artifact itself to convert after building a content package
if(moduleIsContentPackage) {
Artifact projectArtifact = project.getArtifact();
System.out.println("Project Artifact: " + projectArtifact);
fileArtifacts.add(projectArtifact);
}
return getMatchingArtifacts(fileArtifacts);
}