Project project = projectFactory.findProject(projectRoot);
if (project == null)
{
return Results.fail("No project found in root " + projectRoot.getFullyQualifiedName());
}
Coordinate buildCoordinate = project.getFacet(MetadataFacet.class).getOutputDependency().getCoordinate();
try
{
project.getFacet(PackagingFacet.class).createBuilder()
.addArguments("clean", "install", "-Dversion.furnace=" + furnace.getVersion())
.runTests(false)
.build(output.out(), output.err());
}
catch (BuildException e)
{
return Results.fail("Unable to execute project build", e);
}
progressMonitor.worked(1);
AddonId id = null;
try
{
if (coordinate.hasValue())
{
try
{
id = AddonId.fromCoordinates(coordinate.getValue());
}
catch (IllegalArgumentException e)
{
id = AddonId.from(coordinate.getValue(), buildCoordinate.getVersion());
}
}
else
{
id = AddonId.from(buildCoordinate.getGroupId() + ":" + buildCoordinate.getArtifactId(),
buildCoordinate.getVersion());
}
progressMonitor.subTask("Removing previous addon installation (" + id + ")");
RemoveRequest removeRequest = addonManager.remove(id);
removeRequest.perform();
Addons.waitUntilStopped(registry.getAddon(id));