本文整理汇总了Java中org.jboss.shrinkwrap.resolver.api.maven.ScopeType类的典型用法代码示例。如果您正苦于以下问题:Java ScopeType类的具体用法?Java ScopeType怎么用?Java ScopeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScopeType类属于org.jboss.shrinkwrap.resolver.api.maven包,在下文中一共展示了ScopeType类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDeployment
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
@Deployment
public static EnterpriseArchive createDeployment() {
WebArchive war = ShrinkWrap.create(WebArchive.class) //
.addClasses(UserService.class, UserRepository.class, User.class) //
.addClasses(UserRepositoryTest.class, DockerDatabaseTestUtil.class) //
.addAsResource("META-INF/persistence.xml") //
.addAsResource("testdata.xml") //
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
File[] pomDependencies = Maven.resolver() //
.loadPomFromFile("pom.xml").importDependencies(ScopeType.TEST) //
.resolve().withTransitivity().asFile();
EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class) //
.addAsModule(war) //
.addAsLibraries(pomDependencies);
return ear;
}
示例2: createDeployment
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
@Deployment
public static EnterpriseArchive createDeployment() {
WebArchive war = ShrinkWrap.create(WebArchive.class) //
.addClasses(UserService.class, UserRepository.class, User.class) //
.addClasses(UserServiceTest.class, DockerDatabaseTestUtil.class) //
.addAsResource("META-INF/persistence.xml") //
.addAsResource("testdata.xml") //
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
File[] pomDependencies = Maven.resolver() //
.loadPomFromFile("pom.xml").importDependencies(ScopeType.TEST) //
.resolve().withTransitivity().asFile();
EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class) //
.addAsModule(war) //
.addAsLibraries(pomDependencies);
return ear;
}
示例3: deployment
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
@Deployment
public static Archive<?> deployment() {
File[] filesCompile = Maven.resolver().loadPomFromFile("pom.xml").importDependencies(ScopeType.COMPILE).resolve().withTransitivity().asFile();
File[] filestest = Maven.resolver().loadPomFromFile("pom.xml")
.resolve("com.fasterxml.jackson.core:jackson-annotations", "com.fasterxml.jackson.core:jackson-databind", "com.fasterxml.jackson.core:jackson-core").withTransitivity().asFile();
JavaArchive jar = ShrinkWrap.create(MavenImporter.class)
.loadPomFromFile("pom.xml")
.importBuildOutput()
.as(JavaArchive.class);
WebArchive war = ShrinkWrap.create(WebArchive.class)
.addAsLibraries(filestest)
.addAsLibraries(jar)
.addAsLibraries(filesCompile)
.addClasses(UserDefaultExample.class, UserRepositoryExample.class)
.addClasses(JAXRSConfigurationExample.class, ObjectMapperProviderExample.class, ResourceExample.class)
.addAsWebInfResource("WEB-INF/test.shiro.ini", "shiro.ini")
.addAsWebInfResource("WEB-INF/web.xml", "web.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
System.out.println(war.toString(true));
return war;
}
示例4: ear
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
@Deployment(testable = false)
public static Archive<?> ear() {
final File[] joda = Maven.resolver()
.offline()
.resolve("joda-time:joda-time:2.5")
.withClassPathResolution(true)
.using(new AcceptScopesStrategy(ScopeType.COMPILE, ScopeType.RUNTIME))
.asFile();
return ShrinkWrap.create(EnterpriseArchive.class, "broken.ear")
.addAsLibraries(joda)
.addAsModule(ShrinkWrap.create(WebArchive.class, "broken-web.war")
.addClasses(LoadJodaFromTheWebAppResource.class)
.addAsManifestResource(new StringAsset(
"<Context>" +
"<Loader className=\"" + TomEEWebappLoader.class.getName() +
"\" loaderClass=\"" + WebAppFirstEarClassLoader.class.getName() + "\" />" +
"</Context>"), "context.xml")
.addAsLibraries(joda));
}
示例5: ear
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
@Deployment(testable = false)
public static Archive<?> ear() {
return ShrinkWrap.create(EnterpriseArchive.class, "broken.ear")
.addAsModule(
ShrinkWrap.create(WebArchive.class, "broken-web.war")
.addClasses(LoadJodaFromTheWebAppResource.class)
.addAsLibraries(
Maven.resolver()
.offline()
.resolve("joda-time:joda-time:2.5")
.withClassPathResolution(true)
.using(new AcceptScopesStrategy(ScopeType.COMPILE, ScopeType.RUNTIME))
.asFile()
)
);
}
示例6: getEngineSpring
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
public static JavaArchive[] getEngineSpring() {
if(CACHED_SPRING_ASSETS != null) {
return CACHED_SPRING_ASSETS;
} else {
JavaArchive[] resolvedArchives = Maven.configureResolver()
.workOffline()
.loadPomFromFile("pom.xml")
.addDependencies(
MavenDependencies.createDependency("org.camunda.bpm:camunda-engine-spring", ScopeType.COMPILE, false,
MavenDependencies.createExclusion("org.camunda.bpm:camunda-engine")),
MavenDependencies.createDependency("org.springframework:spring-web", ScopeType.COMPILE, false))
.resolve()
.withTransitivity()
.as(JavaArchive.class);
if(resolvedArchives.length == 0) {
throw new RuntimeException("could not resolve org.camunda.bpm:camunda-engine-spring");
} else {
CACHED_SPRING_ASSETS = resolvedArchives;
return CACHED_SPRING_ASSETS;
}
}
}
示例7: createMavenDependency
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
public MavenDependency createMavenDependency(final ArtifactSpec spec) {
final MavenCoordinate newCoordinate = MavenCoordinates.createCoordinate(
spec.groupId(),
spec.artifactId(),
spec.version(),
PackagingType.of(spec.type()),
spec.classifier());
return MavenDependencies.createDependency(newCoordinate, ScopeType.fromScopeType(spec.scope), false);
}
示例8: createDeployment
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
@Deployment(testable = false)
public static WebArchive createDeployment() {
String warName = Tutorial3.class.getSimpleName() + ".war";
WebArchive archive = ShrinkWrap.create(WebArchive.class, warName);
archive.setWebXML("tutorial/tut3.webxml");
archive.addClasses(Person.class, Address.class, TutorialServlet3.class);
File[] cibet = Maven.resolver().loadPomFromFile("pom.xml").resolve("com.logitags:cibet-jpa").withoutTransitivity()
.asFile();
archive.addAsLibraries(cibet);
File[] shiro = Maven.resolver().loadPomFromFile("pom.xml").resolve("com.logitags:cibet-shiro").withTransitivity()
.asFile();
archive.addAsLibraries(shiro);
File[] shiro1 = Maven.resolver()
.addDependencies(MavenDependencies.createDependency("org.apache.shiro:shiro-web:1.2.2", ScopeType.COMPILE,
false, MavenDependencies.createExclusion("org.slf4j:slf4j-api")))
.resolve().withTransitivity().asFile();
archive.addAsLibraries(shiro1);
archive.addAsWebInfResource("tutorial/persistence-it1.xml", "classes/META-INF/persistence.xml");
archive.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
archive.addAsWebInfResource("shiro.ini", "classes/shiro.ini");
archive.addAsWebInfResource("tutorial/config.xml", "classes/cibet-config.xml");
log.debug(archive.toString(true));
archive.as(ZipExporter.class).exportTo(new File("target/" + warName), true);
return archive;
}
示例9: createBaseDeployment
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
protected static WebArchive createBaseDeployment() {
boolean offline = true;
PomEquippedResolveStage resolver = Maven.configureResolver().workOffline(offline).loadPomFromFile("pom.xml");
return ShrinkWrap.create(WebArchive.class)
.addAsWebInfResource("test-jboss-deployment-structure.xml", "jboss-deployment-structure.xml")
.addAsWebInfResource("META-INF/beans.xml", "beans.xml")
/* persistence */
.addAsWebInfResource("test-ds.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml")
.addAsLibraries(resolveEjbs(resolver.importDependencies(ScopeType.TEST, ScopeType.COMPILE, ScopeType.RUNTIME)))
;
}
示例10: toMavenDependencies
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
public static MavenDependency[] toMavenDependencies(String[] dependencies, String[] exclusions) {
MavenDependencyExclusion[] mavenExclusions = toMavenExclusions(exclusions);
MavenDependency[] mavenDependencies = new MavenDependency[dependencies.length];
for (int i = 0; i < dependencies.length; i++) {
mavenDependencies[i] = MavenDependencies.createDependency(
dependencies[i],
ScopeType.COMPILE,
false,
mavenExclusions);
}
return mavenDependencies;
}
示例11: addRuntimeSpecificLibraries
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
@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());
}
示例12: newMavenDependency
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
protected MavenDependency newMavenDependency(String gav) {
MavenCoordinate coordinate = MavenCoordinates.createCoordinate(gav.trim());
return MavenDependencies.createDependency(coordinate, ScopeType.COMPILE, false );
}
示例13: start
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
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();
PomEquippedResolveStage resolver = Maven.configureResolver()
.useLegacyLocalRepo(true).workOffline().loadPomFromFile("pom.xml");
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);
}
}
示例14: testWar
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; //导入依赖的package包/类
/**
* Server war without tests clases.
*
* @return create a war with src/main/resources, src/main/webapp and all compile, runtime and test dependencies
*/
public static Archive<?> testWar() {
return new Builder().scopes(ScopeType.COMPILE, ScopeType.RUNTIME, ScopeType.TEST).build();
}