Uploaded image for project: 'Maven Ant Tasks (RETIRED)'
  1. Maven Ant Tasks (RETIRED)
  2. MANTTASKS-166

Deploy task should implicitly include install phase

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.0.9
    • None
    • deploy task
    • None

    Description

      With maven, when you execute mvn deploy it implicitly executes mvn install. But with maven-ant, when you execute ant with target artifact:deploy it does not execute the install phase. This may cause invalid dependeny resolution.

      Given alfa/build.xml containing:

      <target name="deploy">
        <mkdir dir="build"/>
        <echo file="build/alfa-1.0.0-SNAPSHOT.jar">Pretend it's build by ant</echo>
        <artifact:pom id="mypom" file="pom.xml"/>
          <artifact:deploy file="build/alfa-1.0.0-SNAPSHOT.jar">
            <pom refid="mypom"/>
          </artifact:deploy>
      </target>
      

      I'm building alfa artifact:

      P:\workspace\mvnfix\alfa>ant deploy
      Buildfile: build.xml
      
      deploy:
      [artifact:deploy] Deploying to file:///C:/Temp/repo
      [artifact:deploy] [INFO] Retrieving previous build number from temprepo
      [artifact:deploy] [INFO] repository metadata for: 'snapshot mvnfix:alfa:1.0.0-SNAPSHOT' could not be
      found on repository: temprepo, so will be created
      [artifact:deploy] Uploading: mvnfix/alfa/1.0.0-SNAPSHOT/alfa-1.0.0-20091117.114134-1.jar to temprepo
      
      [artifact:deploy] Uploaded 0K
      [artifact:deploy] [INFO] Retrieving previous metadata from temprepo
      [artifact:deploy] [INFO] repository metadata for: 'artifact mvnfix:alfa' could not be found on
      repository: temprepo, so will be created
      [artifact:deploy] [INFO] Uploading repository metadata for: 'artifact mvnfix:alfa'
      [artifact:deploy] [INFO] Uploading project information for alfa 1.0.0-20091117.114134-1
      [artifact:deploy] [INFO] Retrieving previous metadata from temprepo
      [artifact:deploy] [INFO] repository metadata for: 'snapshot mvnfix:alfa:1.0.0-SNAPSHOT' could not be
      found on repository: temprepo, so will be created
      [artifact:deploy] [INFO] Uploading repository metadata for: 'snapshot mvnfix:alfa:1.0.0-SNAPSHOT'
      
      BUILD SUCCESSFUL
      Total time: 1 second
      
      P:\workspace\mvnfix\alfa>ls -l ~/.m2/repository/mvnfix/alfa/1.0.0-SNAPSHOT
      total 6
      -rwxr-xr-x+ 1 wgdela ????????  25 Nov 17 12:41 alfa-1.0.0-20091117.114134-1.jar
      -rwxr-xr-x+ 1 wgdela ???????? 672 Nov 17 12:41 alfa-1.0.0-20091117.114134-1.pom
      -rwxr-xr-x+ 1 wgdela ???????? 344 Nov 17 12:41 maven-metadata-temprepo.xml
      

      And then beta artifact, that depends on alfa:

      P:\workspace\mvnfix\alfa>cd ../beta
      
      P:\workspace\mvnfix\beta>mvn install
      [INFO] Scanning for projects...
      [INFO] ----------------------------------------------------------------------------
      [INFO] Building Unnamed - mvnfix:beta:jar:1.0.0-SNAPSHOT
      [INFO]    task-segment: [install]
      [INFO] ----------------------------------------------------------------------------
      [INFO] [resources:resources]
      [INFO] skip non existing resourceDirectory P:\workspace\mvnfix\beta\src\main\resources
      [INFO] snapshot mvnfix:alfa:1.0.0-SNAPSHOT: checking for updates from temprepo
      [INFO] [compiler:compile]
      [INFO] No sources to compile
      [INFO] [resources:testResources]
      [INFO] skip non existing resourceDirectory P:\workspace\mvnfix\beta\src\test\resources
      Downloading: file:///C:/Temp/repo/mvnfix/alfa/1.0.0-SNAPSHOT/alfa-1.0.0-20091117.114134-1.pom
      672b downloaded
      [INFO] [compiler:testCompile]
      [INFO] No sources to compile
      [INFO] [surefire:test]
      [INFO] No tests to run.
      [INFO] [jar:jar]
      [WARNING] JAR will be empty - no content was marked for inclusion!
      [INFO] Building jar: P:\workspace\mvnfix\beta\target\beta-1.0.0-SNAPSHOT.jar
      [INFO] [install:install]
      [INFO] Installing P:\workspace\mvnfix\beta\target\beta-1.0.0-SNAPSHOT.jar
      to ~\.m2\repository\mvnfix\beta\1.0.0-SNAPSHOT\beta-1.0.0-SNAPSHOT.jar
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESSFUL
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 7 seconds
      [INFO] Finished at: Tue Nov 17 12:43:44 CET 2009
      [INFO] ------------------------------------------------------------------------
      
      P:\workspace\mvnfix\beta>ls -l ~/.m2/repository/mvnfix/alfa/1.0.0-SNAPSHOT
      total 12
      -rwxr-xr-x+ 1 wgdela ????????  25 Nov 17 12:41 alfa-1.0.0-20091117.114134-1.jar
      -rwxr-xr-x+ 1 wgdela ???????? 672 Nov 17 12:41 alfa-1.0.0-20091117.114134-1.pom
      -rwxr-xr-x+ 1 wgdela ????????  25 Nov 17 12:43 alfa-1.0.0-SNAPSHOT.jar
      -rwxr-xr-x+ 1 wgdela ???????? 672 Nov 17 12:43 alfa-1.0.0-SNAPSHOT.pom
      -rwxr-xr-x+ 1 wgdela ???????? 344 Nov 17 12:43 maven-metadata-temprepo.xml
      -rwxr-xr-x+ 1 wgdela ????????  40 Nov 17 12:43 maven-metadata-temprepo.xml.sha1
      

      So far, so good. Then I make some changes in alfa, so I need to build alfa again:

      P:\workspace\mvnfix\beta>cd ../alfa
      
      P:\workspace\mvnfix\alfa>ant
      Buildfile: build.xml
      
      deploy:
      [artifact:deploy] Deploying to file:///C:/Temp/repo
      [artifact:deploy] [INFO] Retrieving previous build number from temprepo
      [artifact:deploy] Uploading: mvnfix/alfa/1.0.0-SNAPSHOT/alfa-1.0.0-20091117.114526-2.jar to temprepo
      
      [artifact:deploy] Uploaded 0K
      [artifact:deploy] [INFO] Retrieving previous metadata from temprepo
      [artifact:deploy] [INFO] Uploading repository metadata for: 'artifact mvnfix:alfa'
      [artifact:deploy] [INFO] Uploading project information for alfa 1.0.0-20091117.114526-2
      [artifact:deploy] [INFO] Retrieving previous metadata from temprepo
      [artifact:deploy] [INFO] Uploading repository metadata for: 'snapshot mvnfix:alfa:1.0.0-SNAPSHOT'
      
      BUILD SUCCESSFUL
      Total time: 1 second
      P:\workspace\mvnfix\alfa>ls -l ~/.m2/repository/mvnfix/alfa/1.0.0-SNAPSHOT
      total 17
      -rwxr-xr-x+ 1 wgdela ????????  25 Nov 17 12:41 alfa-1.0.0-20091117.114134-1.jar
      -rwxr-xr-x+ 1 wgdela ???????? 672 Nov 17 12:41 alfa-1.0.0-20091117.114134-1.pom
      -rwxr-xr-x+ 1 wgdela ????????  32 Nov 17 12:45 alfa-1.0.0-20091117.114526-2.jar
      -rwxr-xr-x+ 1 wgdela ???????? 672 Nov 17 12:45 alfa-1.0.0-20091117.114526-2.pom
      -rwxr-xr-x+ 1 wgdela ????????  25 Nov 17 12:43 alfa-1.0.0-SNAPSHOT.jar
      -rwxr-xr-x+ 1 wgdela ???????? 672 Nov 17 12:43 alfa-1.0.0-SNAPSHOT.pom
      -rwxr-xr-x+ 1 wgdela ???????? 344 Nov 17 12:45 maven-metadata-temprepo.xml
      -rwxr-xr-x+ 1 wgdela ????????  40 Nov 17 12:45 maven-metadata-temprepo.xml.sha1
      

      Take a look at the local repository. The modification time of alfa-1.0.0-SNAPSHOT.jar is two minutes earlier, than the modificiation time of alfa-1.0.0-20091117.114526-2.jar. The alfa-1.0.0-SNAPSHOT.jar file hasn't been changed in this build!

      Despite this, I'm building beta:

      P:\workspace\mvnfix\alfa>cd ../beta
      
      P:\workspace\mvnfix\beta>mvn install
      [INFO] Scanning for projects...
      [INFO] ----------------------------------------------------------------------------
      [INFO] Building Unnamed - mvnfix:beta:jar:1.0.0-SNAPSHOT
      [INFO]    task-segment: [install]
      [INFO] ----------------------------------------------------------------------------
      [INFO] [resources:resources]
      
      [INFO] skip non existing resourceDirectory P:\workspace\mvnfix\beta\src\main\resources
      [INFO] snapshot mvnfix:alfa:1.0.0-SNAPSHOT: checking for updates from temprepo
      [INFO] [compiler:compile]
      [INFO] No sources to compile
      [INFO] [resources:testResources]
      
      [INFO] skip non existing resourceDirectory P:\workspace\mvnfix\beta\src\test\resources
      Downloading: file:///C:/Temp/repo/mvnfix/alfa/1.0.0-SNAPSHOT/alfa-1.0.0-20091117.114526-2.pom
      672b downloaded
      [INFO] [compiler:testCompile]
      [INFO] No sources to compile
      [INFO] [surefire:test]
      [INFO] No tests to run.
      [INFO] [jar:jar]
      [WARNING] JAR will be empty - no content was marked for inclusion!
      [INFO] [install:install]
      [INFO] Installing P:\workspace\mvnfix\beta\target\beta-1.0.0-SNAPSHOT.jar
      to ~\.m2\repository\mvnfix\beta\1.0.0-SNAPSHOT\beta-1.0.0-SNAPSHOT.jar
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESSFUL
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 3 seconds
      [INFO] Finished at: Tue Nov 17 12:46:56 CET 2009
      [INFO] ------------------------------------------------------------------------
      
      P:\workspace\mvnfix\beta>ls -l ~/.m2/repository/mvnfix/alfa/1.0.0-SNAPSHOT
      total 17
      -rwxr-xr-x+ 1 wgdela ????????  25 Nov 17 12:41 alfa-1.0.0-20091117.114134-1.jar
      -rwxr-xr-x+ 1 wgdela ???????? 672 Nov 17 12:41 alfa-1.0.0-20091117.114134-1.pom
      -rwxr-xr-x+ 1 wgdela ????????  32 Nov 17 12:45 alfa-1.0.0-20091117.114526-2.jar
      -rwxr-xr-x+ 1 wgdela ???????? 672 Nov 17 12:45 alfa-1.0.0-20091117.114526-2.pom
      -rwxr-xr-x+ 1 wgdela ????????  25 Nov 17 12:43 alfa-1.0.0-SNAPSHOT.jar
      -rwxr-xr-x+ 1 wgdela ???????? 672 Nov 17 12:46 alfa-1.0.0-SNAPSHOT.pom
      -rwxr-xr-x+ 1 wgdela ???????? 344 Nov 17 12:46 maven-metadata-temprepo.xml
      -rwxr-xr-x+ 1 wgdela ????????  40 Nov 17 12:46 maven-metadata-temprepo.xml.sha1
      

      Now only the alfa-1.0.0-SNAPSHOT.pom changes, and the jar is still old. This results in building beta with old version of alfa.

      For comparision, here's how it look like, when you build alfa with plain maven.

      P:\workspace\mvnfix\beta>cd ../alfa
      
      P:\workspace\mvnfix\alfa>mvn deploy
      [INFO] Scanning for projects...
      [INFO] ----------------------------------------------------------------------------
      [INFO] Building Unnamed - mvnfix:alfa:jar:1.0.0-SNAPSHOT
      [INFO]    task-segment: [deploy]
      [INFO] ----------------------------------------------------------------------------
      [INFO] [resources:resources]
      
      [INFO] skip non existing resourceDirectory P:\workspace\mvnfix\alfa\src\main\resources
      [INFO] [compiler:compile]
      [INFO] No sources to compile
      [INFO] [resources:testResources]
      
      [INFO] skip non existing resourceDirectory P:\workspace\mvnfix\alfa\src\test\resources
      [INFO] [compiler:testCompile]
      [INFO] No sources to compile
      [INFO] [surefire:test]
      [INFO] No tests to run.
      [INFO] [jar:jar]
      [WARNING] JAR will be empty - no content was marked for inclusion!
      [INFO] [install:install]
      [INFO] Installing P:\workspace\mvnfix\alfa\target\alfa-1.0.0-SNAPSHOT.jar
      to ~\.m2\repository\mvnfix\alfa\1.0.0-SNAPSHOT\alfa-1.0.0-SNAPSHOT.jar
      [INFO] [deploy:deploy]
      [INFO] Retrieving previous build number from temprepo
      Uploading: file:///C:/Temp/repo/mvnfix/alfa/1.0.0-SNAPSHOT/alfa-1.0.0-20091117.114852-3.jar
      1K uploaded
      [INFO] Retrieving previous metadata from temprepo
      [INFO] Uploading repository metadata for: 'artifact mvnfix:alfa'
      [INFO] Retrieving previous metadata from temprepo
      [INFO] Uploading project information for alfa 1.0.0-20091117.114852-3
      [INFO] Retrieving previous metadata from temprepo
      [INFO] Uploading repository metadata for: 'snapshot mvnfix:alfa:1.0.0-SNAPSHOT'
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESSFUL
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 3 seconds
      [INFO] Finished at: Tue Nov 17 12:48:52 CET 2009
      [INFO] ------------------------------------------------------------------------
      
      P:\workspace\mvnfix\alfa>ls -l ~/.m2/repository/mvnfix/alfa/1.0.0-SNAPSHOT
      total 29
      -rwxr-xr-x+ 1 wgdela ????????   25 Nov 17 12:41 alfa-1.0.0-20091117.114134-1.jar
      -rwxr-xr-x+ 1 wgdela ????????  672 Nov 17 12:41 alfa-1.0.0-20091117.114134-1.pom
      -rwxr-xr-x+ 1 wgdela ????????   32 Nov 17 12:45 alfa-1.0.0-20091117.114526-2.jar
      -rwxr-xr-x+ 1 wgdela ????????  672 Nov 17 12:45 alfa-1.0.0-20091117.114526-2.pom
      -rwxr-xr-x+ 1 wgdela ???????? 1441 Nov 17 12:48 alfa-1.0.0-20091117.114852-3.jar
      -rwxr-xr-x+ 1 wgdela ????????  672 Nov 17 12:48 alfa-1.0.0-20091117.114852-3.pom
      -rwxr-xr-x+ 1 wgdela ???????? 1441 Nov 17 12:48 alfa-1.0.0-SNAPSHOT.jar
      -rwxr-xr-x+ 1 wgdela ????????  672 Nov 17 12:48 alfa-1.0.0-SNAPSHOT.pom
      -rwxr-xr-x+ 1 wgdela ????????  298 Nov 17 12:48 maven-metadata-local.xml
      -rwxr-xr-x+ 1 wgdela ????????  344 Nov 17 12:48 maven-metadata-temprepo.xml
      -rwxr-xr-x+ 1 wgdela ????????   40 Nov 17 12:48 maven-metadata-temprepo.xml.sha1
      

      As you can see the alfa-1.0.0-SNAPSHOT.jar file is now fresh.

      So my conslusion: maven-ant should implicitly execute install phase, when artifact:deploy is used.

      Attachments

        1. mvnfix.zip
          2 kB
          Wojciech Gdela

        Activity

          People

            Unassigned Unassigned
            eltehaem Wojciech Gdela
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: