You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "James Wennmacher (JIRA)" <ji...@codehaus.org> on 2014/07/08 22:05:10 UTC

[jira] (MANTTASKS-246) mvn ant task uses exclusively in fetched pom.xml and does not look in maven central, can store HTTP 301 Moved Permanently html response in pom.xml

James Wennmacher created MANTTASKS-246:
------------------------------------------

             Summary: mvn ant task uses <repositories> exclusively in fetched pom.xml and does not look in maven central, can store HTTP 301 Moved Permanently html response in pom.xml
                 Key: MANTTASKS-246
                 URL: https://jira.codehaus.org/browse/MANTTASKS-246
             Project: Maven Ant Tasks
          Issue Type: Bug
    Affects Versions: 2.1.3
            Reporter: James Wennmacher
         Attachments: anttest.zip, ehcache-web-parent-2.0.4.pom

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
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)
2. 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).



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)