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

mvn and dependencies ant task exclusively use <repositories> in dependency's or transient-dependency's pom.xml and does not look in maven central, stores HTTP 301 Moved Permanently html response in pom.xml

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.1.3
    • None
    • None
    • None

    Description

      When mvn ant task fetches an artifact that has a parent and the artifact contains a <repositories> element in its pom.xml, the parent is fetched exclusively from the repositories listed in the repositories element and not maven central.

      This is different from how maven works when run from the command-line. From the command-line, all repositories are fetched from maven central by default and transitive dependencies are not fetched from the repositories listed in a fetched artifacts's pom.xml.

      Specific case in point, see attached project zip file.
      1. Insure your ~/.m2/repository/net/sf/ehcache is empty (rm -rf ~/.m2/repository/net/sf/ehcache)
      2. run mvn package. You see

      ...
      Downloading: http://repo.maven.apache.org/maven2/net/sf/ehcache/ehcache-web/2.0.4/ehcache-web-2.0.4.pom
      Downloaded: http://repo.maven.apache.org/maven2/net/sf/ehcache/ehcache-web/2.0.4/ehcache-web-2.0.4.pom (4 KB at 17.3 KB/sec)
      Downloading: http://repo.maven.apache.org/maven2/net/sf/ehcache/ehcache-web-parent/2.0.4/ehcache-web-parent-2.0.4.pom
      Downloaded: http://repo.maven.apache.org/maven2/net/sf/ehcache/ehcache-web-parent/2.0.4/ehcache-web-parent-2.0.4.pom (2 KB at 23.1 KB/sec)
      ...

      ehcache-web and ehcache-web-parent are fetched only from maven central.

      3. Insure your ~/.m2/repository/net/sf/ehcache is empty (rm -rf ~/.m2/repository/net/sf/ehcache)
      4. run ant. You see

      ...
      [artifact:mvn] Downloading: http://repo1.maven.org/maven2/net/sf/ehcache/ehcache-web/2.0.4/ehcache-web-2.0.4.pom
      [artifact:mvn] 3K downloaded
      [artifact:mvn] Downloading: http://oss.sonatype.org/content/repositories/sourceforge-snapshots/net/sf/ehcache/ehcache-web-parent/2.0.4/ehcache-web-parent-2.0.4.pom
      [artifact:mvn] 184b downloaded
      [artifact:mvn] [WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '780ba3cf6b6eb0f7c9f6d41d8d25a86a2f46b0c4'; remote = '<html>
      [artifact:mvn] <head><title>301' - RETRYING
      [artifact:mvn] Downloading: http://oss.sonatype.org/content/repositories/sourceforge-snapshots/net/sf/ehcache/ehcache-web-parent/2.0.4/ehcache-web-parent-2.0.4.pom
      [artifact:mvn] 184b downloaded
      [artifact:mvn] [WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '780ba3cf6b6eb0f7c9f6d41d8d25a86a2f46b0c4'; remote = '<html>
      [artifact:mvn] <head><title>301' - IGNORING
      ...

      You see
      a) ehcache-web is fetched from maven central, but ehcache-web-parent is fetched only from sourceforge-snapshots and does not attempt to fetch from maven central (this is true even if you have a repositories element in your main pom.xml that specifies this repository with snapshots=false.

      This is because ehcache-web's pom.xml had a repositories element specifying sourceforge-snapshots. If you modify the ehcache-web's pom.xml in your local .m2/repositories to remove the repositories element within it, then the maven ant task will properly retrieve ehcache-web-parent from maven central.

      b) the stored ehcache-web-parent pom.xml is the HTTP redirect page which is confusing and messes up the build.

      This appears to happen because the fetch of ehcache-web-parent from sourceforge-snapshots returns a 301 to an https URL, which returns a 404.

      wget http://oss.sonatype.org/content/repositories/sourceforge-snapshots/net/sf/ehcache/ehcache-web-parent/2.0.4/ehcache-web-parent-2.0.4.pom
      -2014-07-08 13:01:28- http://oss.sonatype.org/content/repositories/sourceforge-snapshots/net/sf/ehcache/ehcache-web-parent/2.0.4/ehcache-web-parent-2.0.4.pom
      Resolving oss.sonatype.org (oss.sonatype.org)... 207.223.241.93
      Connecting to oss.sonatype.org (oss.sonatype.org)|207.223.241.93|:80... connected.
      HTTP request sent, awaiting response... 301 Moved Permanently
      Location: https://oss.sonatype.org/content/repositories/sourceforge-snapshots/net/sf/ehcache/ehcache-web-parent/2.0.4/ehcache-web-parent-2.0.4.pom [following]
      -2014-07-08 13:01:28- https://oss.sonatype.org/content/repositories/sourceforge-snapshots/net/sf/ehcache/ehcache-web-parent/2.0.4/ehcache-web-parent-2.0.4.pom
      Connecting to oss.sonatype.org (oss.sonatype.org)|207.223.241.93|:443... connected.
      HTTP request sent, awaiting response... 404 Not Found
      2014-07-08 13:01:29 ERROR 404: Not Found.

      In summary:

      • maven ant task should not use the repositories element listed in the fetched artifact (ehcache-web) to resolve dependencies, but should instead use the 'normal' list of repositories (e.g. maven central).

      Attachments

        1. ehcache-web-parent-2.0.4.pom
          0.2 kB
          James Wennmacher
        2. anttest.zip
          1.13 MB
          James Wennmacher

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jameswennmacher James Wennmacher
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: