M2Eclipse (M2E) 构建错误
我已经安装了 Eclipse 的 m2e
插件,并使用它创建了一个简单的原型。我编写了一个小型测试驱动程序,并尝试构建该项目(通过 Maven)并将我的 Java 源代码编译为类文件。
我转到运行>>运行配置并创建一个新的 Maven 构建。我为其命名并将其基目录设置为我的项目根目录。
当我尝试选择目标
时,它没有看到任何目标,因此我无法添加/指定任何目标。我单击运行
按钮。这是我的控制台输出:
[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>
<plugins>
<plugin>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compiler:compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
一些事情:
- 我的
artifactId
、groupId
应该是什么和version
是否是(标准)Mavencompile
阶段? - 这是启动 Maven 构建的正确方法吗(通过
运行配置
)? Ant 中有一个插件可以让您查看build.xml
中定义的所有目标;我在 Maven/m2e 中没有看到类似的情况。 - 为什么像编译这样简单的事情需要插件?人们可能会认为这将是任何构建工具的标准部分。
I have installed the m2e
plugin for Eclipse and used it to create a simple archetype. I wrote a small test driver and am trying to build the project (via Maven) and compile my Java sources into class files.
I go toRun >> Run Configurations
and create a New Maven Build
. I name it and set its base directory to be my project root.
When I try to select Goals
it doesn't see any and so I can't add/specify any. I click the Run
button. Here is my console output:
[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
The <build>
tag in my pom.xml is:
<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>
A few things:
- What should my
artifactId
,groupId
andversion
be if this is the (standard) Mavencompile
phase? - Is this the correct way to launch a Maven build (through
Run Configurations
)? In Ant there is a plugin that lets you see all of the targets defined in yourbuild.xml
; I see no such analog in Maven/m2e. - Why does something as simple as compile require plugins? One would think this would be a standard part of any build tool.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要放置任何内容,因为您正在使用 Maven 编译器的所有默认设置。如果你确实想指定它,你可以这样做:
You don't need to put anything as you are using all the defaults settings of the maven compiler. If you really want to specify it you can do it this way: