1 回答

TA貢獻1880條經(jīng)驗 獲得超4個贊
彈簧啟動要求您在 pom 中的屬性標記中指定主類.xml<start-class>
<properties>
<!-- The main class to start by executing "java -jar"-->
<start-class>com.myProject.MyProject</start-class>
</properties>
編輯
根據(jù)您的pom.xml文件,您的軟件包結構應如下所示
如果您確定您的應用程序只有一個主要入口點。然后嘗試更新您的起始pom.xml以下基本依賴項,并在執(zhí)行生成的jar之前執(zhí)行。mvn clean install
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.myProject</groupId>
<artifactId>myProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>myproject</name>
<description>My Project</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
添加回答
舉報