1 回答
TA贡献1880条经验 获得超4个赞
弹簧启动要求您在 pom 中的属性标记中指定主类.xml<start-class>
<properties>
<!-- The main class to start by executing "java -jar"-->
<start-class>com.myProject.MyProject</start-class>
</properties>
编辑
根据您的pom.xml文件,您的软件包结构应如下所示
如果您确定您的应用程序只有一个主要入口点。然后尝试更新您的起始pom.xml以下基本依赖项,并在执行生成的jar之前执行。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>
添加回答
举报