【问题标题】:Unknown lifecycle phase "spring-boot"未知的生命周期阶段“spring-boot”
【发布时间】:2017-10-10 22:40:12
【问题描述】:

我有一个 Spring Boot 多模块项目,其中有 3 个库 jar 和一个使用这些库的主应用程序。 这是我的 1 个模块的 pom.xml

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

  <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.tdk-cloud</groupId>
        <artifactId>tdk-cloud</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>

  <groupId>com.tdk.web</groupId>
  <artifactId>tdk-web</artifactId>
  <packaging>jar</packaging>



  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
  </properties>

  <dependencies>

        <dependency> 
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>



        <!-- tdk-core dependencies -->
         <dependency>
            <groupId>com.tdk.core</groupId>
            <artifactId>tdk-core</artifactId>
            <version>0.0.1-SNAPSHOT</version>           
        </dependency> 



        <!-- Webjars for JQuery and Bootstrap -->
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>3.3.7-1</version>
        </dependency> 
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery</artifactId>
            <version>3.2.0</version>
        </dependency>

        <!-- Spring Security -->
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity4</artifactId>
            <!-- <version>3.0.2.RELEASE</version> -->
        </dependency>


   </dependencies>




</project>

但是当我使用mvn spring-boot run编译和运行你的应用程序时

我收到了这个错误:

[ERROR] Unknown lifecycle phase "spring-boot". 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]

【问题讨论】:

  • 你需要 maven spring boot 插件。将其添加到您的 pom 中

标签: java spring maven spring-mvc spring-boot


【解决方案1】:
  1. 在你的 pom.xml 中添加 Spring Boot Maven 插件

    <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>1.5.3.RELEASE</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
    

  2. 运行您的应用程序,而不是

mvn spring-boot run

使用

mvn spring-boot:run

【讨论】:

    猜你喜欢
    • 2017-11-10
    • 2013-05-05
    • 2021-10-18
    • 2021-02-02
    • 2021-01-25
    • 1970-01-01
    • 2017-10-06
    • 2022-11-11
    • 1970-01-01
    相关资源
    最近更新 更多