有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

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

我正试图用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) 个答案

  1. # 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>