Search in sources :

Example 6 with ArtifactRepositoryFactory

use of org.apache.maven.artifact.repository.ArtifactRepositoryFactory in project intellij-community by JetBrains.

the class MavenEmbedder method createLocalRepository.

private ArtifactRepository createLocalRepository(MavenEmbedderSettings generalSettings) {
    ArtifactRepositoryLayout layout = getComponent(ArtifactRepositoryLayout.class, "default");
    ArtifactRepositoryFactory factory = getComponent(ArtifactRepositoryFactory.class);
    String url = mySettings.getLocalRepository();
    if (!url.startsWith("file:"))
        url = "file://" + url;
    ArtifactRepository localRepository = new DefaultArtifactRepository("local", url, layout);
    boolean snapshotPolicySet = mySettings.isOffline();
    if (!snapshotPolicySet && generalSettings.getSnapshotUpdatePolicy() == MavenEmbedderSettings.UpdatePolicy.ALWAYS_UPDATE) {
        factory.setGlobalUpdatePolicy(ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS);
    }
    factory.setGlobalChecksumPolicy(ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN);
    return localRepository;
}
Also used : ArtifactRepositoryLayout(org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout) DefaultArtifactRepository(org.apache.maven.artifact.repository.DefaultArtifactRepository) ArtifactRepositoryFactory(org.apache.maven.artifact.repository.ArtifactRepositoryFactory) DefaultArtifactRepository(org.apache.maven.artifact.repository.DefaultArtifactRepository) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository)

Aggregations

ArtifactRepositoryFactory (org.apache.maven.artifact.repository.ArtifactRepositoryFactory)6 ArtifactRepository (org.apache.maven.artifact.repository.ArtifactRepository)5 InvalidRepositoryException (org.apache.maven.artifact.InvalidRepositoryException)4 DefaultArtifactRepository (org.apache.maven.artifact.repository.DefaultArtifactRepository)2 DefaultMavenExecutionRequest (org.apache.maven.execution.DefaultMavenExecutionRequest)2 MavenExecutionRequest (org.apache.maven.execution.MavenExecutionRequest)2 NotNull (org.jetbrains.annotations.NotNull)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 DefaultMaven (org.apache.maven.DefaultMaven)1 Maven (org.apache.maven.Maven)1 Artifact (org.apache.maven.artifact.Artifact)1 ArtifactFactory (org.apache.maven.artifact.factory.ArtifactFactory)1 ArtifactRepositoryLayout (org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout)1 SiteTool (org.apache.maven.doxia.tools.SiteTool)1 MavenSession (org.apache.maven.execution.MavenSession)1 AbstractMojo (org.apache.maven.plugin.AbstractMojo)1 HttpRequest (org.apache.maven.plugins.site.deploy.SimpleDavServerHandler.HttpRequest)1 SiteMavenProjectStub (org.apache.maven.plugins.site.stubs.SiteMavenProjectStub)1