use of org.wildfly.swarm.bootstrap.env.WildFlySwarmManifest in project wildfly-swarm by wildfly-swarm.
the class DependencyManagerTest method testAutodetectedSwarmJar.
@Test
public void testAutodetectedSwarmJar() throws Exception {
// Explicitly asked-for dependencies are also the full resolved tree
DeclaredDependencies declaredDependencies = new DeclaredDependencies();
declaredDependencies.add(JAXRS_SPEC, SERVLET_SPEC);
declaredDependencies.add(COMMON_DEP);
declaredDependencies.add(JAXRS_FRACTION, JAXRS_SPEC);
declaredDependencies.add(JAXRS_FRACTION, COMMON_DEP);
declaredDependencies.add(JAXRS_FRACTION, UNDERTOW_FRACTION);
declaredDependencies.add(JAXRS_SPEC, SERVLET_SPEC);
manager.analyzeDependencies(true, declaredDependencies);
assertThat(manager.getRemovableDependencies()).containsOnly(JAXRS_FRACTION, UNDERTOW_FRACTION);
assertThat(manager.getDependencies()).containsOnly(JAXRS_FRACTION, UNDERTOW_FRACTION, JAXRS_SPEC, SERVLET_SPEC, COMMON_DEP);
WildFlySwarmManifest manifest = manager.getWildFlySwarmManifest();
assertThat(manifest.bootstrapArtifacts()).containsOnly(JAXRS_FRACTION.mavenGav(), UNDERTOW_FRACTION.mavenGav());
assertThat(manifest.bootstrapModules()).containsOnly("org.wildfly.swarm.jaxrs", "org.wildfly.swarm.undertow");
// still includes the jaxrs-spec because it was explicit and we just can't know
assertThat(manifest.getDependencies()).containsOnly(SERVLET_SPEC.mavenGav(), JAXRS_SPEC.mavenGav(), COMMON_DEP.mavenGav());
}
use of org.wildfly.swarm.bootstrap.env.WildFlySwarmManifest in project wildfly-swarm by wildfly-swarm.
the class DependencyManagerTest method testWithSwarmJarBeingOnlyUserOfDep.
@Test
public void testWithSwarmJarBeingOnlyUserOfDep() throws Exception {
// Only :jaxrs is the explicit resolved tree, but brings in jaxrs-spec and common dep
DeclaredDependencies declaredDependencies = new DeclaredDependencies();
declaredDependencies.add(JAXRS_FRACTION, JAXRS_SPEC);
declaredDependencies.add(JAXRS_FRACTION, COMMON_DEP);
declaredDependencies.add(JAXRS_FRACTION, UNDERTOW_FRACTION);
declaredDependencies.add(JAXRS_FRACTION, SERVLET_SPEC);
manager.analyzeDependencies(false, declaredDependencies);
assertThat(manager.getRemovableDependencies()).containsOnly(JAXRS_FRACTION, JAXRS_SPEC, UNDERTOW_FRACTION, SERVLET_SPEC, COMMON_DEP);
assertThat(manager.getDependencies()).containsOnly(JAXRS_FRACTION, JAXRS_SPEC, UNDERTOW_FRACTION, SERVLET_SPEC, COMMON_DEP);
WildFlySwarmManifest manifest = manager.getWildFlySwarmManifest();
assertThat(manifest.bootstrapArtifacts()).containsOnly(JAXRS_FRACTION.mavenGav(), UNDERTOW_FRACTION.mavenGav());
assertThat(manifest.bootstrapModules()).containsOnly("org.wildfly.swarm.jaxrs", "org.wildfly.swarm.undertow");
assertThat(manifest.getDependencies()).isEmpty();
}
use of org.wildfly.swarm.bootstrap.env.WildFlySwarmManifest in project wildfly-swarm by wildfly-swarm.
the class DependencyManagerTest method testAutodetectedSwarmJarNoExplicitCommon.
@Test
public void testAutodetectedSwarmJarNoExplicitCommon() throws Exception {
// Explicitly asked-for dependencies are also the full resolved tree
DeclaredDependencies declaredDependencies = new DeclaredDependencies();
declaredDependencies.add(JAXRS_SPEC, SERVLET_SPEC);
declaredDependencies.add(JAXRS_FRACTION, JAXRS_SPEC);
declaredDependencies.add(JAXRS_FRACTION, COMMON_DEP);
declaredDependencies.add(JAXRS_FRACTION, UNDERTOW_FRACTION);
declaredDependencies.add(JAXRS_SPEC, SERVLET_SPEC);
manager.analyzeDependencies(true, declaredDependencies);
assertThat(manager.getRemovableDependencies()).containsOnly(JAXRS_FRACTION, UNDERTOW_FRACTION, COMMON_DEP);
assertThat(manager.getDependencies()).containsOnly(JAXRS_FRACTION, UNDERTOW_FRACTION, SERVLET_SPEC, JAXRS_SPEC, COMMON_DEP);
WildFlySwarmManifest manifest = manager.getWildFlySwarmManifest();
assertThat(manifest.bootstrapArtifacts()).containsOnly(JAXRS_FRACTION.mavenGav(), UNDERTOW_FRACTION.mavenGav());
assertThat(manifest.bootstrapModules()).containsOnly("org.wildfly.swarm.jaxrs", "org.wildfly.swarm.undertow");
// still includes the jaxrs-spec because it was explicit and we just can't know
assertThat(manifest.getDependencies()).containsOnly(JAXRS_SPEC.mavenGav(), SERVLET_SPEC.mavenGav());
}
use of org.wildfly.swarm.bootstrap.env.WildFlySwarmManifest in project wildfly-swarm by wildfly-swarm.
the class DependencyManagerTest method testNoSwarmJars.
@Test
public void testNoSwarmJars() throws Exception {
// Explicitly asked-for dependencies are also the full resolved tree
DeclaredDependencies declaredDependencies = new DeclaredDependencies();
declaredDependencies.add(JAXRS_SPEC, SERVLET_SPEC);
declaredDependencies.add(COMMON_DEP);
manager.analyzeDependencies(false, declaredDependencies);
assertThat(manager.getRemovableDependencies()).isEmpty();
assertThat(manager.getDependencies()).containsOnly(JAXRS_SPEC, SERVLET_SPEC, COMMON_DEP);
WildFlySwarmManifest manifest = manager.getWildFlySwarmManifest();
// these are empty because we have not actually done any auto-detection.
assertThat(manifest.bootstrapArtifacts()).isEmpty();
assertThat(manifest.bootstrapModules()).isEmpty();
assertThat(manifest.getDependencies()).containsOnly(SERVLET_SPEC.mavenGav(), JAXRS_SPEC.mavenGav(), COMMON_DEP.mavenGav());
}
use of org.wildfly.swarm.bootstrap.env.WildFlySwarmManifest in project wildfly-swarm by wildfly-swarm.
the class BuildTool method addWildFlySwarmApplicationManifest.
private void addWildFlySwarmApplicationManifest() {
WildFlySwarmManifest manifest = this.dependencyManager.getWildFlySwarmManifest();
this.properties.put("swarm.uberjar.build.user", System.getProperty("user.name"));
if (!this.hollow) {
this.properties.put(BootstrapProperties.APP_ARTIFACT, this.projectAsset.getSimpleName());
}
manifest.setProperties(this.properties);
manifest.bundleDependencies(this.bundleDependencies);
manifest.setMainClass(this.mainClass);
manifest.setHollow(this.hollow);
this.archive.add(new ByteArrayAsset(manifest.toString().getBytes(StandardCharsets.UTF_8)), WildFlySwarmManifest.CLASSPATH_LOCATION);
}
Aggregations