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());
}
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);
}
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);
}
}
}
Aggregations