【发布时间】:2012-03-03 10:23:41
【问题描述】:
我已经为 Eclipse 安装了m2e 插件并用它来创建一个简单的原型。我编写了一个小型测试驱动程序并尝试构建项目(通过 Maven)并将我的 Java 源代码编译到类文件中。
我转到Run >> Run Configurations 并创建一个New Maven Build。我将其命名并将其基目录设置为我的项目根目录。
当我尝试选择 Goals 时,它看不到任何内容,因此我无法添加/指定任何内容。我单击Run 按钮。这是我的控制台输出:
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.me:myproject:0.0.1-SNAPSHOT (C:\Users\me\workbench\eclipse\workspace\MyProject\pom.xml) has 3 errors
[ERROR] 'build.plugins.plugin.artifactId' is missing. @ line 145, column 17
[ERROR] 'build.plugins.plugin.groupId' is missing. @ line 144, column 14
[ERROR] 'build.plugins.plugin.version' for : must be a valid version but is ''. @ line 146, column 14
[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/ProjectBuildingException
我的 pom.xml 中的 <build> 标签是:
<build>
<plugins>
<plugin>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compiler:compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
一些事情:
- 如果这是(标准)Maven
compile阶段,我的artifactId、groupId和version应该是什么? - 这是启动 Maven 构建(通过
Run Configurations)的正确方法吗?在 Ant 中,有一个插件可以让您查看在build.xml中定义的所有目标;我在 Maven/m2e 中看不到这样的类似物。 - 为什么像 compile 这样简单的东西需要插件?人们会认为这将是任何构建工具的标准部分。
【问题讨论】:
标签: java eclipse maven build m2e