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

antlib:deploy doesn't set correct snapshot version

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.4, 2.0.6, 2.0.7
    • Fix Version/s: 2.0.8
    • Component/s: deploy task
    • Labels:
      None
    • Environment:
      win xp, mvn 2.0.2, ant 1.6.5
    • Flags:
      Patch

      Description

      I'm trying to deploy to maven remote repository jars produced by
      ant. Those jars are in snapshot version.
      Whole deployment process is going properly, but something is wrong with names
      of deployed files.
      When I'm deploying artifacts using normal 'maven deploy', "SNAPSHOT" in
      the name is replaced by the current timestamp and the snapshot number (for
      instance: "20060105.123437-3").
      But when I'm deploying with antlib, the name isn't changed. "SNAPSHOT" is
      still in the name. And when I deploy snapshot again, the old one is
      replaced by the new one (which also different from behavior of normal 'mvn
      deploy').
      The metadata.xml also is generated incorrectly. Timestamp in snapshot tag is missing:
      <?xml version="1.0" encoding="UTF-8"?><metadata>
      <groupId>foo</groupId>
      <artifactId>foo-jar1</artifactId>
      <version>1.0-SNAPSHOT</version>
      <versioning>
      <snapshot>
      <buildNumber>4</buildNumber>
      </snapshot>
      <lastUpdated>20060209111228</lastUpdated>
      </versioning>
      </metadata>
      Here's an fragment of my ant script:
      <target name="maven-poms">
      <artifact:pom id="pom.jar1-jar" file="maven/pom-jar1-jar.xml" />
      <artifact:pom id="pom.jar2-jar" file="maven/pom-jar2-jar.xml" />
      <artifact:pom id="pom.jar3-jar" file="maven/pom-jar3--jar.xml" />
      </target>
      <target name="maven-install-local"
      depends="maven-poms,generate-jars">
      <artifact:install file="$

      {build.dir}/jar1.jar">
      <pom refid="pom.jar1-jar"/>
      </artifact:install>
      <artifact:install file="${build.dir}

      /jar2.jar">
      <pom refid="pom.jar2-jar"/>
      </artifact:install>
      <artifact:install file="$

      {build.dir}/jar3.jar">
      <pom refid="pom.jar3-jar"/>
      </artifact:install>
      </target>

      <target name="maven-deploy-remote" depends="maven-install-local">
      <artifact:install-provider artifactId="wagon-ssh" version="1.0-alpha-5"/>

      <artifact:deploy file="${build.dir}

      /jar1.jar">
      <pom refid="pom.jar1-jar"/>
      </artifact:deploy>
      <artifact:deploy file="$

      {build.dir}/jar2.jar">
      <pom refid="pom.jar2-jar"/>
      </artifact:deploy>
      <artifact:deploy file="${build.dir}

      /jar3.jar">
      <pom refid="pom.jar3-jar"/>
      </artifact:deploy>
      </target>
      The artifacts poms are in separate files which contain only artifactId, groupId,
      version, dependencies and remote repository url.
      I also tried to deploy using 'mvn -f pom-file.xml deploy' to check if my repository
      url is specified correctly. And it works. Jar is deployed to remote repository with
      correct version.

      1. maven-artifact-ant-MNG-2060.patch
        8 kB
        Lee, YongHyun
      2. MANTTASKS-23_site.diff
        3 kB
        Hervé Boutemy
      3. MANTTASKS-23.diff
        9 kB
        Hervé Boutemy

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          615d 14h 2m 1 Hervé Boutemy 18/Oct/07 17:28
          Mark Thomas made changes -
          Workflow jira [ 12953647 ] Default workflow, editable Closed status [ 12990767 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 22:08:22 UTC 2015 [ 1428271702400 ]
          Mark Thomas made changes -
          Flags Patch [ 10430 ]
          Patch Submitted Yes [ 10763 ]
          Mark Thomas made changes -
          Workflow jira [ 12716128 ] Default workflow, editable Closed status [ 12760089 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 09:00:58 UTC 2015 [ 1428224458201 ]
          Benjamin Bentmann made changes -
          Link This issue is duplicated by MNG-2269 [ MNG-2269 ]
          Hide
          Carlos Sanchez added a comment -

          if it is, it should be in http://maven.zones.apache.org/continuum
          if not you can request it being added in the maven-dev mailing list

          Show
          Carlos Sanchez added a comment - if it is, it should be in http://maven.zones.apache.org/continuum if not you can request it being added in the maven-dev mailing list
          Hide
          Ben Hale added a comment -

          Is this being built as CI somewhere? I'd love to test it out.

          Show
          Ben Hale added a comment - Is this being built as CI somewhere? I'd love to test it out.
          Hervé Boutemy made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Hide
          Hervé Boutemy added a comment -

          the updatedBuildNumber is fixed by MANTTASKS-67

          Show
          Hervé Boutemy added a comment - the updatedBuildNumber is fixed by MANTTASKS-67
          Hervé Boutemy made changes -
          Remaining Estimate 0h [ 0 ]
          Assignee Herve Boutemy [ hboutemy ]
          Original Estimate 0h [ 0 ]
          Description I'm trying to deploy to maven remote repository jars produced by
          ant. Those jars are in snapshot version.

          Whole deployment process is going properly, but something is wrong with names
          of deployed files.

          When I'm deploying artifacts using normal 'maven deploy', "SNAPSHOT" in
          the name is replaced by the current timestamp and the snapshot number (for
          instance: "20060105.123437-3").

          But when I'm deploying with antlib, the name isn't changed. "SNAPSHOT" is
          still in the name. And when I deploy snapshot again, the old one is
          replaced by the new one (which also different from behavior of normal 'mvn
          deploy').

          The metadata.xml also is generated incorrectly. Timestamp in snapshot tag is missing:
          <?xml version="1.0" encoding="UTF-8"?><metadata>
            <groupId>foo</groupId>
            <artifactId>foo-jar1</artifactId>
            <version>1.0-SNAPSHOT</version>
            <versioning>
              <snapshot>
                <buildNumber>4</buildNumber>

              </snapshot>
              <lastUpdated>20060209111228</lastUpdated>
            </versioning>
          </metadata>


          Here's an fragment of my ant script:

            <target name="maven-poms">
              <artifact:pom id="pom.jar1-jar" file="maven/pom-jar1-jar.xml" />
              <artifact:pom id="pom.jar2-jar" file="maven/pom-jar2-jar.xml" />
              <artifact:pom id="pom.jar3-jar" file="maven/pom-jar3--jar.xml" />
            </target>

            <target name="maven-install-local"
                 depends="maven-poms,generate-jars">
              <artifact:install file="${build.dir}/jar1.jar">
                <pom refid="pom.jar1-jar"/>
              </artifact:install>
              <artifact:install file="${build.dir}/jar2.jar">
                <pom refid="pom.jar2-jar"/>
              </artifact:install>
              <artifact:install file="${build.dir}/jar3.jar">
                <pom refid="pom.jar3-jar"/>
              </artifact:install>
            </target>

            <target name="maven-deploy-remote" depends="maven-install-local">
              <artifact:install-provider artifactId="wagon-ssh" version="1.0-alpha-5"/>
           
              <artifact:deploy file="${build.dir}/jar1.jar">
                <pom refid="pom.jar1-jar"/>
              </artifact:deploy>
              <artifact:deploy file="${build.dir}/jar2.jar">
                <pom refid="pom.jar2-jar"/>
              </artifact:deploy>
              <artifact:deploy file="${build.dir}/jar3.jar">
                <pom refid="pom.jar3-jar"/>
              </artifact:deploy>
            </target>



          The artifacts poms are in separate files which contain only artifactId, groupId,
          version, dependencies and remote repository url.

          I also tried to deploy using 'mvn -f pom-file.xml deploy' to check if my repository
          url is specified correctly. And it works. Jar is deployed to remote repository with
          correct version.


          I'm trying to deploy to maven remote repository jars produced by
          ant. Those jars are in snapshot version.
          Whole deployment process is going properly, but something is wrong with names
          of deployed files.
          When I'm deploying artifacts using normal 'maven deploy', "SNAPSHOT" in
          the name is replaced by the current timestamp and the snapshot number (for
          instance: "20060105.123437-3").
          But when I'm deploying with antlib, the name isn't changed. "SNAPSHOT" is
          still in the name. And when I deploy snapshot again, the old one is
          replaced by the new one (which also different from behavior of normal 'mvn
          deploy').
          The metadata.xml also is generated incorrectly. Timestamp in snapshot tag is missing:
          <?xml version="1.0" encoding="UTF-8"?><metadata>
            <groupId>foo</groupId>
            <artifactId>foo-jar1</artifactId>
            <version>1.0-SNAPSHOT</version>
            <versioning>
              <snapshot>
                <buildNumber>4</buildNumber>
              </snapshot>
              <lastUpdated>20060209111228</lastUpdated>
            </versioning>
          </metadata>
          Here's an fragment of my ant script:
            <target name="maven-poms">
              <artifact:pom id="pom.jar1-jar" file="maven/pom-jar1-jar.xml" />
              <artifact:pom id="pom.jar2-jar" file="maven/pom-jar2-jar.xml" />
              <artifact:pom id="pom.jar3-jar" file="maven/pom-jar3--jar.xml" />
            </target>
            <target name="maven-install-local"
                 depends="maven-poms,generate-jars">
              <artifact:install file="${build.dir}/jar1.jar">
                <pom refid="pom.jar1-jar"/>
              </artifact:install>
              <artifact:install file="${build.dir}/jar2.jar">
                <pom refid="pom.jar2-jar"/>
              </artifact:install>
              <artifact:install file="${build.dir}/jar3.jar">
                <pom refid="pom.jar3-jar"/>
              </artifact:install>
            </target>

            <target name="maven-deploy-remote" depends="maven-install-local">
              <artifact:install-provider artifactId="wagon-ssh" version="1.0-alpha-5"/>
           
              <artifact:deploy file="${build.dir}/jar1.jar">
                <pom refid="pom.jar1-jar"/>
              </artifact:deploy>
              <artifact:deploy file="${build.dir}/jar2.jar">
                <pom refid="pom.jar2-jar"/>
              </artifact:deploy>
              <artifact:deploy file="${build.dir}/jar3.jar">
                <pom refid="pom.jar3-jar"/>
              </artifact:deploy>
            </target>
          The artifacts poms are in separate files which contain only artifactId, groupId,
          version, dependencies and remote repository url.
          I also tried to deploy using 'mvn -f pom-file.xml deploy' to check if my repository
          url is specified correctly. And it works. Jar is deployed to remote repository with
          correct version.
          Hide
          Peter Muir added a comment -

          Also, the patch breaks support for attached files (they are deployed as separate artifacts with an updated buildNumber)

          Show
          Peter Muir added a comment - Also, the patch breaks support for attached files (they are deployed as separate artifacts with an updated buildNumber)
          Hide
          Peter Muir added a comment -

          When used in MANTTASKS-85, settings.xml is not used for deploy - a call to updateRepositoryWithSettings(repository); is needed in createDeploymentArtifactRepository.

          Show
          Peter Muir added a comment - When used in MANTTASKS-85 , settings.xml is not used for deploy - a call to updateRepositoryWithSettings(repository); is needed in createDeploymentArtifactRepository.
          Hervé Boutemy made changes -
          Attachment MANTTASKS-23.diff [ 28615 ]
          Hervé Boutemy made changes -
          Attachment MANTTASKS-23.diff [ 28603 ]
          Hervé Boutemy made changes -
          Fix Version/s 2.0.8 [ 13618 ]
          Affects Version/s 2.0.6 [ 13351 ]
          Affects Version/s 2.0.4 [ 13393 ]
          Affects Version/s 2.0.7 [ 13521 ]
          Testcase included yes
          Patch Submitted [Yes]
          Hervé Boutemy made changes -
          Attachment MANTTASKS-23.diff [ 28603 ]
          Attachment MANTTASKS-23_site.diff [ 28604 ]
          Hide
          Hervé Boutemy added a comment -

          here is a patch for maven-ant-tasks and the corresponding site documentation for : artifact:deploy uniqueVersion="false"

          Show
          Hervé Boutemy added a comment - here is a patch for maven-ant-tasks and the corresponding site documentation for : artifact:deploy uniqueVersion="false"
          Hervé Boutemy made changes -
          Component/s deploy task [ 12845 ]
          Hervé Boutemy made changes -
          Link This issue is duplicated by MANTTASKS-67 [ MANTTASKS-67 ]
          Brett Porter made changes -
          Workflow jira [ 69353 ] Maven New [ 69377 ]
          Jason van Zyl made changes -
          Affects Version/s 2.0.2 [ 12125 ]
          Fix Version/s 2.1.x [ 13142 ]
          Key MNG-2060 MANTTASKS-23
          Workflow Maven New [ 48823 ] jira [ 69353 ]
          Project Maven 2 [ 10500 ] Maven 2.x Ant Tasks [ 11533 ]
          Component/s Ant tasks [ 11532 ]
          Lee, YongHyun made changes -
          Attachment maven-artifact-ant-MNG-2060.patch [ 25533 ]
          Hide
          Lee, YongHyun added a comment -

          I had a same experience. and I should to deploy SNAPSHOT right now.
          so I tried to solve this bug.

          check this patch out.

          @yohlee

          Show
          Lee, YongHyun added a comment - I had a same experience. and I should to deploy SNAPSHOT right now. so I tried to solve this bug. check this patch out. @yohlee
          Jason van Zyl made changes -
          Fix Version/s 2.1.x [ 13142 ]
          Fix Version/s 2.1 [ 11704 ]
          John Casey made changes -
          Fix Version/s 2.1 [ 11704 ]
          Hide
          Dan Fabulich added a comment -

          As I commented in MNG-2269, (a duplicate of this bug,) it'd be nice if the Ant task let you specify what build number to use as an attribute, so I could use it together with Ant's <buildnumber> task.

          Show
          Dan Fabulich added a comment - As I commented in MNG-2269, (a duplicate of this bug,) it'd be nice if the Ant task let you specify what build number to use as an attribute, so I could use it together with Ant's <buildnumber> task.
          Jan Koops made changes -
          Field Original Value New Value
          Link This issue is related to MNG-1340 [ MNG-1340 ]
          Hide
          Jan Koops added a comment -

          I stepped through the sources:

          The main problem seems to be AbstractArtifactTask lacks a method to create a deploymentArtifactRepository (repositoryFactory.createDeploymentArtifactRepository()):
          The DepoyTasks uses AbstractArtifactTask.createRemoteArtifactRepository() that calls repositoryFactory.createArtifactRepository(). This method uses the DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) constructor which has no way to set the uniqueVersion-boolean to true. So uniqueVersion is always false.
          The SnapshotTransformation checks if remoteRepository.isUniqueVersion() and the SNAPSHOT-String is never replaced.

          Show
          Jan Koops added a comment - I stepped through the sources: The main problem seems to be AbstractArtifactTask lacks a method to create a deploymentArtifactRepository (repositoryFactory.createDeploymentArtifactRepository()): The DepoyTasks uses AbstractArtifactTask.createRemoteArtifactRepository() that calls repositoryFactory.createArtifactRepository(). This method uses the DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) constructor which has no way to set the uniqueVersion-boolean to true. So uniqueVersion is always false. The SnapshotTransformation checks if remoteRepository.isUniqueVersion() and the SNAPSHOT-String is never replaced.
          Michal Stochmialek created issue -

            People

            • Assignee:
              Hervé Boutemy
              Reporter:
              Michal Stochmialek
            • Votes:
              12 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development