突然maven无法编译

时间:2014-07-09 02:34:44

标签: java eclipse maven

C:\Users\nanjiang.jx>mvn -version
    Apache Maven 2.2.1 (r801777; 2009-08-07 03:16:01+0800)
    Java version: 1.6.0_45
    Java home: D:\Program Files\Java\jdk1.6.0_45\jre
    Default locale: zh_CN, platform encoding: GBK
    OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"
C:\Users\nanjiang.jx>java -version
    java version "1.7.0_60"
    Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
    Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

我使用maven在Java上开发了几天。其他人的项目编译好了。

今天,我使用新电脑并设置如上所述的env。

当我输入mvn eclipse:eclipse时,jar被下载了,但它没有附加到.classpath。

c:\idlecenter>call mvn clean eclipse:eclipse -DdownloadSources=tru
    e
    [INFO] Scanning for projects...
    [INFO] Reactor build order:
    [INFO]   idlecenter-all
    [INFO]   idlecenter-client
    [INFO]   idlecenter-dal
    [INFO]   idlecenter-server
    [INFO] Searching repository for plugin with prefix: 'eclipse'.
    [INFO] ------------------------------------------------------------------------
    [INFO] Building idlecenter-all
    [INFO]    task-segment: [clean, eclipse:eclipse]
    [INFO] ------------------------------------------------------------------------
    [INFO] [clean:clean {execution: default-clean}]
    [INFO] Preparing eclipse:eclipse
    [INFO] No goals needed for project - skipping
    [INFO] [eclipse:eclipse {execution: default-cli}]
    [INFO] Not running eclipse plugin goal for pom project
    [INFO] Using Eclipse Workspace: null
    [INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAIN
    ER
    [INFO] ------------------------------------------------------------------------
    [INFO] Building idlecenter-client
    [INFO]    task-segment: [clean, eclipse:eclipse]
    [INFO] ------------------------------------------------------------------------
    [INFO] [clean:clean {execution: default-clean}]
    [INFO] Deleting directory I:\idlecenter\idlecenter-client\target
    [INFO] Preparing eclipse:eclipse
    [INFO] No goals needed for project - skipping
    [INFO] [eclipse:eclipse {execution: default-cli}]
    [INFO] Using Eclipse Workspace: null
    [INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAIN
    ER
    [ERROR] An error occurred during dependency resolution of the following artifact
    :
        com.ning:compress-lzf:0.6.0
    Caused by: Unable to get dependency information: Unable to read the metadata fil
    e for artifact 'com.ning:compress-lzf:jar': Cannot find parent: org.sonatype.oss
    :oss-parent for project: com.ning:compress-lzf:bundle:0.6.0 for project com.ning
    :compress-lzf:bundle:0.6.0
      com.ning:compress-lzf:jar:0.6.0

1 个答案:

答案 0 :(得分:1)

嗯....主要的POM('org.sonatype.oss:oss-parent:2')存在于主Maven存储库中。所以下载它可能会出现短暂的问题。

查看您当地的maven repo(例如“〜/ .m2 / repository / ...”)以查看父POM是否存在,并检查Maven是否已下载损坏的副本。 (该POM文件与this page上看到的内容相同吗?

如果它已损坏,您可以尝试吹掉“... / org.sonatype.oss / ...”子树并再次运行Maven。如果您仍然看到Maven失败,那么您可能需要检查如何配置上游存储库详细信息等。