使用Maven尝试构建时缺少工件

时间:2012-03-26 20:25:38

标签: java eclipse maven m2e

我正在尝试使用Maven在Eclipse中构建一个项目。但是我收到了错误

Missing artifact net.sf.doodleproject:numerics4j:jar:1.3

运行

mvn install

我得到了

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - tahrirproject:tahrir:jar:0.0.1-SNAPSHOT
[INFO]    task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
Downloading: http://repo2.maven.org/maven2/net/sf/doodleproject/numerics4j/1.3/numerics4j-1.3.pom
[INFO] Unable to find resource 'net.sf.doodleproject:numerics4j:pom:1.3' in repository repo2_maven_org (http://repo2.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/net/sf/doodleproject/numerics4j/1.3/numerics4j-1.3.pom
[INFO] Unable to find resource 'net.sf.doodleproject:numerics4j:pom:1.3' in repository central (http://repo1.maven.org/maven2)
[WARNING] Overriding profile: 'null' (source: pom) with new instance from source: pom
[WARNING] Overriding profile: 'null' (source: pom) with new instance from source: pom
[WARNING] Overriding profile: 'null' (source: pom) with new instance from source: pom
Downloading: http://repo2.maven.org/maven2/net/sf/doodleproject/numerics4j/1.3/numerics4j-1.3.jar
[INFO] Unable to find resource 'net.sf.doodleproject:numerics4j:jar:1.3' in repository repo2_maven_org (http://repo2.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/net/sf/doodleproject/numerics4j/1.3/numerics4j-1.3.jar
[INFO] Unable to find resource 'net.sf.doodleproject:numerics4j:jar:1.3' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) net.sf.doodleproject:numerics4j:jar:1.3

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=net.sf.doodleproject -DartifactId=numerics4j -Dversion=1.3 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=net.sf.doodleproject -DartifactId=numerics4j -Dversion=1.3 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
        1) tahrirproject:tahrir:jar:0.0.1-SNAPSHOT
        2) net.sf.doodleproject:numerics4j:jar:1.3

----------
1 required artifact is missing.

for artifact: 
  tahrirproject:tahrir:jar:0.0.1-SNAPSHOT

from the specified remote repositories:
  repo2_maven_org (http://repo2.maven.org/maven2),
  central (http://repo1.maven.org/maven2)



[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Mon Mar 26 21:17:33 IST 2012
[INFO] Final Memory: 12M/105M
[INFO] ------------------------------------------------------------------------

所以它似乎正在尝试从中央存储库下载,即使它已在pom.xml文件中指定。

pom.xml is here

1 个答案:

答案 0 :(得分:1)

将pom部分更改为:

<repositories>
        <repository>
            <id>doodleproject-repo</id>
            <name>DoodleProject Maven 2 Repository</name>
            <url>http://doodleproject.sourceforge.net/maven2/release</url>
        </repository>
        <repository>
            <id>repo2_maven_org</id>
            <url>http://repo2.maven.org/maven2</url>
        </repository>
    </repositories>