0

I have a spring boot application based on maven and has several modules. I do use a spring-boot-maven-plugin, however, this plugin is only used on one of the modules. Even though the individual jar files for each modules are pretty small, the executable produced by the main module where I use this plugin with "repackage" goal is pretty large (About 750 MB).

I expanded the jar file that is created and was a little surprised to see that that it has bundled the jar files for several operating systems such as windows, linux, android etc.

If you see the opncsv jar file in the screenshot below, it appears it has bundled those jars for 13 different Operation systems !!

I understand that the executable created this way will be runnable in cross platforms, but just wondering if there is a way to configure this executable creation so that it only packages for certain OS only such as linux where I am running this app on.

The large executable just seems like an overkill in my situation.

enter image description here

Here is the plugin

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                    <configuration>
                        <classifier>exec</classifier>
                        <mainClass>org.blabla.products.webapp.Application</mainClass>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Here are the dependency versions of different jars that i am using.

<properties>
    <java.version>1.8</java.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <mysql-connector-java.version>5.1.40</mysql-connector-java.version>

    <!--CHECKED FOR CURRENCY AND UPGRADED AS NEEDED ON 1/27/2019-->
    <findbugs-maven-plugin.version>3.0.5</findbugs-maven-plugin.version>
    <jacoco-maven-plugin.version>0.8.2</jacoco-maven-plugin.version>
    <springfox-swagger2.version>2.9.2</springfox-swagger2.version>
    <org.jsoup.version>1.11.3</org.jsoup.version>
    <opencsv.version>4.4</opencsv.version>
    <httpclient.version>4.5.6</httpclient.version>
    <dl4j.version>1.0.0-beta3</dl4j.version>
    <spring-web.version>5.1.4.RELEASE</spring-web.version>
    <gson.version>2.8.5</gson.version>
    <ehcache.version>3.6.3</ehcache.version>
    <guava.version>27.0.1-jre</guava.version>
    <thymeleaf-extras-springsecurity4.version>3.0.4.RELEASE</thymeleaf-extras-springsecurity4.version>

</properties>
Kushal Paudyal
  • 3,571
  • 4
  • 22
  • 30
  • will this help? https://www.baeldung.com/executable-jar-with-maven – arjayosma Jan 31 '19 at 02:28
  • 1
    If you are targeting some OS' only, then as next step you need to filter out dependenices which do not work on targeted OS'. This way atleast you will have less sized jar. This task is laborious and research based. – The Mighty Programmer Jan 31 '19 at 04:27

1 Answers1

0

I guess you can try to exclude it with maven. This was already answered here.

jojo_Berlin
  • 673
  • 1
  • 4
  • 19