Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
777 views
in Technique[技术] by (71.8m points)

spring-boot - Spring Boot App可执行jar不包含我的外部FAT JAR(Spring boot App Executable jar does not include my external FAT JARs)

I have a multi-modules Spring boot project as following:

(我有一个多模块的Spring启动项目,如下所示:)

  • EAB.ActiveTeam.Domain -> FAT JAR

    (EAB.ActiveTeam.Domain-> FAT JAR)

  • EAB.ActiveTeam.Storage -> FAT JAR

    (EAB.ActiveTeam.Storage-> FAT JAR)

  • EAB.ActiveTeam.Exporter -> Execuatabel JAR

    (EAB.ActiveTeam.Exporter->执行JAR)

The last JAR references the two fat jars as in the below POM.xml but I got an exception in main: it does not see the classes in fat JARs.

(最后一个JAR引用了下面的POM.xml中的两个胖jar,但是我在main中有一个例外:它看不到胖JAR中的类。)

<?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>1.8</java.version>
              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        </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>

    <dependency>
      <groupId>EAB.ActiveTeam.Domain</groupId>
      <artifactId>EAB.ActiveTeam.Domain</artifactId>
      <version>1.0-SNAPSHOT</version>
      <scope>system</scope>
      <systemPath>${basedir}/../libs/EAB.ActiveTeam.Domain-1.0-SNAPSHOT.jar</systemPath>
    </dependency>

    <dependency>
      <groupId>EAB.ActiveTeam.Storage</groupId>
      <artifactId>EAB.ActiveTeam.Storage</artifactId>
      <version>1.0-SNAPSHOT</version>
      <scope>system</scope>
      <systemPath>${basedir}/../libs/EAB.ActiveTeam.Storage-1.0-SNAPSHOT.jar</systemPath>
    </dependency>

      <dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-batch</artifactId>
  </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>


    <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        </dependency>

        </dependencies>

        <build>
            <plugins>
          <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <configuration>
            <mainClass>EAB.ActiveTeam.Exporter.App</mainClass>
          </configuration>
            <executions>
              <execution>
                <id>repackage</id>
                <goals>
                  <goal>repackage</goal>
                </goals>
                <configuration>
                  <classifier>exec</classifier>
                </configuration>
              </execution>
            </executions>
          </plugin>
            </plugins>
        </build>
    </project>
  ask by Anas Tina translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...