org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage Java Examples
The following examples show how to use
org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KeycloakDependenciesResolver.java From keycloak with Apache License 2.0 | 6 votes |
public static File[] resolveDependencies(String canonicalForm) { if (dependencies.containsKey(canonicalForm)) { return dependencies.get(canonicalForm); } log.info("Resolving " + canonicalForm + "'s dependencies"); PomEquippedResolveStage resolver = Maven.configureResolverViaPlugin(); File[] files = resolver.addDependency(MavenDependencies.createDependency(canonicalForm, ScopeType.COMPILE, false)) .resolve().withTransitivity().asFile(); dependencies.put(canonicalForm, files); log.info("Resolving dependencies is finished with " + files.length + " files"); return dependencies.get(canonicalForm); }
Example #2
Source File: RestClientArchiveProcessor.java From thorntail with Apache License 2.0 | 6 votes |
@Override public void process(Archive<?> appArchive, TestClass testClass) { if (!(appArchive instanceof WebArchive)) { return; } log.info("Preparing archive: " + appArchive); WARArchive war = appArchive.as(WARArchive.class); PomEquippedResolveStage pom = Maven.resolver().loadPomFromFile("pom.xml"); // Wiremock classes that need to be present File[] wiremockDeps = pom .resolve("com.github.tomakehurst:wiremock") .withTransitivity() .asFile(); war.addAsLibraries(wiremockDeps); // TCK Classes that need to present war.addPackages(true, "org.eclipse.microprofile.rest.client.tck.ext"); log.fine("Augmented war: \n" + war.toString(true)); }
Example #3
Source File: ExampleJUnitTransformer.java From appengine-tck with Apache License 2.0 | 6 votes |
public static WebArchive buildArchive(String clazz) { WebArchive war = ArquillianJUnitTransformer.createWar(); ArquillianJUnitTransformer.addClasses(war, clazz, ExampleJUnitTransformer.class.getClassLoader()); // Your test suite is most likely built separately from the TCK. You would include all the // dependencies in the pom.xml, and then declare the packages and classes here. war.addPackage("com.google.appengine.sometests"); // Include this even though you may not have an appengine-web.xml for your tests. war.addAsWebInfResource("appengine-web.xml"); final PomEquippedResolveStage resolver = getResolver("pom.xml"); // Necessary to run under App Engine. war.addAsLibraries(resolve(resolver, "com.google.appengine:appengine-api-1.0-sdk")); // GAE testing lib war.addAsLibraries(resolve(resolver, "com.google.appengine:appengine-testing")); // TCK Internals necessary for any tests to run under the TCK. war.addAsLibraries(resolve(resolver, "com.google.appengine.tck:appengine-tck-transformers")); // cleanup dep war.addAsLibraries(resolve(resolver, "com.google.appengine.tck:appengine-tck-base")); // lifecycle dep return war; }
Example #4
Source File: ArchiveProvider.java From gazpachoquest with GNU General Public License v3.0 | 6 votes |
static WebArchive base(String warName) { PomEquippedResolveStage resolver = Maven.resolver().loadPomFromFile("pom.xml"); return ShrinkWrap .create(WebArchive.class, warName + ".war") .addClasses(FRAMEWORK_CLASSES) .addAsLibraries(resolver.resolve("com.vaadin:vaadin-server:7.1.6").withoutTransitivity().asSingleFile()) .addAsLibraries(resolver.resolve("com.vaadin:vaadin-shared:7.1.6").withoutTransitivity().asSingleFile()) .addAsWebInfResource(new ByteArrayAsset(VaadinExtension.class.getName().getBytes()), ArchivePaths.create("services/javax.enterprise.inject.spi.Extension")) .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); /*- MavenDependencyResolver resolver = DependencyResolvers.use(MavenDependencyResolver.class).loadMetadataFromPom( "pom.xml"); return ShrinkWrap .create(WebArchive.class, warName + ".war") .addClasses(FRAMEWORK_CLASSES) .addAsLibraries(resolver.artifact("com.vaadin:vaadin-server:7.1.6").resolveAsFiles()) .addAsLibraries(resolver.artifact("com.vaadin:vaadin-shared:7.1.6").resolveAsFiles()) .addAsWebInfResource(new ByteArrayAsset(VaadinExtension.class.getName().getBytes()), ArchivePaths.create("services/javax.enterprise.inject.spi.Extension")) .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); */ }
Example #5
Source File: Helpers.java From HttpSessionReplacer with MIT License | 5 votes |
static File[] resolveJar() { PomEquippedResolveStage pom = Maven.configureResolver() .workOffline() .withMavenCentralRepo(false) .withClassPathResolution(true) .loadPomFromFile("pom.xml"); return pom.resolve(Helpers.SHADED_JAR).withTransitivity().asFile(); }
Example #6
Source File: ResteasyTomcatServerBootstrap.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override protected void addRuntimeSpecificLibraries(WebArchive wa, PomEquippedResolveStage resolver) { // inject rest easy version to differentiate between resteasy and wildfly-compatibility profile String restEasyVersion = System.getProperty("restEasyVersion"); wa.addAsLibraries(resolver.addDependencies( MavenDependencies.createDependency("org.jboss.resteasy:resteasy-jaxrs:" + restEasyVersion, ScopeType.TEST, false, MavenDependencies.createExclusion("org.apache.httpcomponents:httpclient"))).resolve() .withTransitivity().asFile()); }
Example #7
Source File: AppEngineDataNucleusTransformer.java From appengine-tck with Apache License 2.0 | 5 votes |
public static WebArchive buildArchive(String clazz) { WebArchive war = createWar(); addClasses(war, clazz, AppEngineDataNucleusTransformer.class.getClassLoader()); war.addPackage("com.google.appengine.datanucleus"); war.addClass("com.google.appengine.datanucleus.jpa.JPATestCase$EntityManagerFactoryName"); war.addClass("com.google.appengine.datanucleus.jdo.JDOTestCase$PersistenceManagerFactoryName"); war.addPackage("com.google.appengine.datanucleus.query"); war.addPackage("com.google.appengine.datanucleus.test.jdo"); war.addPackage("com.google.appengine.datanucleus.test.jpa"); war.setWebXML(new org.jboss.shrinkwrap.api.asset.StringAsset("<web/>")); war.addAsWebInfResource("appengine-web.xml"); war.addAsWebInfResource("META-INF/persistence.xml", "classes/META-INF/persistence.xml"); war.addAsWebInfResource("META-INF/jdoconfig.xml", "classes/META-INF/jdoconfig.xml"); war.addAsResource(new StringAsset("ignore.logging=true\n"), "capedwarf-compatibility.properties"); final PomEquippedResolveStage resolver = getResolver("pom.xml"); // GAE DN libs war.addAsLibraries(resolve(resolver, "com.google.appengine.orm:datanucleus-appengine")); war.addAsLibraries(resolve(resolver, "com.google.appengine:appengine-api-1.0-sdk")); war.addAsLibraries(resolve(resolver, "com.google.appengine:appengine-testing")); war.addAsLibraries(resolve(resolver, "com.google.appengine:appengine-api-stubs")); war.addAsLibraries(resolve(resolver, "org.datanucleus:datanucleus-core")); war.addAsLibraries(resolve(resolver, "org.datanucleus:datanucleus-api-jdo")); war.addAsLibraries(resolve(resolver, "org.datanucleus:datanucleus-api-jpa")); war.addAsLibraries(resolve(resolver, "javax.jdo:jdo-api")); war.addAsLibraries(resolve(resolver, "org.apache.geronimo.specs:geronimo-jpa_2.0_spec")); war.addAsLibraries(resolve(resolver, "org.easymock:easymock")); war.addAsLibraries(resolve(resolver, "org.easymock:easymockclassextension")); // TCK Internals war.addAsLibraries(resolve(resolver, "com.google.appengine.tck:appengine-tck-transformers")); // cleanup dep war.addAsLibraries(resolve(resolver, "com.google.appengine.tck:appengine-tck-base")); // lifecycle dep return war; }
Example #8
Source File: WebArchiveBuilder.java From ozark with Apache License 2.0 | 5 votes |
public WebArchive build() { PomEquippedResolveStage stage = Maven.configureResolver().workOffline() .withClassPathResolution(true) .loadPomFromFile("pom.xml", System.getProperty("testsuite.profile")) .importCompileAndRuntimeDependencies(); if (!this.additionalDependencies.isEmpty()) { stage = stage.addDependencies(this.additionalDependencies); } return archive.addAsLibraries(stage.resolve().withTransitivity().asFile()); }
Example #9
Source File: WebArchiveBuilder.java From krazo with Apache License 2.0 | 5 votes |
public WebArchive build() { PomEquippedResolveStage stage = Maven.configureResolver() .withClassPathResolution(true) .loadPomFromFile("pom.xml", System.getProperty("testsuite.profile", "")) .importCompileAndRuntimeDependencies(); if (!this.additionalDependencies.isEmpty()) { stage = stage.addDependencies(this.additionalDependencies); } return archive.addAsLibraries(stage.resolve().withTransitivity().asFile()); }
Example #10
Source File: ServerFrontendWebAppBuilder.java From ldp4j with Apache License 2.0 | 4 votes |
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; }
Example #11
Source File: ShrinkWrapTransformer.java From appengine-tck with Apache License 2.0 | 4 votes |
protected static PomEquippedResolveStage getResolver(String pom) { return Maven.resolver().loadPomFromFile(pom); }
Example #12
Source File: ShrinkWrapTransformer.java From appengine-tck with Apache License 2.0 | 4 votes |
protected static File[] resolve(PomEquippedResolveStage resolver, String... coordinates) { final File[] files = resolver.resolve(coordinates).withoutTransitivity().as(File.class); if (files == null || files.length == 0) throw new IllegalArgumentException("Null or empty files (" + Arrays.toString(files) + "): " + Arrays.toString(coordinates)); return files; }
Example #13
Source File: LibUtils.java From appengine-tck with Apache License 2.0 | 4 votes |
protected PomEquippedResolveStage getResolver() { if (resolver == null) resolver = Maven.resolver().loadPomFromFile(buildPomPath()); return resolver; }
Example #14
Source File: MavenProfileLoader.java From thorntail with Apache License 2.0 | 4 votes |
public static PomEquippedResolveStage loadPom(ConfigurableMavenResolverSystem resolver) { return resolver.loadPomFromFile(FileSystemLayout.resolveMavenBuildFileName(), determineProfiles()); }
Example #15
Source File: MavenDependencyDeclarationFactory.java From thorntail with Apache License 2.0 | 4 votes |
@Override public DeclaredDependencies create(FileSystemLayout ignored, ShrinkwrapArtifactResolvingHelper resolvingHelper) { final DeclaredDependencies declaredDependencies = new DeclaredDependencies(); final PomEquippedResolveStage pom = MavenProfileLoader.loadPom(resolvingHelper.getResolver()); // NonTransitiveStrategy final MavenResolvedArtifact[] explicitDeps = resolvingHelper.withResolver(r -> pom .importRuntimeAndTestDependencies() .resolve() .withoutTransitivity() .asResolvedArtifact() ); // TransitiveStrategy for (MavenResolvedArtifact directDep : explicitDeps) { ArtifactSpec parent = new ArtifactSpec( directDep.getScope().toString(), directDep.getCoordinate().getGroupId(), directDep.getCoordinate().getArtifactId(), directDep.getCoordinate().getVersion(), directDep.getCoordinate().getPackaging().toString(), directDep.getCoordinate().getClassifier(), directDep.asFile() ); MavenResolvedArtifact[] bucket = resolvingHelper.withResolver(r -> { r.addDependency(resolvingHelper.createMavenDependency(parent)); return pom .resolve() .withTransitivity() .asResolvedArtifact(); } ); for (MavenResolvedArtifact dep : bucket) { ArtifactSpec child = new ArtifactSpec( dep.getScope().toString(), dep.getCoordinate().getGroupId(), dep.getCoordinate().getArtifactId(), dep.getCoordinate().getVersion(), dep.getCoordinate().getPackaging().toString(), dep.getCoordinate().getClassifier(), dep.asFile() ); declaredDependencies.add( parent, child ); } } return declaredDependencies; }
Example #16
Source File: TomcatServerBootstrap.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public void start() { Properties serverProperties = readProperties(); int port = Integer.parseInt(serverProperties.getProperty(PORT_PROPERTY)); tomcat = new Tomcat(); tomcat.setPort(port); tomcat.setBaseDir(getWorkingDir()); tomcat.getHost().setAppBase(getWorkingDir()); tomcat.getHost().setAutoDeploy(true); tomcat.getHost().setDeployOnStartup(true); String contextPath = "/" + getContextPath(); // 1) Must not use shrinkwrap offline mode (see longer explanation at the end of the file) // 2) Must use configuration via Shrinkwrap Maven plugin (see pom.xml for plugin definition); // This forwards things like the location of the settings.xml file to Shrinkwrap. We need // that for our CI where settings.xml is not in the default location. PomEquippedResolveStage resolver = Maven.configureResolver() .useLegacyLocalRepo(true).configureViaPlugin(); WebArchive wa = ShrinkWrap.create(WebArchive.class, "rest-test.war").setWebXML(webXmlPath) .addAsLibraries(resolver.resolve("org.codehaus.jackson:jackson-jaxrs:1.6.5").withTransitivity().asFile()) .addAsLibraries(resolver.addDependencies( MavenDependencies.createDependency("org.mockito:mockito-core", ScopeType.TEST, false, MavenDependencies.createExclusion("org.hamcrest:hamcrest-core"))).resolve() .withTransitivity().asFile()) .addAsServiceProvider(ProcessEngineProvider.class, MockedProcessEngineProvider.class) .add(new ClassLoaderAsset("runtime/tomcat/context.xml"), "META-INF/context.xml") .addPackages(true, "org.camunda.bpm.engine.rest"); addRuntimeSpecificLibraries(wa, resolver); wa.setWebXML(webXmlPath); String webAppPath = getWorkingDir() + "/" + getContextPath() + ".war"; wa.as(ZipExporter.class).exportTo(new File(webAppPath), true); tomcat.addWebapp(tomcat.getHost(), contextPath, webAppPath); try { tomcat.start(); } catch (LifecycleException e) { throw new RuntimeException(e); } }
Example #17
Source File: JerseyTomcatServerBootstrap.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected void addRuntimeSpecificLibraries(WebArchive wa, PomEquippedResolveStage resolver) { wa.addAsLibraries(resolver.resolve("org.glassfish.jersey.containers:jersey-container-servlet:2.25.1").withTransitivity().asFile()); }
Example #18
Source File: WinkTomcatServerBootstrap.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Override protected void addRuntimeSpecificLibraries(WebArchive wa, PomEquippedResolveStage resolver) { wa.addAsLibraries(resolver.resolve("org.apache.wink:wink-server:1.1.1-incubating").withTransitivity().asFile()); }
Example #19
Source File: JerseyTomcatServerBootstrap.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected void addRuntimeSpecificLibraries(WebArchive wa, PomEquippedResolveStage resolver) { wa.addAsLibraries(resolver.resolve("com.sun.jersey:jersey-servlet:1.17.1").withTransitivity().asFile()); }
Example #20
Source File: CXFTomcatServerBootstrap.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected void addRuntimeSpecificLibraries(WebArchive wa, PomEquippedResolveStage resolver) { wa.addAsLibraries(resolver.resolve("org.apache.cxf:cxf-rt-frontend-jaxrs:3.0.3").withTransitivity().asFile()); }
Example #21
Source File: TomcatServerBootstrap.java From camunda-bpm-platform with Apache License 2.0 | votes |
protected abstract void addRuntimeSpecificLibraries(WebArchive wa, PomEquippedResolveStage resolver);