public ArtifactRepository getDistributionManagementArtifactRepository() { return wrapped.getDistributionManagementArtifactRepository(); }
public ArtifactRepository getDistributionManagementArtifactRepository() { return getDelegate().getDistributionManagementArtifactRepository(); }
/** * Returns the ArtifactRepository created from passed in maven session's current project's distribution management. */ protected ArtifactRepository getDeploymentRepository(final MavenSession mavenSession) throws MojoExecutionException { final ArtifactRepository repo = mavenSession.getCurrentProject().getDistributionManagementArtifactRepository(); if (repo == null) { String msg = "Deployment failed: repository element was not specified in the POM inside" + " distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter"; throw new MojoExecutionException(msg); } return repo; }
public RemoteRepository remoteRepository(MavenProject project) throws MojoExecutionException { if (altDeploymentRepository != null) { Matcher matcher = Pattern.compile("(.+)::(.+)::(.+)").matcher(altDeploymentRepository); if (!matcher.matches()) { throw new MojoExecutionException(altDeploymentRepository, "Invalid syntax for repository.", "Invalid syntax for alternative repository. Use \"id::layout::url\"."); } String id = matcher.group(1).trim(); String layout = matcher.group(2).trim(); String url = matcher.group(3).trim(); RemoteRepository.Builder builder = new RemoteRepository.Builder(id, layout, url); return builder.build(); } return AetherUtils.toRepo(project.getDistributionManagementArtifactRepository()); } }
public RemoteRepository remoteRepository(MavenProject project) throws MojoExecutionException { if (altDeploymentRepository != null) { Matcher matcher = Pattern.compile("(.+)::(.+)::(.+)").matcher(altDeploymentRepository); if (!matcher.matches()) { throw new MojoExecutionException(altDeploymentRepository, "Invalid syntax for repository.", "Invalid syntax for alternative repository. Use \"id::layout::url\"."); } String id = matcher.group(1).trim(); String layout = matcher.group(2).trim(); String url = matcher.group(3).trim(); RemoteRepository.Builder builder = new RemoteRepository.Builder(id, layout, url); return builder.build(); } return AetherUtils.toRepo(project.getDistributionManagementArtifactRepository()); } }
private Map<MavenRepositorySource, Collection<RemoteRepository>> getRemoteRepositories(final MavenProject mavenProject) { //Get Local and Settings.xml Repositories final Map<MavenRepositorySource, Collection<RemoteRepository>> repositories = new HashMap<MavenRepositorySource, Collection<RemoteRepository>>(); repositories.putAll(getRemoteRepositories()); //Project's Repositories, includes those in setting.xml final Collection<RemoteRepository> projectRepositories = new HashSet<RemoteRepository>(mavenProject.getRemoteProjectRepositories()); if (projectRepositories != null) { //Remove Project Repositories that are in settings.xml final Collection<RemoteRepository> settingsRepositories = repositories.get(MavenRepositorySource.SETTINGS); removeProjectRepositoriesThatAreInSettings(projectRepositories, settingsRepositories); repositories.put(MavenRepositorySource.PROJECT, projectRepositories); } //Project's <distributionManagement> Repositories final org.apache.maven.artifact.repository.ArtifactRepository distributionManagementRepository = mavenProject.getDistributionManagementArtifactRepository(); if (distributionManagementRepository != null) { repositories.put(MavenRepositorySource.DISTRIBUTION_MANAGEMENT, new HashSet<RemoteRepository>() {{ add(convertToArtifactRepository(distributionManagementRepository)); }}); } return repositories; }
private Map<MavenRepositorySource, Collection<RemoteRepository>> getRemoteRepositories(final MavenProject mavenProject) { //Get Local and Settings.xml Repositories final Map<MavenRepositorySource, Collection<RemoteRepository>> repositories = new HashMap<MavenRepositorySource, Collection<RemoteRepository>>(); repositories.putAll(getRemoteRepositories()); //Project's Repositories, includes those in setting.xml final Collection<RemoteRepository> projectRepositories = new HashSet<RemoteRepository>(mavenProject.getRemoteProjectRepositories()); if (projectRepositories != null) { //Remove Project Repositories that are in settings.xml final Collection<RemoteRepository> settingsRepositories = repositories.get(MavenRepositorySource.SETTINGS); removeProjectRepositoriesThatAreInSettings(projectRepositories, settingsRepositories); repositories.put(MavenRepositorySource.PROJECT, projectRepositories); } //Project's <distributionManagement> Repositories final org.apache.maven.artifact.repository.ArtifactRepository distributionManagementRepository = mavenProject.getDistributionManagementArtifactRepository(); if (distributionManagementRepository != null) { repositories.put(MavenRepositorySource.DISTRIBUTION_MANAGEMENT, new HashSet<RemoteRepository>() {{ add(convertToArtifactRepository(distributionManagementRepository)); }}); } return repositories; }
private Map<MavenRepositorySource, Collection<RemoteRepository>> getRemoteRepositories(final MavenProject mavenProject) { //Get Local and Settings.xml Repositories final Map<MavenRepositorySource, Collection<RemoteRepository>> repositories = new HashMap<MavenRepositorySource, Collection<RemoteRepository>>(); repositories.putAll(getRemoteRepositories()); //Project's Repositories, includes those in setting.xml final Collection<RemoteRepository> projectRepositories = new HashSet<RemoteRepository>(mavenProject.getRemoteProjectRepositories()); if (projectRepositories != null) { //Remove Project Repositories that are in settings.xml final Collection<RemoteRepository> settingsRepositories = repositories.get(MavenRepositorySource.SETTINGS); removeProjectRepositoriesThatAreInSettings(projectRepositories, settingsRepositories); repositories.put(MavenRepositorySource.PROJECT, projectRepositories); } //Project's <distributionManagement> Repositories final org.apache.maven.artifact.repository.ArtifactRepository distributionManagementRepository = mavenProject.getDistributionManagementArtifactRepository(); if (distributionManagementRepository != null) { repositories.put(MavenRepositorySource.DISTRIBUTION_MANAGEMENT, new HashSet<RemoteRepository>() {{ add(convertToArtifactRepository(distributionManagementRepository)); }}); } return repositories; }
pom.getGroupId(), pom.getArtifactId(), pom.getVersion(), null, "pom", pom.getFile().getName(), Util.getDigestOf(pom.getFile())); final String repositoryUrl = pom.getDistributionManagementArtifactRepository() == null ? null : Util.fixEmptyAndTrim(pom.getDistributionManagementArtifactRepository().getUrl()); final String repositoryId = pom.getDistributionManagementArtifactRepository() == null ? null : Util.fixEmptyAndTrim(pom.getDistributionManagementArtifactRepository().getId());
@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()); } } }
@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()); } } }
@Override protected void addDetails(@Nonnull ExecutionEvent executionEvent, @Nonnull Xpp3Dom root) { super.addDetails(executionEvent, root); ArtifactRepository artifactRepository = executionEvent.getProject().getDistributionManagementArtifactRepository(); Xpp3Dom artifactRepositoryElt = new Xpp3Dom("artifactRepository"); root.addChild(artifactRepositoryElt); if (artifactRepository == null) { } else { Xpp3Dom idElt = new Xpp3Dom("id"); idElt.setValue(artifactRepository.getId()); artifactRepositoryElt.addChild(idElt); Xpp3Dom urlElt = new Xpp3Dom("url"); urlElt.setValue(artifactRepository.getUrl()); artifactRepositoryElt.addChild(urlElt); } }