*
* @return
* @throws MojoExecutionException
*/
private Set<Artifact> getSynapseRuntimeArtifacts() throws MojoExecutionException {
Log log = getLog();
log.debug("Looking for synapse-core artifact in XAR project dependencies ...");
Artifact synapseCore = null;
for (Iterator<?> it = project.getDependencyArtifacts().iterator(); it.hasNext(); ) {
Artifact artifact = (Artifact)it.next();
if (artifact.getGroupId().equals("org.apache.synapse")
&& artifact.getArtifactId().equals("synapse-core")) {
synapseCore = artifact;
break;
}
}
if (synapseCore == null) {
throw new MojoExecutionException("Could not locate dependency on synapse-core");
}
log.debug("Loading project data for " + synapseCore + " ...");
MavenProject synapseCoreProject;
try {
synapseCoreProject = projectBuilder.buildFromRepository(synapseCore,
remoteArtifactRepositories, localRepository);
} catch (ProjectBuildingException e) {
throw new MojoExecutionException("Unable to retrieve project information for "
+ synapseCore, e);
}
Set<Artifact> synapseRuntimeDeps;
try {
synapseRuntimeDeps = synapseCoreProject.createArtifacts(artifactFactory,
Artifact.SCOPE_RUNTIME, new TypeArtifactFilter("jar"));
} catch (InvalidDependencyVersionException e) {
throw new MojoExecutionException("Unable to get project dependencies for "
+ synapseCore, e);
}
log.debug("Direct runtime dependencies for " + synapseCore + " :");
logArtifacts(synapseRuntimeDeps);
log.debug("Resolving transitive dependencies for " + synapseCore + " ...");
try {
synapseRuntimeDeps = artifactCollector.collect(synapseRuntimeDeps,
synapseCoreProject.getArtifact(), synapseCoreProject.getManagedVersionMap(),
localRepository, remoteArtifactRepositories, artifactMetadataSource, null,
Collections.singletonList(new DebugResolutionListener(logger))).getArtifacts();
} catch (ArtifactResolutionException e) {
throw new MojoExecutionException("Unable to resolve transitive dependencies for "
+ synapseCore);
}
log.debug("All runtime dependencies for " + synapseCore + " :");
logArtifacts(synapseRuntimeDeps);
return synapseRuntimeDeps;
}