use of org.apache.maven.artifact.repository.ArtifactRepository in project unleash-maven-plugin by shillner.
the class ReleaseMetadata method init.
@PostConstruct
public void init() {
// setting the artifact version to a release version temporarily since the dist repository checks for a snapshot
// version of the artifact. Maybe this can be implemented in a different manner but then we would have to setup the
// repository manually
org.apache.maven.artifact.Artifact projectArtifact = this.project.getArtifact();
String oldVersion = projectArtifact.getVersion();
projectArtifact.setVersion("1");
// replace properties in remote repository URL and getting the remote repo
ArtifactRepository artifactRepository = this.project.getDistributionManagementArtifactRepository();
if (artifactRepository != null) {
PomPropertyResolver propertyResolver = new PomPropertyResolver(this.project, this.settings, this.profiles, this.releaseArgs);
artifactRepository.setUrl(propertyResolver.expandPropertyReferences(artifactRepository.getUrl()));
this.deploymentRepository = RepositoryUtils.toRepo(artifactRepository);
}
// resetting the artifact version
projectArtifact.setVersion(oldVersion);
for (MavenProject p : this.reactorProjects) {
// puts the initial module artifact coordinates into the cache
addArtifactCoordinates(ProjectToCoordinates.POM.apply(p), ReleasePhase.PRE_RELEASE);
// caching of SCM settings of every POM in order to go back to it before setting next dev version
this.cachedScmSettings.put(ProjectToCoordinates.EMPTY_VERSION.apply(p), p.getModel().getScm());
Optional<Document> parsedPOM = PomUtil.parsePOM(p);
if (parsedPOM.isPresent()) {
this.originalPOMs.put(ProjectToCoordinates.EMPTY_VERSION.apply(p), parsedPOM.get());
}
}
}
use of org.apache.maven.artifact.repository.ArtifactRepository in project tycho by eclipse.
the class JdkLibraryInfoProvider method getLibDetectorJar.
protected File getLibDetectorJar() {
if (libDetectorJar != null) {
return libDetectorJar;
}
Artifact libDetectorArtifact = repositorySystem.createArtifact("org.eclipse.tycho", "tycho-lib-detector", TychoVersion.getTychoVersion(), "jar");
ArtifactRepository localRepository = legacySupport.getSession().getLocalRepository();
return libDetectorJar = new File(localRepository.getBasedir(), localRepository.pathOf(libDetectorArtifact));
}
use of org.apache.maven.artifact.repository.ArtifactRepository in project tycho by eclipse.
the class AbstractTychoMojoTestCase method getLocalRepository.
protected ArtifactRepository getLocalRepository() throws Exception {
RepositorySystem repoSystem = lookup(RepositorySystem.class);
File path = new File("target/local-repo").getAbsoluteFile();
ArtifactRepository r = repoSystem.createLocalRepository(path);
return r;
}
use of org.apache.maven.artifact.repository.ArtifactRepository in project tycho by eclipse.
the class P2DependencyResolver method computePreliminaryTargetPlatform.
@Override
public TargetPlatform computePreliminaryTargetPlatform(MavenSession session, MavenProject project, List<ReactorProject> reactorProjects) {
TargetPlatformConfiguration configuration = TychoProjectUtils.getTargetPlatformConfiguration(project);
ExecutionEnvironmentConfiguration ee = TychoProjectUtils.getExecutionEnvironmentConfiguration(project);
TargetPlatformConfigurationStub tpConfiguration = new TargetPlatformConfigurationStub();
tpConfiguration.setIncludePackedArtifacts(configuration.isIncludePackedArtifacts());
PomDependencyCollector pomDependencies = null;
if (TargetPlatformConfiguration.POM_DEPENDENCIES_CONSIDER.equals(configuration.getPomDependencies())) {
pomDependencies = collectPomDependencies(project, reactorProjects, session);
} else {
// TODO 412416 remove this when the setProjectLocation is no longer needed
pomDependencies = resolverFactory.newPomDependencyCollector();
pomDependencies.setProjectLocation(project.getBasedir());
}
for (ArtifactRepository repository : project.getRemoteArtifactRepositories()) {
addEntireP2RepositoryToTargetPlatform(repository, tpConfiguration);
}
tpConfiguration.setEnvironments(configuration.getEnvironments());
for (File file : configuration.getTargets()) {
addTargetFileContentToTargetPlatform(file, configuration.getTargetDefinitionIncludeSourceMode(), tpConfiguration);
}
tpConfiguration.addFilters(configuration.getFilters());
return reactorRepositoryManager.computePreliminaryTargetPlatform(DefaultReactorProject.adapt(project), tpConfiguration, ee, reactorProjects, pomDependencies);
}
use of org.apache.maven.artifact.repository.ArtifactRepository in project wildfly-swarm by wildfly-swarm.
the class MavenArtifactResolvingHelperTest method propagateRepositoryPolicies.
@Test
public // SWARM-1173: swarm-plugin trying to download SNAPSHOTs from Maven Central
void propagateRepositoryPolicies() {
RepositorySystemSession sessionMock = Mockito.mock(RepositorySystemSession.class);
MirrorSelector mirrorSelectorMock = Mockito.mock(MirrorSelector.class);
Mockito.when(sessionMock.getMirrorSelector()).thenReturn(mirrorSelectorMock);
ProxySelector proxySelectorMock = Mockito.mock(ProxySelector.class);
Mockito.when(sessionMock.getProxySelector()).thenReturn(proxySelectorMock);
MavenArtifactResolvingHelper artifactResolverHelper = new MavenArtifactResolvingHelper(null, null, sessionMock, null);
ArtifactRepositoryPolicy testSnapshotPolicy = new ArtifactRepositoryPolicy(false, "hourly", "warn");
ArtifactRepositoryPolicy testReleasesPolicy = new ArtifactRepositoryPolicy(true, "never", "warn");
ArtifactRepository testingRepo = new MavenArtifactRepository("testing-repo", "http://testing-repo.org", new DefaultRepositoryLayout(), testSnapshotPolicy, testReleasesPolicy);
artifactResolverHelper.remoteRepository(testingRepo);
List<RemoteRepository> remoteRepos = artifactResolverHelper.getRemoteRepositories();
Assert.assertTrue("Remote repositories " + remoteRepos + " do not contain expected testing repo " + testingRepo, remoteRepos.stream().anyMatch(remoteRepo -> {
RepositoryPolicy snapshotsPolicy = remoteRepo.getPolicy(true);
RepositoryPolicy releasesPolicy = remoteRepo.getPolicy(false);
return remoteRepo.getId().equals(testingRepo.getId()) && !snapshotsPolicy.isEnabled() && snapshotsPolicy.getUpdatePolicy().equals(testSnapshotPolicy.getUpdatePolicy()) && snapshotsPolicy.getChecksumPolicy().equals(testSnapshotPolicy.getChecksumPolicy()) && releasesPolicy.isEnabled() && releasesPolicy.getUpdatePolicy().equals(testReleasesPolicy.getUpdatePolicy()) && releasesPolicy.getChecksumPolicy().equals(testReleasesPolicy.getChecksumPolicy());
}));
}
Aggregations