错误:找不到或加载主类Maven Spring Boot应用程序-可执行JAR

问题描述 投票:0回答:1

我正在尝试运行可执行jar,但收到以下消息:

Could not find or load main class

这里是MANIFEST.MF文件的内容:

Manifest-Version: 1.0
Created-By: Apache Maven Built-By: Administrator
Build-Jdk: 11.0.3
Class-Path: spring-boot-starter-batch-2.2.0.RELEASE.jar spring-boot-starter-1.5.6.RELEASE.jar spring-boot-1.5.6.RELEASE.jar spring-boot-autocon
     figure-1.5.6.RELEASE.jar .......
Main-Class: EAB.ActiveTeam.Exporter.App

当我在网络上搜索时,我真的很困惑,尝试了许多解决方案来使我的可执行JAR运行!

[请帮助,我发送了5多个小时试图修复,但没有运气!

这是我的POM.xml文件:

<?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 https://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.2.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>EAB.ActiveTeam.Exporter</groupId>
    <artifactId>EAB.ActiveTeam.Exporter</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>EAB.ActiveTeam.Exporter</name>
    <description>EAB.ActiveTeam.Exporter</description>

    <properties>
        <java.version>11</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>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
      <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      <configuration>
        <mainClass>EAB.ActiveTeam.Exporter.App</mainClass>
        <layout>jar</layout>
        <outputDirectory>../libs</outputDirectory>
      </configuration>
        <executions>
          <execution>
            <id>repackage</id>
            <goals>
              <goal>repackage</goal>
            </goals>
            <configuration>
              <classifier>exec</classifier>
            </configuration>
          </execution>
        </executions>
      </plugin>
        </plugins>
    </build>
</project>
java spring-boot maven
1个回答
0
投票

关于spring boot应用程序,您无法创建常规jar文件,因为spring boot应用程序jar根本不是jar。它没有jar的内部目录布局(例如,所有依赖项都在BOOT-INF / lib中),并且还有一些其他细微的差别。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.