Search in sources :

Example 26 with ArtifactRepositoryPolicy

use of org.apache.maven.artifact.repository.ArtifactRepositoryPolicy 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 27 with ArtifactRepositoryPolicy

use of org.apache.maven.artifact.repository.ArtifactRepositoryPolicy 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)

Example 28 with ArtifactRepositoryPolicy

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

the class RoundtripMultiModuleIT 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

ArtifactRepositoryPolicy (org.apache.maven.artifact.repository.ArtifactRepositoryPolicy)28 MavenArtifactRepository (org.apache.maven.artifact.repository.MavenArtifactRepository)21 ArtifactRepository (org.apache.maven.artifact.repository.ArtifactRepository)18 DefaultRepositoryLayout (org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout)18 ArrayList (java.util.ArrayList)5 MojoFailureException (org.apache.maven.plugin.MojoFailureException)5 File (java.io.File)4 Artifact (org.apache.maven.artifact.Artifact)4 ArtifactRepositoryLayout (org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout)4 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)4 Mirror (org.apache.maven.settings.Mirror)3 Location (org.commonjava.maven.galley.model.Location)3 List (java.util.List)2 ArtifactFactory (org.apache.maven.artifact.factory.ArtifactFactory)2 DefaultArtifactRepository (org.apache.maven.artifact.repository.DefaultArtifactRepository)2 DefaultProjectBuildingRequest (org.apache.maven.project.DefaultProjectBuildingRequest)2 ProjectBuildingRequest (org.apache.maven.project.ProjectBuildingRequest)2 DefaultMirrorSelector (org.apache.maven.repository.DefaultMirrorSelector)2 Profile (org.apache.maven.settings.Profile)2 Repository (org.apache.maven.settings.Repository)2