[ 
https://jira.codehaus.org/browse/MANTTASKS-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=352627#comment-352627
 ] 

James Wennmacher commented on MANTTASKS-246:
--------------------------------------------

Update:  Also had the problem with the dependencies maven ant task.  In an ant 
build.xml file, prior to determining if a project was out of date and needed to 
be rebuilt (using uptodate), it had

<artifact:pom file="@{project-path}/pom.xml" id="@{project-name}.pom" 
settingsFile="${maven.settings}" inheritAllProperties="false" />
<artifact:dependencies pathid="@{project-name}.classpath" 
pomrefid="@{project-name}.pom"/>

to create the pathid uportal-war.classpath to pass on to future tasks.  If you 
ran the build on a machine without ehcache-web-parent-2.0.4.pom in your local 
.m2/repository, the dependencies task would attempt to download it only from 
sourceforge-snapshots and ignore maven central and the build would fail.  
Fortunately just switching the dependencies call to after the maven invocation 
(using exec rather than the mvn ant task) resolved the issue.

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



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

Reply via email to