Search in sources :

Example 1 with MavenResolverSystem

use of org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem in project tomee by apache.

the class OverridedClientTest method war.

@Deployment
public static Archive<?> war() {
    final MavenResolverSystem resolver = Maven.resolver();
    final String jerseyVersion = "2.17";
    final String hkApi = "2.4.0-b16";
    return ShrinkWrap.create(WebArchive.class, "OverridedClientTest.war").addAsServiceProvider(ClientBuilder.class.getName(), // missing in jersey
    "org.glassfish.jersey.client.JerseyClientBuilder").addAsLibraries(resolver.resolve("org.glassfish.jersey.core:jersey-common:" + jerseyVersion).withoutTransitivity().asFile()).addAsLibraries(resolver.resolve("org.glassfish.jersey.core:jersey-client:" + jerseyVersion).withoutTransitivity().asFile()).addAsLibraries(resolver.resolve("org.glassfish.hk2:hk2-api:" + hkApi).withoutTransitivity().asFile()).addAsLibraries(resolver.resolve("org.glassfish.hk2:hk2-core:" + hkApi).withoutTransitivity().asFile()).addAsLibraries(resolver.resolve("org.glassfish.jersey.bundles.repackaged:jersey-guava:" + jerseyVersion).withoutTransitivity().asFile());
}
Also used : MavenResolverSystem(org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 2 with MavenResolverSystem

use of org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem in project jbpm by kiegroup.

the class IntegrationMavenResolver method get.

public static PomEquippedResolveStage get(String... profiles) {
    String localRepositoryPath = System.getProperty("settings.localRepository");
    String version = System.getProperty("project.version");
    File pom = new File(localRepositoryPath, "org/jbpm/shrinkwrap-war-profiles/" + version + "/shrinkwrap-war-profiles-" + version + ".pom");
    // Custom settings.xml can be passed via org.apache.maven.user-settings property
    final MavenResolverSystem resolver = Maven.resolver();
    return resolver.loadPomFromFile(pom, profiles);
}
Also used : File(java.io.File) MavenResolverSystem(org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem)

Example 3 with MavenResolverSystem

use of org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem in project syndesis by syndesisio.

the class RepackageExtensionMojo method obtainBomDependencies.

protected Set<MavenDependency> obtainBomDependencies(String urlLocation) throws IOException, MojoExecutionException {
    Artifact artifact = downloadAndInstallArtifact(urlLocation).getArtifact();
    File tempPom = new File(outputDirectory, ".syndesis-extension-plugin-temp-pom");
    try (BufferedWriter out = Files.newBufferedWriter(tempPom.toPath(), StandardCharsets.UTF_8)) {
        Dependency bom = new Dependency();
        bom.setGroupId(artifact.getGroupId());
        bom.setArtifactId(artifact.getArtifactId());
        bom.setVersion(artifact.getVersion());
        bom.setType(artifact.getExtension());
        bom.setScope("import");
        Model bomModel = new Model();
        bomModel.setDependencyManagement(new DependencyManagement());
        bomModel.getDependencyManagement().addDependency(bom);
        bomModel.setRepositories(project.getRepositories());
        MavenProject bomProject = new MavenProject();
        bomProject.setModel(bomModel);
        bomProject.setModelVersion(project.getModelVersion());
        bomProject.setGroupId(project.getGroupId());
        bomProject.setArtifactId(project.getArtifactId() + "-temp-bom");
        bomProject.setVersion(project.getVersion());
        ModelWriter modelWriter = new DefaultModelWriter();
        modelWriter.write(out, Collections.emptyMap(), bomProject.getModel());
        MavenResolverSystem resolver = Maven.resolver();
        resolver.loadPomFromFile(tempPom).importCompileAndRuntimeDependencies();
        MavenWorkingSession session = ((MavenWorkingSessionContainer) resolver).getMavenWorkingSession();
        return session.getDependencyManagement();
    } finally {
        if (!tempPom.delete()) {
            getLog().warn("Cannot delete file " + tempPom);
        }
    }
}
Also used : DefaultModelWriter(org.apache.maven.model.io.DefaultModelWriter) MavenWorkingSession(org.jboss.shrinkwrap.resolver.api.maven.MavenWorkingSession) MavenWorkingSessionContainer(org.jboss.shrinkwrap.resolver.impl.maven.MavenWorkingSessionContainer) MavenProject(org.apache.maven.project.MavenProject) Model(org.apache.maven.model.Model) MavenDependency(org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenDependency) Dependency(org.apache.maven.model.Dependency) File(java.io.File) Artifact(org.eclipse.aether.artifact.Artifact) DefaultArtifact(org.eclipse.aether.artifact.DefaultArtifact) DependencyManagement(org.apache.maven.model.DependencyManagement) DefaultModelWriter(org.apache.maven.model.io.DefaultModelWriter) ModelWriter(org.apache.maven.model.io.ModelWriter) MavenResolverSystem(org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem) BufferedWriter(java.io.BufferedWriter)

Aggregations

MavenResolverSystem (org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem)3 File (java.io.File)2 BufferedWriter (java.io.BufferedWriter)1 Dependency (org.apache.maven.model.Dependency)1 DependencyManagement (org.apache.maven.model.DependencyManagement)1 Model (org.apache.maven.model.Model)1 DefaultModelWriter (org.apache.maven.model.io.DefaultModelWriter)1 ModelWriter (org.apache.maven.model.io.ModelWriter)1 MavenProject (org.apache.maven.project.MavenProject)1 Artifact (org.eclipse.aether.artifact.Artifact)1 DefaultArtifact (org.eclipse.aether.artifact.DefaultArtifact)1 Deployment (org.jboss.arquillian.container.test.api.Deployment)1 MavenWorkingSession (org.jboss.shrinkwrap.resolver.api.maven.MavenWorkingSession)1 MavenDependency (org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenDependency)1 MavenWorkingSessionContainer (org.jboss.shrinkwrap.resolver.impl.maven.MavenWorkingSessionContainer)1