无法执行目标Maven / Eclipse

时间:2018-04-05 13:48:24

标签: java eclipse maven pom.xml

好的,我是Maven和Eclipse的新手,我必须运行一个现有的项目。我尝试使用命令eclipse:eclipse -Dwtpversion=2.0,但它显示以下错误:

  

[INFO]添加对WTP 2.0版的支持   [INFO]使用Eclipse Workspace:null
  [INFO]添加默认的类路径容器:org.eclipse.jdt.launching.JRE_CONTAINER
  [INFO] ----------------------------------------------- -------------------------
  [INFO]建立失败
  [INFO] ----------------------------------------------- -------------------------
  [INFO]总时间:17.261秒   [INFO]完成时间:2018-04-05T10:36:20-03:00
  [INFO]最终记忆:9M / 88M
  [INFO] ----------------------------------------------- -------------------------
  [错误]无法在项目核心框架上执行目标 org.apache.maven.plugins:maven-eclipse-plugin:2.9:eclipse (default-cli):执行default-cli of goal org.apache.maven.plugins:maven-eclipse-plugin:2.9:eclipse 失败:对于工件{null:null:null:jar}:groupId不能为空。 - > [帮助1]

我已经在this question上尝试了所有可能的解决方案,但它并没有奏效。我的POM是:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>br.com.empresa1</groupId>
    <artifactId>e1-framework-utils</artifactId>
    <version>1.1.0</version>
    <packaging>jar</packaging>

    <name>e1-framework-utils</name>
    <url>http://maven.apache.org</url>

    <repositories>
        <repository>
            <id>pentaho-releases</id>
            <url>http://repository.pentaho.org/artifactory/repo/</url>
        </repository>
    </repositories>



    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <version.log4j>2.8.2</version.log4j>
        <version.junit>4.12</version.junit>
        <version.commonslang>3.3.2</version.commonslang>
        <version.freemaker>2.3.23</version.freemaker>
        <version.resteasey-multipart>3.0.11.Final</version.resteasey-multipart>
        <version.commonscollections>3.2.2</version.commonscollections>
        <version.zip4j>1.3.2</version.zip4j>

        <version.core-framerwork>2.2.0</version.core-framerwork>
        <!--  <version.test-core-framerwork>2.2.0</version.test-core-framerwork>-->
    </properties>

    <profiles>
        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <!-- Optional URL to server. Default value is http://localhost:9000 -->
                <sonar.host.url>
                    http://localhost:9000
                </sonar.host.url>
            </properties>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <!-- Always download and attach dependencies source code -->
                    <!--  <downloadSources>false</downloadSources>
                    <downloadJavadocs>false</downloadJavadocs>-->
                    <!-- Avoid type mvn eclipse:eclipse -Dwtpversion=2.0 -->
                    <wtpversion>2.0</wtpversion>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <compilerVersion>1.7</compilerVersion>
                    <source>1.7</source>
                    <target>1.7</target>
                    <testSource>1.7</testSource>
                    <testTarget>1.7</testTarget>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>3.0.1</version>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${version.junit}</version>
        </dependency>

        <dependency>
            <groupId>br.com.empresa1</groupId>
            <artifactId>core-framework</artifactId>
            <version>${version.core-framerwork}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${version.log4j}</version>
        </dependency>

        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
            <version>${version.freemaker}</version>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-multipart-provider</artifactId>
            <version>${version.resteasey-multipart}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${version.commonslang}</version>
        </dependency>

        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>${version.commonscollections}</version>
        </dependency>

        <!--  <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.0</version>
        </dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.2</version>
        </dependency>-->

        <dependency>
            <groupId>net.lingala.zip4j</groupId>
            <artifactId>zip4j</artifactId>
            <version>1.3.2</version>
        </dependency>


    </dependencies>
</project>

任何帮助都很有用

1 个答案:

答案 0 :(得分:1)

正如@JFMeier在评论中所说,命令 eclipse:eclipse 现在已被弃用。

要更新项目,请右键单击该项目,选择 Maven -> 更新项目... ->选中 强制更新快照/发布 框,然后单击 确定

那样就可以。