org.jboss.shrinkwrap.resolver.api.maven.repository.MavenRemoteRepository Java Examples

The following examples show how to use org.jboss.shrinkwrap.resolver.api.maven.repository.MavenRemoteRepository. 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: MicroOuterDeployer.java    From piranha with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private MavenRemoteRepository createRepo(String repoUrl) {
    MavenRemoteRepository repo = MavenRemoteRepositories.createRemoteRepository(
        UUID.randomUUID().toString(), repoUrl, "default");
    
    repo.setUpdatePolicy(UPDATE_POLICY_NEVER);
    
    return repo;
}
 
Example #2
Source File: ShrinkwrapArtifactResolvingHelper.java    From thorntail with Apache License 2.0 4 votes vote down vote up
public static ShrinkwrapArtifactResolvingHelper defaultInstance() {
    return INSTANCE.updateAndGet(e -> {
        if (e != null) {
            return e;
        }

        MavenRemoteRepository jbossPublic =
                MavenRemoteRepositories.createRemoteRepository("jboss-public-repository-group",
                                                               "https://repository.jboss.org/nexus/content/groups/public/",
                                                               MAVEN_LAYOUT_DEFAULT);
        jbossPublic.setChecksumPolicy(MavenChecksumPolicy.CHECKSUM_POLICY_IGNORE);
        jbossPublic.setUpdatePolicy(MavenUpdatePolicy.UPDATE_POLICY_NEVER);

        MavenRemoteRepository redhatGa =
                MavenRemoteRepositories.createRemoteRepository("redhat-ga",
                                                               "https://maven.repository.redhat.com/ga/",
                                                               MAVEN_LAYOUT_DEFAULT);
        redhatGa.setChecksumPolicy(MavenChecksumPolicy.CHECKSUM_POLICY_IGNORE);
        redhatGa.setUpdatePolicy(MavenUpdatePolicy.UPDATE_POLICY_NEVER);

        MavenRemoteRepository gradleTools =
                MavenRemoteRepositories.createRemoteRepository("gradle",
                                                               "https://repo.gradle.org/gradle/libs-releases-local",
                                                               MAVEN_LAYOUT_DEFAULT);
        gradleTools.setChecksumPolicy(MavenChecksumPolicy.CHECKSUM_POLICY_IGNORE);
        gradleTools.setUpdatePolicy(MavenUpdatePolicy.UPDATE_POLICY_NEVER);

        Boolean offline = Boolean.valueOf(System.getProperty("thorntail.resolver.offline", "false"));
        final ConfigurableMavenResolverSystem resolver = Maven.configureResolver()
                .withMavenCentralRepo(true)
                .withRemoteRepo(jbossPublic)
                .withRemoteRepo(redhatGa)
                .withRemoteRepo(gradleTools)
                .workOffline(offline);

        final String additionalRepos = System.getProperty(SwarmInternalProperties.BUILD_REPOS);
        if (additionalRepos != null) {
            Arrays.asList(additionalRepos.split(","))
                    .forEach(r -> {
                        MavenRemoteRepository repo =
                                MavenRemoteRepositories.createRemoteRepository(r, r, MAVEN_LAYOUT_DEFAULT);
                        repo.setChecksumPolicy(MavenChecksumPolicy.CHECKSUM_POLICY_IGNORE);
                        repo.setUpdatePolicy(MavenUpdatePolicy.UPDATE_POLICY_NEVER);
                        resolver.withRemoteRepo(repo);
                    });
        }


        ShrinkwrapArtifactResolvingHelper helper = new ShrinkwrapArtifactResolvingHelper(resolver);
        helper.session().setCache(new SimpleRepositoryCache());
        helper.session().setUpdatePolicy(RepositoryPolicy.UPDATE_POLICY_DAILY);
        helper.session().setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_IGNORE);

        return helper;
    });
}
 
Example #3
Source File: Build.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 4 votes vote down vote up
public File run() throws Exception {
    final String[] parts = this.source.getName().split("\\.(?=[^\\.]+$)");
    final String baseName = parts[0];
    final String type = parts[1] == null ? "jar" : parts[1];
    final MavenRemoteRepository jbossPublic =
            MavenRemoteRepositories.createRemoteRepository("jboss-public-repository-group",
                    "http://repository.jboss.org/nexus/content/groups/public/",
                    "default");
    jbossPublic.setChecksumPolicy(MavenChecksumPolicy.CHECKSUM_POLICY_IGNORE);
    jbossPublic.setUpdatePolicy(MavenUpdatePolicy.UPDATE_POLICY_NEVER);

    final ConfigurableMavenResolverSystem resolver = Maven.configureResolver()
            .withMavenCentralRepo(true)
            .withRemoteRepo(jbossPublic);

    final BuildTool tool = new BuildTool()
            .artifactResolvingHelper(new ShrinkwrapArtifactResolvingHelper(resolver))
            .projectArtifact("", baseName, "", type, this.source)
            .resolveTransitiveDependencies(true)
            .properties(this.properties);

    if (this.autoDetectFractions) {
        this.swarmDependencies.addAll(new PackageAnalyzer(this.source).detectNeededFractions());
    } else {
        System.err.println("Skipping fraction auto-detection");
    }

    for (String dep : this.swarmDependencies) {
        tool.dependency("compile", "org.wildfly.swarm", dep, this.version, "jar", null, null, true);
    }

    final String jarName = this.name != null ? this.name : baseName;
    final String outDir = this.outputDir.getCanonicalPath();
    System.err.println(String.format("Building %s/%s-swarm.jar with fractions: %s",
            outDir,
            jarName,
            String.join(", ",
                    allRequiredFractions()
                            .stream()
                            .sorted()
                            .collect(Collectors.toList()))));

    return tool.build(jarName, Paths.get(outDir));
}