M2Eclipse (M2E) 构建错误

发布于 2025-01-04 12:10:28 字数 2149 浏览 1 评论 0原文

我已经安装了 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>

一些事情:

  • 我的 artifactIdgroupId 应该是什么和 version 是否是(标准)Maven compile 阶段?
  • 这是启动 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 and version be if this is the (standard) Maven compile 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 your build.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ぇ气 2025-01-11 12:10:28

您不需要放置任何内容,因为您正在使用 Maven 编译器的所有默认设置。如果你确实想指定它,你可以这样做:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
</plugin>

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:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
</plugin>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文