简体   繁体   English

M2Eclipse(M2E)构建错误

[英]M2Eclipse (M2E) build errors

I have installed the m2e plugin for Eclipse and used it to create a simple archetype. 我已经为Eclipse安装了m2e插件,并使用它来创建一个简单的原型。 I wrote a small test driver and am trying to build the project (via Maven) and compile my Java sources into class files. 我编写了一个小型测试驱动程序,并试图构建该项目(通过Maven)并将Java源代码编译为类文件。

I go to Run >> Run Configurations and create a New Maven Build . 我转到Run >> Run Configurations并创建一个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. 当我尝试选择Goals时,看不到任何Goals ,因此无法添加/指定任何目标。 I click the Run button. 我单击Run按钮。 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: 我的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>

A few things: 一些东西:

  • What should my artifactId , groupId and version be if this is the (standard) Maven compile phase? 如果这是(标准)Maven compile阶段,我的artifactIdgroupIdversion应该是什么?
  • Is this the correct way to launch a Maven build (through Run Configurations )? 这是启动Maven构建的正确方法(通过Run Configurations )吗? In Ant there is a plugin that lets you see all of the targets defined in your build.xml ; 在Ant中,有一个插件可以让您查看build.xml定义的所有目标。 I see no such analog in Maven/m2e. 我在Maven / m2e中看不到这样的模拟。
  • Why does something as simple as compile require plugins? 为什么像编译这样简单的事情需要插件? One would think this would be a standard part of any build tool. 有人会认为这将是任何构建工具的标准部分。

You don't need to put anything as you are using all the defaults settings of the maven compiler. 使用maven编译器的所有默认设置时,无需放置任何内容。 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM