简体   繁体   中英

Trouble with ehcache dependencies from Maven Central

I'm trying to build a project on a new laptop with an empty .m2/repository directory. I get the following error:

BUILD FAILED
/home/awills/Dropbox/Jasig/portal/uPortal/build.xml:635: The following error occurred while executing this line:
/home/awills/Dropbox/Jasig/portal/uPortal/build.xml:1437: The following error occurred while executing this line:
/home/awills/Dropbox/Jasig/portal/uPortal/build.xml:1372: The following error occurred while executing this line:
/home/awills/Dropbox/Jasig/portal/uPortal/build.xml:1315: The following error occurred while executing this line:
/home/awills/Dropbox/Jasig/portal/uPortal/build.xml:1318: The following error occurred while executing this line:
/home/awills/Dropbox/Jasig/portal/uPortal/build.xml:1375: The following error occurred while executing this line:
/home/awills/Dropbox/Jasig/portal/uPortal/build.xml:1227: Unable to resolve artifact: Unable to get dependency information: Unable to read the metadata file for artifact 'net.sf.ehcache:ehcache-web:jar': Cannot find parent: net.sf.ehcache:ehcache-web-parent for project: null:ehcache-web:jar:null for project null:ehcache-web:jar:null
  net.sf.ehcache:ehcache-web:jar:2.0.4

from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots),
  apache-snapshots (http://repository.apache.org/snapshots)

Path to dependency: 
    1) org.jasig.portal:uportal-war:war:4.1.0-SNAPSHOT
    2) org.jasig.resourceserver:resource-server-utils:jar:1.0.38

The project is mature and this dependency has not changed recently. The build was working recently.

I don't understand the bit about for project: null:ehcache-web:jar:null -- where is it getting the nulls?

The net.sf.ehcache:ehcache-web:2.0.4 pom begins as follows...

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>net.sf.ehcache</groupId>
    <artifactId>ehcache-web-parent</artifactId>
    <version>2.0.4</version>
  </parent>
  <name>Ehcache Web Filters</name>
  <artifactId>ehcache-web</artifactId>
  <packaging>jar</packaging>
  <description><![CDATA[Web caching filters.]]> </description>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://ehcache.org/license.html</url>
    </license>
  </licenses>

And the net.sf.ehcache:ehcache-web-parent:2.0.4 pom begins as follows...

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <properties>
        <forgeTags>Integration Module</forgeTags>
        <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
    </properties>

    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>net.sf.ehcache</groupId>
        <artifactId>ehcache-parent</artifactId>
        <version>2.3</version>
    </parent>
    <name>Ehcache Web Filters Parent</name>
    <artifactId>ehcache-web-parent</artifactId>
    <packaging>pom</packaging>
    <version>2.0.4</version>
    <description>parent pom for web module</description>

It seems that when there is a parent pom, and there are repositories defined in the child pom (ehcache-web in this case), maven tries to find the parent dependency from only the repositories defined in the child pom, and does not look in maven central at all.

In ehcache-web pom you have this:

<repositories>
  <repository>
    <id>sourceforge-snapshots</id>
    <name>Sourceforge Snapshot Repository</name>
    <url>http://oss.sonatype.org/content/repositories/sourceforge-snapshots</url>
  </repository>
</repositories>

But since the parent is no longer a snapshot and has been moved to the maven central it isn't found. I worked around this by simply deleting the repositories element from my local pom file (~/.m2/repository/net/sf/ehcache/ehcache-web/2.0.4/ehcache-web-2.0.4.pom).

I also had to delete the stored ehcache-web-parent pom file, which was simply a redirect.

I found surprisingly little information about this online, but maybe these are of help: https://issues.sonatype.org/browse/MVNCENTRAL-468 http://jira.codehaus.org/browse/MANTTASKS-246

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM