private void install(String addonCoordinates)
{
Version runtimeAPIVersion = AddonRepositoryImpl.getRuntimeAPIVersion();
try
{
AddonDependencyResolver resolver = new MavenAddonDependencyResolver();
AddonManagerImpl addonManager = new AddonManagerImpl(furnace, resolver);
AddonId addon;
// This allows forge --install maven
if (addonCoordinates.contains(","))
{
if (addonCoordinates.contains(":"))
{
addon = AddonId.fromCoordinates(addonCoordinates);
}
else
{
addon = AddonId.fromCoordinates(FORGE_ADDON_GROUP_ID + addonCoordinates);
}
}
else
{
AddonId[] versions;
String coordinate;
if (addonCoordinates.contains(":"))
{
coordinate = addonCoordinates;
versions = resolver.resolveVersions(addonCoordinates).get();
}
else
{
coordinate = FORGE_ADDON_GROUP_ID + addonCoordinates;
versions = resolver.resolveVersions(coordinate).get();
}
if (versions.length == 0)
{
throw new IllegalArgumentException("No Artifact version found for " + coordinate);
}
else
{
AddonId selected = null;
for (int i = versions.length - 1; selected == null && i >= 0; i--)
{
String apiVersion = resolver.resolveAPIVersion(versions[i]).get();
if (apiVersion != null
&& Versions.isApiCompatible(runtimeAPIVersion, new SingleVersion(apiVersion)))
{
selected = versions[i];
}