Search in sources :

Example 6 with MavenBinary

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;
}
Also used : MavenBinary(org.guvnor.ala.build.maven.model.MavenBinary) Binary(org.guvnor.ala.build.Binary) MavenBinary(org.guvnor.ala.build.maven.model.MavenBinary) Properties(java.util.Properties) File(java.io.File) URL(java.net.URL)

Example 7 with MavenBinary

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);
}
Also used : Path(org.uberfire.java.nio.file.Path) Project(org.guvnor.ala.build.Project) MavenProject(org.apache.maven.project.MavenProject) MavenProject(org.apache.maven.project.MavenProject) MavenProjectBinaryImpl(org.guvnor.ala.build.maven.model.impl.MavenProjectBinaryImpl) MavenBinary(org.guvnor.ala.build.maven.model.MavenBinary)

Aggregations

MavenBinary (org.guvnor.ala.build.maven.model.MavenBinary)7 Path (org.uberfire.java.nio.file.Path)3 File (java.io.File)2 MavenProject (org.apache.maven.project.MavenProject)2 Binary (org.guvnor.ala.build.Binary)2 WildflyProvider (org.guvnor.ala.wildfly.model.WildflyProvider)2 Test (org.junit.Test)2 URL (java.net.URL)1 Path (java.nio.file.Path)1 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1 Artifact (org.eclipse.aether.artifact.Artifact)1 Project (org.guvnor.ala.build.Project)1 MavenDependencyConfigImpl (org.guvnor.ala.build.maven.config.impl.MavenDependencyConfigImpl)1 MavenBinaryImpl (org.guvnor.ala.build.maven.model.impl.MavenBinaryImpl)1 MavenProjectBinaryImpl (org.guvnor.ala.build.maven.model.impl.MavenProjectBinaryImpl)1 Input (org.guvnor.ala.pipeline.Input)1 Pipeline (org.guvnor.ala.pipeline.Pipeline)1 PipelineExecutor (org.guvnor.ala.pipeline.execution.PipelineExecutor)1 BuildRegistry (org.guvnor.ala.registry.BuildRegistry)1