Search in sources :

Example 21 with MavenArtifactRepository

use of org.apache.maven.artifact.repository.MavenArtifactRepository in project maven-archetype by apache.

the class DefaultArchetypeGenerationConfigurator method createRepository.

private ArtifactRepository createRepository(String url, String repositoryId) {
    // snapshots vs releases
    // offline = to turning the update policy off
    // TODO: we'll need to allow finer grained creation of repositories but this will do for now
    String updatePolicyFlag = ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS;
    String checksumPolicyFlag = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
    ArtifactRepositoryPolicy snapshotsPolicy = new ArtifactRepositoryPolicy(true, updatePolicyFlag, checksumPolicyFlag);
    ArtifactRepositoryPolicy releasesPolicy = new ArtifactRepositoryPolicy(true, updatePolicyFlag, checksumPolicyFlag);
    return new MavenArtifactRepository(repositoryId, url, defaultArtifactRepositoryLayout, snapshotsPolicy, releasesPolicy);
}
Also used : ArtifactRepositoryPolicy(org.apache.maven.artifact.repository.ArtifactRepositoryPolicy) MavenArtifactRepository(org.apache.maven.artifact.repository.MavenArtifactRepository)

Example 22 with MavenArtifactRepository

use of org.apache.maven.artifact.repository.MavenArtifactRepository in project maven-archetype by apache.

the class RemoteCatalogArchetypeDataSourceTest method testRemoteCatalog.

public void testRemoteCatalog() throws Exception {
    ArchetypeManager archetype = lookup(ArchetypeManager.class);
    LegacySupport legacySupport = lookup(LegacySupport.class);
    legacySupport.setSession(newMavenSession(new MavenProjectStub()));
    ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
    buildingRequest.getRemoteRepositories().add(new MavenArtifactRepository("central", "http://localhost:" + port + "/repo/", new DefaultRepositoryLayout(), null, null));
    ArchetypeCatalog result = archetype.getRemoteCatalog(buildingRequest);
    assertEquals(1, result.getArchetypes().size());
    assertEquals("groupId", result.getArchetypes().get(0).getGroupId());
    assertEquals("artifactId", result.getArchetypes().get(0).getArtifactId());
    assertEquals("1", result.getArchetypes().get(0).getVersion());
    assertEquals("http://localhost:" + port + "/repo/", result.getArchetypes().get(0).getRepository());
}
Also used : ArchetypeManager(org.apache.maven.archetype.ArchetypeManager) ProjectBuildingRequest(org.apache.maven.project.ProjectBuildingRequest) DefaultProjectBuildingRequest(org.apache.maven.project.DefaultProjectBuildingRequest) LegacySupport(org.apache.maven.plugin.LegacySupport) MavenProjectStub(org.apache.maven.plugin.testing.stubs.MavenProjectStub) DefaultRepositoryLayout(org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout) MavenArtifactRepository(org.apache.maven.artifact.repository.MavenArtifactRepository) ArchetypeCatalog(org.apache.maven.archetype.catalog.ArchetypeCatalog) DefaultProjectBuildingRequest(org.apache.maven.project.DefaultProjectBuildingRequest)

Example 23 with MavenArtifactRepository

use of org.apache.maven.artifact.repository.MavenArtifactRepository in project maven-archetype by apache.

the class ArchetyperRoundtripIT method createRepository.

private ArtifactRepository createRepository(String url, String repositoryId) {
    String updatePolicyFlag = ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS;
    String checksumPolicyFlag = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
    ArtifactRepositoryPolicy snapshotsPolicy = new ArtifactRepositoryPolicy(true, updatePolicyFlag, checksumPolicyFlag);
    ArtifactRepositoryPolicy releasesPolicy = new ArtifactRepositoryPolicy(true, updatePolicyFlag, checksumPolicyFlag);
    return new MavenArtifactRepository(repositoryId, url, new DefaultRepositoryLayout(), snapshotsPolicy, releasesPolicy);
}
Also used : ArtifactRepositoryPolicy(org.apache.maven.artifact.repository.ArtifactRepositoryPolicy) DefaultRepositoryLayout(org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout) MavenArtifactRepository(org.apache.maven.artifact.repository.MavenArtifactRepository)

Example 24 with MavenArtifactRepository

use of org.apache.maven.artifact.repository.MavenArtifactRepository in project maven-archetype by apache.

the class DefaultArchetypeGenerator method createRepository.

private ArtifactRepository createRepository(String url, String repositoryId) {
    // snapshots vs releases
    // offline = to turning the update policy off
    // TODO: we'll need to allow finer grained creation of repositories but this will do for now
    String updatePolicyFlag = ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS;
    String checksumPolicyFlag = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
    ArtifactRepositoryPolicy snapshotsPolicy = new ArtifactRepositoryPolicy(true, updatePolicyFlag, checksumPolicyFlag);
    ArtifactRepositoryPolicy releasesPolicy = new ArtifactRepositoryPolicy(true, updatePolicyFlag, checksumPolicyFlag);
    return new MavenArtifactRepository(repositoryId, url, defaultArtifactRepositoryLayout, snapshotsPolicy, releasesPolicy);
}
Also used : ArtifactRepositoryPolicy(org.apache.maven.artifact.repository.ArtifactRepositoryPolicy) MavenArtifactRepository(org.apache.maven.artifact.repository.MavenArtifactRepository)

Example 25 with MavenArtifactRepository

use of org.apache.maven.artifact.repository.MavenArtifactRepository in project maven-archetype by apache.

the class ArchetypeGenerationTest method createRepository.

private ArtifactRepository createRepository(String url, String repositoryId) {
    String updatePolicyFlag = ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS;
    String checksumPolicyFlag = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
    ArtifactRepositoryPolicy snapshotsPolicy = new ArtifactRepositoryPolicy(true, updatePolicyFlag, checksumPolicyFlag);
    ArtifactRepositoryPolicy releasesPolicy = new ArtifactRepositoryPolicy(true, updatePolicyFlag, checksumPolicyFlag);
    return new MavenArtifactRepository(repositoryId, url, new DefaultRepositoryLayout(), snapshotsPolicy, releasesPolicy);
}
Also used : ArtifactRepositoryPolicy(org.apache.maven.artifact.repository.ArtifactRepositoryPolicy) DefaultRepositoryLayout(org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout) MavenArtifactRepository(org.apache.maven.artifact.repository.MavenArtifactRepository)

Aggregations

MavenArtifactRepository (org.apache.maven.artifact.repository.MavenArtifactRepository)26 ArtifactRepositoryPolicy (org.apache.maven.artifact.repository.ArtifactRepositoryPolicy)18 DefaultRepositoryLayout (org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout)17 ArtifactRepository (org.apache.maven.artifact.repository.ArtifactRepository)14 File (java.io.File)6 ArtifactRepositoryLayout (org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout)6 MavenSession (org.apache.maven.execution.MavenSession)4 Settings (org.apache.maven.settings.Settings)4 Location (org.commonjava.maven.galley.model.Location)3 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 Artifact (org.apache.maven.artifact.Artifact)2 ArtifactFactory (org.apache.maven.artifact.factory.ArtifactFactory)2 DefaultMavenExecutionRequest (org.apache.maven.execution.DefaultMavenExecutionRequest)2 DefaultMavenExecutionResult (org.apache.maven.execution.DefaultMavenExecutionResult)2 MavenExecutionRequest (org.apache.maven.execution.MavenExecutionRequest)2 MojoFailureException (org.apache.maven.plugin.MojoFailureException)2 DefaultMirrorSelector (org.apache.maven.repository.DefaultMirrorSelector)2 Mirror (org.apache.maven.settings.Mirror)2 Profile (org.apache.maven.settings.Profile)2