use of org.guvnor.ala.build.maven.model.MavenProject in project kie-wb-common by kiegroup.
the class ContextAwareDockerProvisioningConfig method setContext.
@Override
@JsonIgnore
public void setContext(final Map<String, ?> context) {
this.context = context;
this.providerId = (ProviderId) this.context.get("docker-provider");
try {
final Object _project = context.get("project");
if (_project != null && _project instanceof MavenProject) {
final Collection<PlugIn> plugIns = ((MavenProject) _project).getBuildPlugins();
for (final PlugIn plugIn : plugIns) {
if (plugIn.getId().equals("io.fabric8:docker-maven-plugin")) {
final Map<String, Object> _config = (Map<String, Object>) plugIn.getConfiguration().get("images");
imageName = getValue(_config, "image").get("name").toString();
portNumber = getValue(getValue(getValue(_config, "image"), "build"), "ports").get("port").toString();
break;
}
}
}
} catch (final Exception ex) {
LOG.warn("Error failing to parse Maven configuration for Docker Plugin: " + ex.getMessage(), ex);
}
}
Aggregations