private void install(String addonCoordinates)
{
try
{
MavenDependencyResolver resolver = new MavenDependencyResolver(new FileResourceFactory(), new MavenContainer());
AddonManagerImpl addonManager = new AddonManagerImpl(forge, resolver);
AddonId addon;
// This allows forge --install maven
if (addonCoordinates.contains(","))
{
addon = AddonId.fromCoordinates(addonCoordinates);
}
else
{
String coordinates = "org.jboss.forge:" + addonCoordinates;
CoordinateBuilder coordinate = CoordinateBuilder.create(coordinates);
List<Coordinate> versions = resolver.resolveVersions(DependencyQueryBuilder.create(coordinate));
if (versions.isEmpty())
{
throw new IllegalArgumentException("No Artifact version found for " + coordinate);
}
Coordinate vCoord = versions.get(versions.size() - 1);
addon = AddonId.from(vCoord.getGroupId() + ":" + vCoord.getArtifactId(), vCoord.getVersion());
}
InstallRequest request = addonManager.install(addon);
System.out.println(request);
request.perform();
}
catch (Exception e)
{