org.jboss.shrinkwrap.api.container.LibraryContainer Java Examples
The following examples show how to use
org.jboss.shrinkwrap.api.container.LibraryContainer.
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: FaultToleranceApplicationArchiveProcessor.java From smallrye-fault-tolerance with Apache License 2.0 | 5 votes |
@Override public void process(Archive<?> applicationArchive, TestClass testClass) { if (!(applicationArchive instanceof ClassContainer)) { LOGGER.warning( "Unable to add additional classes - not a class/resource container: " + applicationArchive); return; } ClassContainer<?> classContainer = (ClassContainer<?>) applicationArchive; if (applicationArchive instanceof LibraryContainer) { JavaArchive additionalBeanArchive = ShrinkWrap.create(JavaArchive.class); additionalBeanArchive.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); ((LibraryContainer<?>) applicationArchive).addAsLibrary(additionalBeanArchive); } else { classContainer.addAsResource(EmptyAsset.INSTANCE, "META-INF/beans.xml"); } if (!applicationArchive.contains("META-INF/beans.xml")) { applicationArchive.add(EmptyAsset.INSTANCE, "META-INF/beans.xml"); } String config; if (!applicationArchive.contains(MP_CONFIG_PATH)) { config = MAX_THREADS_OVERRIDE; } else { ByteArrayOutputStream output = readCurrentConfig(applicationArchive); applicationArchive.delete(MP_CONFIG_PATH); config = output.toString() + "\n" + MAX_THREADS_OVERRIDE; } classContainer.addAsResource(new StringAsset(config), MP_CONFIG_PATH); LOGGER.info("Added additional resources to " + applicationArchive.toString(true)); }
Example #2
Source File: UberjarSimpleContainer.java From thorntail with Apache License 2.0 | 5 votes |
private <C extends LibraryContainer<?> & ManifestContainer<?>> void munge(C container, DeclaredDependencies declaredDependencies) { for (ArtifactSpec artifact : declaredDependencies.getRuntimeExplicitAndTransientDependencies()) { assert artifact.file != null : "artifact.file cannot be null at this point: " + artifact; container.addAsLibrary(artifact.file); } try { MarkerContainer.addMarker(container, "org.wildfly.swarm.allDependencies.added"); } catch (Exception e) { throw new RuntimeException(e); } }
Example #3
Source File: LibUtils.java From appengine-tck with Apache License 2.0 | 4 votes |
public void addGaeAsLibrary(LibraryContainer deployment) { addLibrary(deployment, "com.google.appengine:appengine-api-1.0-sdk"); }
Example #4
Source File: LibUtils.java From appengine-tck with Apache License 2.0 | 4 votes |
public void addLibrary(LibraryContainer deployment, String groupId, String artifactId) { addLibrary(deployment, groupId + ":" + artifactId); }
Example #5
Source File: LibUtils.java From appengine-tck with Apache License 2.0 | 4 votes |
public void addLibrary(LibraryContainer deployment, String coordinate) { deployment.addAsLibraries(getDependency(coordinate)); }
Example #6
Source File: Enrichers.java From tomee with Apache License 2.0 | 4 votes |
public static LibraryContainer wrap(final org.jboss.shrinkwrap.api.Archive<?> archive) { if (!(LibraryContainer.class.isInstance(archive))) { throw new IllegalArgumentException("Unsupported archive type: " + archive.getClass().getName()); } return (LibraryContainer) archive; }
Example #7
Source File: Mvn.java From tomee with Apache License 2.0 | 4 votes |
public <T extends Archive<?>> T build(final Class<T> type) { initDefaults(); final T webArchive = ShrinkWrap.create(type, name); if (basePackage != null) { if (ClassContainer.class.isInstance(webArchive)) { final ClassContainer<?> container = ClassContainer.class.cast(webArchive); if (filter != null) { container.addPackages(true, filter, basePackage); } else { container.addPackages(true, basePackage); } } } final String root; if (WebContainer.class.isInstance(webArchive)) { root = "/WEB-INF/classes"; } else { root = "/"; } add(webArchive, classes, root) .add(webArchive, resources, root) .add(webArchive, webapp, "/"); for (final Map.Entry<File, String> additionalResource : additionalResources.entrySet()) { add(webArchive, additionalResource.getKey(), additionalResource.getValue()); } if (LibraryContainer.class.isInstance(webArchive)) { try { final File[] deps = Maven.configureResolver().workOffline().loadPomFromFile(new File(basedir, "pom.xml")) .importDependencies(scopes).resolve().withTransitivity().asFile(); if (deps.length > 0) { LibraryContainer.class.cast(webArchive).addAsLibraries(deps); } } catch (final Exception e) { // no-op: no deps } } return webArchive; }