Skip to content

Eclipse 中使用 Maven

🏷️ Maven Eclipse

原文:使用 Eclipse 构建 Maven 项目 (step-by-step)

  1. 安装 m2eclipse 插件时出错:

    Cannot complete the install because one or more required items could not be found.
     Software being installed: m2e - Maven Integration for Eclipse (includes Incubating components) (
     Missing requirement: Maven Integration for Eclipse (org.eclipse.m2e.core requires 'bundle org.eclipse.osgi 3.10.0' but it could not be found
     Cannot satisfy dependency:
      From: Maven Integration for Eclipse (Editors) (org.eclipse.m2e.editor
      To: bundle org.eclipse.m2e.core [1.7.0,1.8.0)
     Cannot satisfy dependency:
      From: m2e - Maven Integration for Eclipse (includes Incubating components) (
      To: org.eclipse.m2e.editor []

    根据 Maven in Eclipse: step by step installation 里的回答,好像是因为 Eclipse 不支持最新版本的 m2e 导致的,试了下 1.4-最新的 1.7 都不行,就先安装了 1.0 版的 (

  2. Eclipse 使用 Maven 创建 Web 时错误:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webap

  3. Maven build 时出错(-Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment variable and mvn script match.)


    在 Window->Preference->Java->Installed JREs->Edit 的 Default VM arguments 中设置

  4. Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its depende

    好像是以为之前配的 setting.xml 里的 mirror 里没有对应的插件导致的。把 mirror 删掉就好了。

  5. 运行 Maven 是报错:

    No goals have been specified for this build

    pom.xml 文件 <build> 标签后面加上 <defaultGoal>compile</defaultGoal> 即可