use of org.guvnor.ala.build.maven.model.MavenBinary in project kie-wb-common by kiegroup.
the class OpenShiftMavenDeployer method deploy.
public boolean deploy(List<Binary> binaries) throws Exception {
URL nexusContentURL = getNexusContentURL(true);
if (nexusContentURL == null) {
return false;
}
String origCustomSettingsProp = System.getProperty(CUSTOM_SETTINGS_PROPERTY);
try {
System.setProperty(CUSTOM_SETTINGS_PROPERTY, generateSettingsXml());
MavenSettings.reinitSettings();
for (Binary binary : binaries) {
MavenBinary mavenBinary = (MavenBinary) binary;
File pom = new File(mavenBinary.getProject().getTempDir(), "pom.xml");
Properties props = new Properties();
boolean isSnapshot = mavenBinary.getVersion().endsWith("SNAPSHOT");
String nexusRepoUrl = nexusContentURL + "repositories/" + (isSnapshot ? "snapshots/" : "releases/");
props.setProperty("altDeploymentRepository", "nexus::default::" + nexusRepoUrl);
MavenBuildExecutor.executeMaven(pom, props, new String[] { "deploy" });
}
} finally {
if (origCustomSettingsProp != null) {
System.setProperty(CUSTOM_SETTINGS_PROPERTY, origCustomSettingsProp);
} else {
System.clearProperty(CUSTOM_SETTINGS_PROPERTY);
}
MavenSettings.reinitSettings();
}
return true;
}
use of org.guvnor.ala.build.maven.model.MavenBinary in project kie-wb-common by kiegroup.
the class MavenBuildExecConfigExecutor method apply.
@Override
public Optional<BinaryConfig> apply(final MavenBuild mavenBuild, final MavenBuildExecConfig mavenBuildExecConfig) {
final Project project = mavenBuild.getProject();
final MavenProject mavenProject = build(project, mavenBuild.getGoals(), mavenBuild.getProperties());
final Path path = FileSystems.getFileSystem(URI.create("file://default")).getPath(project.getTempDir() + "/target/" + project.getExpectedBinary());
final MavenBinary binary = new MavenProjectBinaryImpl(path, project, mavenProject.getGroupId(), mavenProject.getArtifactId(), mavenProject.getVersion());
buildRegistry.registerBinary(binary);
return Optional.of(binary);
}
Aggregations