【问题标题】:Import Maven project "YCSB" into Eclipse将 Maven 项目“YCSB”导入 Eclipse
【发布时间】:2015-09-15 12:12:28
【问题描述】:

有人能告诉我将 Maven 项目(在我的情况下为 YCSB)导入 Eclipse Luna 的正确方法吗? 我正在通过Import > Maven > Existing Maven Projects 尝试它。 Eclipse导入所有文件夹和文件,但是每个文件夹POM.xml都有错误。

Plugin execution not covered by lifecycle configuration:
org.apache.maven.plugins:maven-checkstyle-plugin:2.15:checkstyle (execution: validate, phase: validate)

我也不知道如何构建和运行该项目。我通过使用目标clean package 配置 Maven 运行配置并进行了编译来尝试它。构建失败并显示以下控制台输出。

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.087 s
[INFO] Finished at: 2015-09-15T14:04:29+01:00
[INFO] Final Memory: 19M/170M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-surefire-plugin:jar:2.12.4: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org: Der Name oder der Dienst ist nicht bekannt: Unknown host repo.maven.apache.org: Der Name oder der Dienst ist nicht bekannt -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

使用命令行命令mvn clean package 构建项目,构建项目不会出错。

我的系统安装了 Ubuntu 14.04 和 Maven 3。

【问题讨论】:

    标签: java eclipse maven import ycsb


    【解决方案1】:

    首先, 这个错误

    Plugin execution not covered by lifecycle configuration:
    org.apache.maven.plugins:maven-checkstyle-plugin:2.15:checkstyle (execution: validate, phase: validate)
    

    发生是因为您没有在 eclipse 中安装“Eclipse Checkstyle Plug-in”。 在eclipse菜单:Help->install new software,进入本站http://eclipse-cs.sourceforge.net/update搜索checkstyle并安装这个插件,你的pol.xml中的错误就会全部消失。

    二、这个错误

    Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-surefire-plugin:jar:2.12.4: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org: Der Name oder der Dienst ist nicht bekannt: Unknown host repo.maven.apache.org:
     Der Name oder der Dienst ist nicht bekannt-> [Help 1]
    

    表示你的网络连接中断,maven无法下载依赖的jar文件进行编译。检查您的互联网连接或为 Maven 配置代理。 上面down的时候,使用mvn clean package编译maven。也可以使用mvn -pl com.yahoo.ycsb:mongodb-binding -am clean package只编译某个数据库绑定。

    【讨论】:

      【解决方案2】:

      是的,在 Eclipse 中导入 maven 项目是正确的方法,但是您遇到了一些错误。请检查错误窗口上的错误(窗口->显示视图 ->General->error log) 然后你得到实际的错误。

      【讨论】:

      • 错误日志显示。 Provisioning exception No repository found at http://download.eclipse.org/technology/m2e/releases-forindigo/1.4/.我再次尝试编译,现在项目构建成功。我想我的互联网连接坏了。但我仍然在每个文件夹 POM.xml 中都有错误。我现在如何运行该项目?我可以构建一个可运行的 Jar 吗?
      • 先用maven clean再用maven build
      猜你喜欢
      • 2011-01-04
      • 1970-01-01
      • 1970-01-01
      • 2011-06-19
      • 2019-07-20
      • 2022-01-08
      • 2017-08-13
      • 2013-03-27
      • 2018-02-11
      相关资源
      最近更新 更多