org.jboss.shrinkwrap.api.container.WebContainer Java Examples
The following examples show how to use
org.jboss.shrinkwrap.api.container.WebContainer.
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: 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; }