未知的生命周期阶段“mvn”。您必须以 <plugin-prefix>:<goal> 或 <plugin-group-id> 格式指定有效的生命周期阶段或目标

新手上路,请多包涵

通过 Eclipse 构建 sprint 启动应用程序时出现此错误。

 [ERROR] Unknown lifecycle phase "mvn". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

但如果我通过命令提示符构建,工作正常。在下面附加 pom.xml。

Pom.xml

 <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>com.sarun</groupId>
    <artifactId>SpringAngular</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name> SpringDataRestAngular</name>
    <description>Spring + AngularJS </description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.1.3.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>
        <!-- <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> -->

        <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.3-1100-jdbc41</version>
        </dependency>

    </dependencies>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <start-class>com.programmingfree.springservice.Application</start-class>
        <java.version>1.7</java.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

原文由 Sarun UK 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.3k
2 个回答

如果您正在使用 maven 的调试配置,请使用命令

clean install

并跳过所有测试。

原文由 user6712618 发布,翻译遵循 CC BY-SA 3.0 许可协议

谢谢回复。我在 Maven 构建配置中使用了“mvn clean install”。如果通过 Eclipse 运行,我们不需要使用“mvn”命令。

使用命令“干净安装”构建应用程序后,我又遇到了一个错误 -

“在这个环境中没有提供编译器。也许您在 JRE 而不是 JDK 上运行?”

我点击了这个链接: - 在这个环境中没有提供编译器。也许您在 JRE 而不是 JDK 上运行?

现在应用程序构建在 Eclipse 中很好。

原文由 Sarun UK 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
logo
Stack Overflow 翻译
子站问答
访问
宣传栏