public void execute()
throws MojoExecutionException
{
try
{
final MavenProject rootProject = this.getRootProject();
final ProjectWriter projectWriter = new ProjectWriter(rootProject,
this.getLog());
projectWriter.write();
final Map originalCompileSourceRoots = this.collectProjectCompileSourceRoots();
final List projects = this.collectProjects();
this.processCompileSourceRoots(projects);
final ClasspathWriter classpathWriter = new ClasspathWriter(rootProject,
this.getLog());
classpathWriter.write(
projects,
this.repositoryVariableName,
this.artifactFactory,
this.artifactResolver,
this.localRepository,
this.artifactMetadataSource,
this.classpathArtifactTypes,
this.project.getRemoteArtifactRepositories(),
this.resolveTransitiveDependencies,
this.classpathMerge);
// - reset to the original source roots
for (final Iterator iterator = projects.iterator(); iterator.hasNext();)
{
final MavenProject project = (MavenProject)iterator.next();
project.getCompileSourceRoots().clear();
project.getCompileSourceRoots().addAll((List)originalCompileSourceRoots.get(project));
}
}
catch (Throwable throwable)
{
throw new MojoExecutionException("Error creating eclipse configuration", throwable);