未知的生命周期阶段“spring-boot”

时间:2017-05-11 19:03:39

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

我有一个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]

1 个答案:

答案 0 :(得分:2)

  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. 运行您的应用,而不是

  3. mvn spring-boot run

    使用

    mvn spring-boot:run