本文整理汇总了Java中org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem类的典型用法代码示例。如果您正苦于以下问题:Java MavenResolverSystem类的具体用法?Java MavenResolverSystem怎么用?Java MavenResolverSystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MavenResolverSystem类属于org.jboss.shrinkwrap.resolver.api.maven包,在下文中一共展示了MavenResolverSystem类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDeployment
import org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem; //导入依赖的package包/类
@Deployment
public static WebArchive createDeployment() {
MavenResolverSystem mavenResolver = Resolvers.use(MavenResolverSystem.class);
List<String> deps = asList(
"org.hawkular.metrics:hawkular-metrics-model:" + System.getProperty("version.org.hawkular.metrics"),
"org.hawkular.metrics:hawkular-metrics-api-util:" + System.getProperty("version.org.hawkular.metrics"),
"org.hawkular.metrics:hawkular-metrics-alerting:" + System.getProperty("version.org.hawkular.metrics"),
"org.hawkular.alerts:hawkular-alerts-api:" + System.getProperty("version.org.hawkular.alerts"),
"org.hawkular.alerts:hawkular-alerts-filter-api:" + System.getProperty("version.org.hawkular.alerts"),
"io.reactivex:rxjava:" + System.getProperty("version.io.reactivex.rxjava"));
Collection<JavaArchive> dependencies = new HashSet<JavaArchive>();
dependencies.addAll(asList(mavenResolver.loadPomFromFile("pom.xml").resolve(deps)
.withoutTransitivity().as(JavaArchive.class)));
WebArchive archive = ShrinkWrap.create(WebArchive.class)
.addPackages(true, "org.hawkular.alerts.api.services")
.addAsLibraries(dependencies)
.addClass(ConfigurableProducer.class)
.addAsWebInfResource(new File("src/test/resources/web.xml"))
.addAsWebInfResource(new File("src/test/resources/jboss-deployment-structure.xml"))
.setManifest(new StringAsset("Manifest-Version: 1.0\nDependencies: com.google.guava\n"));
return archive;
}
示例2: obtainBomDependencies
import org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem; //导入依赖的package包/类
protected Set<MavenDependency> obtainBomDependencies(String urlLocation) throws IOException, MojoExecutionException {
ArtifactResult artifact = downloadAndInstallArtifact(urlLocation);
File file = artifact.getArtifact().getFile();
MavenResolverSystem resolver = Maven.resolver();
resolver.loadPomFromFile(file).importCompileAndRuntimeDependencies();
MavenWorkingSession session =((MavenWorkingSessionContainer)resolver).getMavenWorkingSession();
return session.getDependencyManagement();
}
示例3: getTestDeployment
import org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem; //导入依赖的package包/类
/**
* Test hooks so we can do some cleanupCreatedProject
*
* @return
*/
static WebArchive getTestDeployment() {
final WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war")
.addPackages(
true,
OpenShiftServiceSpi.class.getPackage(),
OpenShiftProjectImpl.class.getPackage(),
OpenShiftServiceFactory.class.getPackage(),
GitHubServiceSpi.class.getPackage(),
KohsukeGitHubServiceImpl.class.getPackage(),
GitHubServiceFactory.class.getPackage())
.addPackage(TestSupport.class.getPackage());
final File[] depsOpenshift = Resolvers.use(MavenResolverSystem.class).
loadPomFromFile("../services/openshift-service-impl/pom.xml").
importRuntimeAndTestDependencies().
resolve().
withTransitivity().
asFile();
final File[] depsGithub = Resolvers.use(MavenResolverSystem.class).
loadPomFromFile("../services/github-service-impl/pom.xml").
importRuntimeAndTestDependencies().
resolve().
withTransitivity().
asFile();
final File[] ourTestDeps = Resolvers.use(MavenResolverSystem.class).
loadPomFromFile("pom.xml").
importTestDependencies().
resolve().
withTransitivity().
asFile();
archive.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
archive.addAsLibraries(depsOpenshift);
archive.addAsLibraries(depsGithub);
archive.addAsLibraries(ourTestDeps);
return archive;
}
示例4: deployment
import org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem; //导入依赖的package包/类
@Deployment
public static Archive<?> deployment() {
WebArchive war = Deployments.getBaseDeployment();
MavenResolverSystem resolver = Maven.resolver();
war.addAsLibraries(resolver.loadPomFromFile("pom.xml")
.resolve("com.jayway.restassured:rest-assured")
.withTransitivity().asFile());
System.out.println(war.toString(true));
return war;
}
示例5: createDeployment
import org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem; //导入依赖的package包/类
@Deployment(testable = false)
public static WebArchive createDeployment() {
MavenResolverSystem resolver = Maven.resolver();
WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "viewscopedbean.war")
.setWebXML(new File(WEBAPP_SRC, "WEB-INF/web.xml"))
.addClass(ViewScopedBean.class)
.addAsLibraries(resolver.loadPomFromFile("pom.xml").resolve("org.primefaces:primefaces:5.1").withoutTransitivity().asFile())
.addAsWebResource(new File(WEBAPP_SRC, "index.xhtml"))
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
System.out.println(webArchive.toString(true));
return webArchive;
}
示例6: war
import org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem; //导入依赖的package包/类
@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(), "org.glassfish.jersey.client.JerseyClientBuilder") // missing in jersey
.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());
}
示例7: getResolver
import org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem; //导入依赖的package包/类
private static MavenResolverSystem getResolver() {
return Maven.resolver();
}
示例8: setupPortalMinimal
import org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem; //导入依赖的package包/类
protected static void setupPortalMinimal() {
System.setProperty("liferay.version", LIFERAY_VERSION);
System.setProperty("liferay.auto.deploy.dir", PORTAL_AUTO_DEPLOY_DIR);
System.setProperty(
"liferay.app.server.deploy.dir", PORTAL_SERVER_DEPLOY_DIR);
System.setProperty(
"liferay.app.server.lib.global.dir", PORTAL_SERVER_LIB_GLOBAL_DIR);
System.setProperty("liferay.app.server.portal.dir", SERVER_PORTAL_DIR);
try {
ArchiverManager archiverManager = plexusContainer.lookup(
ArchiverManager.class);
assertNotNull(archiverManager);
FileUtils.forceMkdir(new File(PORTAL_AUTO_DEPLOY_DIR));
FileUtils.forceMkdir(new File(PORTAL_SERVER_DEPLOY_DIR));
FileUtils.forceMkdir(new File(PORTAL_SERVER_LIB_GLOBAL_DIR));
FileUtils.forceMkdir(new File(SERVER_PORTAL_DIR));
final MavenResolverSystem mavenResolverSystem =
Maven.configureResolver().fromClassloaderResource(
"settings.xml");
File[] dependencies =
mavenResolverSystem.loadPomFromClassLoaderResource(
"liferay-setup.xml").importRuntimeAndTestDependencies().
resolve().withoutTransitivity().asFile();
File warFile = null;
for (File file : dependencies) {
String fileName = file.getName();
String fileExtension = FilenameUtils.getExtension(fileName);
if (fileExtension.equalsIgnoreCase("jar")) {
FileUtils.copyFile(
file, new File(PORTAL_SERVER_LIB_GLOBAL_DIR,
file.getName()));
}
else if (fileExtension.equalsIgnoreCase("war") &&
fileName.contains("portal-web")) {
warFile = file;
}
}
assertNotNull(warFile);
// extract portal war
UnArchiver unArchiver = archiverManager.getUnArchiver(warFile);
unArchiver.setDestDirectory(new File(SERVER_PORTAL_DIR));
unArchiver.setSourceFile(warFile);
unArchiver.setOverwrite(false);
unArchiver.extract();
setup = true;
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
示例9: build
import org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem; //导入依赖的package包/类
public WebArchive build(JavaArchive... archives) {
if(LOGGER.isDebugEnabled() &&
Boolean.parseBoolean(System.getProperty("org.ldp4j.testing.logging.setup"))) {
LOGGER.debug("Creating testing web application archive:");
LOGGER.debug("- Maven configuration:");
LOGGER.debug(" + Setting: "+getSettings());
LOGGER.debug(" + POM....: "+getPom());
LOGGER.debug("- Web application configuration:");
LOGGER.debug(" + Descriptor.....: "+getWebXml());
LOGGER.debug(" + Deployable name: "+getDeployableName());
LOGGER.debug(" + Control phrase.: "+getControlPhrase());
if(archives.length>0) {
LOGGER.debug("- Custom libraries:");
for(JavaArchive archive:archives) {
LOGGER.debug(" + "+archive);
if(LOGGER.isTraceEnabled() &&
Boolean.parseBoolean(System.getProperty("org.ldp4j.testing.logging.setup")) &&
Boolean.parseBoolean(System.getProperty("org.ldp4j.testing.logging.archive"))) {
LOGGER.trace(archive.toString(true));
}
}
}
}
MavenResolverSystem resolver = Maven.
configureResolver().fromClassloaderResource(getSettings());
PomEquippedResolveStage mavenResolver=
resolver.loadPomFromClassLoaderResource(getPom());
WebArchive war=
ShrinkWrap.
create(WebArchive.class, getDeployableName()).
addAsLibraries(
mavenResolver.
importRuntimeDependencies().asFile()).
addAsLibraries(archives).
addAsWebResource(
new StringAsset(getControlPhrase()),"index.html");
updateWebInf(war);
if(LOGGER.isTraceEnabled() &&
Boolean.parseBoolean(System.getProperty("org.ldp4j.testing.logging.setup")) &&
Boolean.parseBoolean(System.getProperty("org.ldp4j.testing.logging.archive"))) {
LOGGER.trace(String.format("Testing web application archive: \n%s",war.toString(true)));
}
return war;
}
示例10: deployment
import org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem; //导入依赖的package包/类
@Deployment
public static Archive<?> deployment() {
MavenResolverSystem resolver = Maven.resolver();
WebArchive war = Deployments.getBaseDeployment();
war.addAsLibraries(resolver.loadPomFromFile("pom.xml")
.resolve("com.jayway.restassured:rest-assured").withTransitivity().asFile());
System.out.println(war.toString(true));
return war;
}