当前位置: 首页 > 知识库问答 >
问题:

无法使用spring-boot-starter-parent运行Spring Boot应用程序(2.3.0)

邢卓
2023-03-14

我将spring boot starter父级修改为2.3.0。通过此修改,我还引入了spring maven插件中的版本

<plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>2.3.0.RELEASE</version>
</plugin>

我能够完成mvn clean install..但当我运行命令mvn clean install spring-boot:run..我得到以下错误。

Lifecycle.LifecycleExecutionException:无法执行目标org.springframework.boot:spring-boot-maven-plugin:2.3.0。release:在项目上运行(default-cli

有人能帮帮我吗。

<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.abc</groupId>
  <artifactId>servicesapp</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  
  <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
        
  </parent>
  
  <properties>
        <logback.version>1.2.3</logback.version>
        <slf4j.version>1.7.22</slf4j.version>
        <efc.version>0.0.1-SNAPSHOT</efc.version>
        <spring.boot.version>1.4.3.RELEASE</spring.boot.version>
  </properties>  
    
  <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        
        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
        <!-- <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
            <version>${spring.boot.version}</version>
        </dependency> -->
        
        <!-- For html -->
       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        
        <!-- Spring Boot Developer tools  -->
      <!--  <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-devtools</artifactId>
             <optional>true</optional>
       </dependency> -->
        
        <!-- test cases -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <!-- <scope>test</scope> -->
        </dependency>
        
        <!-- helps in monitoring health, metrics, info, dump, env -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        
        <!-- Logging with SLF4J & LogBack -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <version>${slf4j.version}</version>
        </dependency>       
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback.version}</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-access</artifactId>
            <version>${logback.version}</version>
        </dependency>
        
         <!--  Added for Swagger documentation -->
         <!-- <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.6.1</version>
            <scope>compile</scope>
        </dependency> -->
           
        <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
        <dependency>
           <groupId>io.springfox</groupId>
           <artifactId>springfox-swagger2</artifactId>
           <version>2.6.1</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
  </dependencies>
  
  <build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>2.3.0.RELEASE</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
            <configuration>
                <forkCount>1</forkCount>
                <reuseForks>true</reuseForks>
                <argLine>-Xmx1024m </argLine>
                <includes>
                    <include>**/ServiceMainTest.java</include>
                </includes>
            </configuration>
        </plugin>

    </plugins>

</build>
</project>

完成错误跟踪..

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.3.0.RELEASE:run (default-cli) on project webservices-vehiclecontent: Application finished with exit code: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.3.0.RELEASE:run (default-cli) on project webservices-vehiclecontent: Application finished with exit code: 1
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Application finished with exit code: 1
        at org.springframework.boot.maven.RunMojo.runWithForkedJvm(RunMojo.java:101)
        at org.springframework.boot.maven.AbstractRunMojo.doRunWithForkedJvm(AbstractRunMojo.java:296)
        at org.springframework.boot.maven.AbstractRunMojo.run(AbstractRunMojo.java:261)
        at org.springframework.boot.maven.AbstractRunMojo.execute(AbstractRunMojo.java:233)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 20 more
[ERROR]
[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/MojoExecutionException

共有1个答案

夏雅志
2023-03-14

我复制了您的pom.xml并运行mvn clean install,然后运行mvn spring-boot:run-一切工作正常,应用程序运行良好。

请尝试mvn clean install spring-boot:repackage

 类似资料:
  • 我无法使用https运行spring启动应用程序。我知道Spring boot使用嵌入式tomcat服务器 下面是stacktrace 下面显示的是我的Yaml文件 我在stackoverflow中尝试了几乎所有的答案 我尝试的一些答案如下: 只有在运行jar文件时才会发生这种情况,我可以从IDE轻松地运行spring启动应用程序(我使用Intellij) > 将端口从8181更改为8443(许多

  • 我跟踪了下面的文章并设置了项目 https://www.callicoder.com/spring-boot-rest-api-tutorial-with-mysql-jpa-hibernate/ 我附上POM以供参考。当我运行该项目时,我得到: 2019-12-11 14:53:12.373警告10004---[restartedMain]ConfigServletWebServerApplic

  • 想要基于spring boot starter mail实现简单邮件发送器解决方案在添加依赖项并设置属性后,我试图运行应用程序,但出现了错误。我认为值得注意的是,我没有,也不打算实现Spring Cloud。只有邮件服务。不明白为什么spring boot需要来自这些包的一些服务。 尝试了不同版本的依赖关系,定义了一些@Beans,但不认为这是问题所在 日志: 只想通过smtp发送电子邮件。gma

  • 必须显式设置本地DC(请参阅配置中的basic.load-balancing-policy.local-datacenter,或使用SessionBuilder.WithLocalDatacenter以编程方式设置) 在localhost上运行单节点群集。 能够使用CQLSH查询cassandra键空间。 运行Cassandra版本:3.11.8 使用spring boot版本:2.3.4 cas

  • 我在研究JavaBrain的Spring引导视频时遇到了与下面链接相同的错误。 为什么我的Spring Boot App总是在启动后立即关闭? 输出:

  • 我有这个春靴应用程序。使用Quartz(一个功能丰富的开源作业调度库,几乎可以集成在任何Java应用程序中)在每月10日执行作业 在配置包中: 请参考一下,我有另一个类似的应用程序,没有,而且工作正常: