Gunith D
Gunith D

Reputation: 1873

Spring Boot JAR doesn't contain classes in src folder

I was upgrading the Spring version of our project and I noticed that the src/ folder doesn't appear as classes when I open the file as an Archive. Instead all I found was an /org folder where I found Spring.

It actually looked like this, enter image description here

The strange thing was that we got the classes nicely before (as you would expect in JARs) in Spring 1.3.x.RELEASE

My pom.xml looks like this,

<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>1.5.3.RELEASE</version>
</parent>
<groupId>spring.mvn</groupId>
<artifactId>dummySpringMvn</artifactId>
<version>0.0.1-SNAPSHOT</version>

<properties>
    <java.version>1.8</java.version>

    <mvn.compiler.version>3.3</mvn.compiler.version>

    <spring.framework.version>4.3.8.RELEASE</spring.framework.version>
    <start-class>dummySpringMvn.main.Main</start-class>

</properties>

<packaging>jar</packaging>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <mainClass>${start-class}</mainClass>
                <layout>ZIP</layout>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Upvotes: 0

Views: 3293

Answers (1)

Gunith D
Gunith D

Reputation: 1873

I found my classes in BOOT-INF folder!

enter image description here

This I found thanks for the article https://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html.

Furthermore, the project I upgraded was a library to another project. I was able to keep the folder of JARs as conventional creating the JAR without invoking spring-boot-maven-plugin

Upvotes: 3

Related Questions