DependencyManager { public void populateUberJarMavenRepository(Archive archive) throws Exception { for (ArtifactSpec dependency : this.dependencies) { if (!this.bootstrapDependencies.contains(dependency) && !this.moduleDependencies.contains(dependency)) { dependency.shouldGather = false; } if (includeAsBootstrapJar(dependency)) { dependency.shouldGather = true; } if (isExplodedBootstrap(dependency)) { dependency.shouldGather = false; } if (isProvidedDependency(dependency)) { dependency.shouldGather = false; } if (dependency.shouldGather) { addArtifactToArchiveMavenRepository(archive, dependency); } } for (ArtifactSpec dependency : this.moduleDependencies) { addArtifactToArchiveMavenRepository(archive, dependency); } for (ArtifactSpec dependency : this.bootstrapDependencies) { if (!isExplodedBootstrap(dependency)) { addArtifactToArchiveMavenRepository(archive, dependency); } } } DependencyManager(); void setArtifactResolvingHelper(ArtifactResolvingHelper resolver); void addDependency(ArtifactSpec dep); Set<ArtifactSpec> getNonSwarmDependencies(); void addAdditionalModule(Path module); boolean includeAsBootstrapJar(ArtifactSpec dependency); boolean isExplodedBootstrap(ArtifactSpec dependency); boolean isProvidedDependency(ArtifactSpec dependency); ArtifactSpec findWildFlySwarmBootstrapJar(); ArtifactSpec findJBossModulesJar(); ArtifactSpec findArtifact(String groupId, String artifactId, String version, String packaging, String classifier); void populateUberJarMavenRepository(Archive archive); void populateUserMavenRepository(); void addArtifactToArchiveMavenRepository(Archive archive, ArtifactSpec artifact); static final String WILDFLY_SWARM_GROUP_ID; static final String WILDFLY_SWARM_BOOTSTRAP_ARTIFACT_ID; static final String JBOSS_MODULES_GROUP_ID; static final String JBOSS_MODULES_ARTIFACT_ID; }
@Test public void populateUberJarMavenRepository() throws Exception { manager.addDependency(BOOTSTRAP_JAR); manager.addDependency(BOOTSTRAP_CONF); manager.addDependency(MODULES_EMPTY_A); manager.addDependency(MODULES_A); manager.analyzeDependencies(false); Archive archive = ShrinkWrap.create(JavaArchive.class); manager.populateUberJarMavenRepository(archive); Map<ArchivePath, Node> content = archive.getContent(); List<String> jars = content.keySet().stream().map(ArchivePath::get).filter((e) -> e.endsWith(".jar")).collect(Collectors.toList()); assertThat(jars).hasSize(5); assertThat(jars).contains("/m2repo/" + MODULES_EMPTY_A.repoPath(true)); assertThat(jars).contains("/m2repo/" + BOOTSTRAP_CONF.repoPath(true)); assertThat(jars).contains("/m2repo/" + MODULES_A.repoPath(true)); assertThat(jars).contains("/m2repo/" + CXF.repoPath(true)); assertThat(jars).contains("/m2repo/" + WS_INTEGRATION.repoPath(true)); }