Maven Ant Tasks
  1. Maven Ant Tasks
  2. MANTTASKS-174

Mirror declaration replaces url from distributionManagement

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 3.0.0-beta-1
    • Component/s: deploy task
    • Labels:
      None
    • Environment:
      Ant 1.7.1, Maven ant tasks 2.1.0
    • Number of attachments :
      0

      Description

      Given a ~/.m2/settings.xml file containing a mirror element

      <mirrors>
          <mirror>
            <id>nexus</id>
            <mirrorOf>external:*</mirrorOf>
            <url>https://xxx.com/nexus/content/groups/public</url>
          </mirror>
        </mirrors>
      

      a pom.xml file with a distributionManagement section

      	<distributionManagement>
      		<snapshotRepository>
      			<id>sonatype-nexus-snapshots</id>
      			<name>Sonatype Nexus Snapshots</name>
      			<url>http://oss.sonatype.org/content/repositories/snapshots</url>
      		</snapshotRepository>
      	</distributionManagement>
      

      and a build.xml file with the following deploy task:

      	<target name="deploy" depends="-check">
      		<artifact:pom id="gin-pom" file="pom.xml" />
      		<artifact:deploy file="${gin.jar.file}">
      			<pom refid="gin-pom" />
      			<attach file="${gin.javadoc.file}" classifier="javadoc" />
      		</artifact:deploy>
      	</target>
      

      When running ant deploy the deployment is done on xxx.com instead of oss.sonatype.org . Removing the mirror from the settings file solves the problem.

        Activity

        Hide
        Eric Quilantang added a comment -

        same behavior occurs when <remoterepository> is defined inside <artifact:deploy>. The <mirror> inside settings.xml replaces the url completely.

        Show
        Eric Quilantang added a comment - same behavior occurs when <remoterepository> is defined inside <artifact:deploy>. The <mirror> inside settings.xml replaces the url completely.
        Hide
        Eric Quilantang added a comment -

        When I remove the Mirror override clause in AbstractArtifactTask, the task works as expected for me.

        It's not clear to me why I would ever want my remote distribution to be overridden since my mirror usually points to my Nexus public group.

        code found in updateRepositoryWithSettings( RemoteRepository repository )

        Show
        Eric Quilantang added a comment - When I remove the Mirror override clause in AbstractArtifactTask, the task works as expected for me. It's not clear to me why I would ever want my remote distribution to be overridden since my mirror usually points to my Nexus public group. code found in updateRepositoryWithSettings( RemoteRepository repository )
        Hide
        Jonathan Kinred added a comment -

        This is a quite annoying problem especially as many people would be using Nexus/Artifactory and would therefore have a <mirror> section in settings.xml.

        Will you accept a patch for this?

        Show
        Jonathan Kinred added a comment - This is a quite annoying problem especially as many people would be using Nexus/Artifactory and would therefore have a <mirror> section in settings.xml. Will you accept a patch for this?
        Hide
        Cam Christiansen added a comment - - edited

        We tracked this down to be due to the asterisk ( * ). When a specific repository URL is used in the <mirrorOf> element, this will not happen and can be a temporary workaround. I also documented this here: http://stackoverflow.com/questions/13825701/maven-ant-tasks-deploying-to-public-nexus-repository-instead-of-the-url-specifie

        Show
        Cam Christiansen added a comment - - edited We tracked this down to be due to the asterisk ( * ). When a specific repository URL is used in the <mirrorOf> element, this will not happen and can be a temporary workaround. I also documented this here: http://stackoverflow.com/questions/13825701/maven-ant-tasks-deploying-to-public-nexus-repository-instead-of-the-url-specifie
        Hide
        Carlos Sanchez added a comment -

        Fixed in 2.1.4-SNAPSHOT

        Show
        Carlos Sanchez added a comment - Fixed in 2.1.4-SNAPSHOT

          People

          • Assignee:
            Carlos Sanchez
            Reporter:
            Robert Munteanu
          • Votes:
            6 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: