开发者

What does Maven mean by: "Could not retrieve the target file name of dependency"

I have been Googling for the following warning when building a WAR, but can't find an explanation:

[WARNING] Could not re开发者_如何学编程trieve the target file name of dependency [Dependency {groupId=org.company.xml.jaxbtypes, artifactId=iJaxbtypes, version=1.0.2-SNAPSHOT, type=jar}]

The dependency is resolved and everything works as expected, but WEB-INF/lib contains:

  • iJaxbtypes-1.0.2-20100721.170712-1

If I don't run a clean, I now have:

  • iJaxbtypes-1.0.2-20100721.170712-1
  • iJaxbtypes-1.0.2-20100721.170712-6

Is this because it's a SNAPSHOT dependency? I've been using Maven for a couple of years now, but hadn't come across this one.


When using a SNAPSHOT dependency, Maven will look in the remote repository for a groupId/artifactId/version/maven-metadata.xml which typically looks like:

<?xml version="1.0" encoding="UTF-8"?>
<metadata>
  <groupId>org.sonatype.nexus</groupId>
  <artifactId>nexus</artifactId>
  <version>1.4.2-SNAPSHOT</version>
  <versioning>
    <snapshot>
      <timestamp>20091214.221414</timestamp>
      <buildNumber>13</buildNumber>
    </snapshot>
    <lastUpdated>20091214221558</lastUpdated>
  </versioning>
</metadata>

This file used by Maven to understand what the latest snapshot artifact file is.

I believe that you don't have metadata for your iJaxbtypes artifact, or they are corrupted, and Maven can't handle the SNAPSHOT properly and download the latest file each time without renaming it.

Check the remote repository for the maven-metadata.xml and maybe also the deployment procedure. If everything looks fine, try to remove the merged metadata from your local repository.

See also

  • Maven Dependency Resolution – A Repository Perspective
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜