spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.9k stars 40.62k forks source link

Issue with Layertools in Spring Boot Project #42677

Open river-cell opened 1 day ago

river-cell commented 1 day ago

Hello,

I'm experiencing an issue with the layertools feature in my Spring Boot project. Below is the relevant section of my pom.xml for the Spring Boot Maven plugin:

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <layers>
            <enabled>true</enabled>
        </layers>
        <executable>false</executable>
    </configuration>
</plugin>

I'm using Spring Boot version 3.2.4.

While trying to list the layers using the following commands: java -Djarmode=tools -jar my_app.jar list-layers or java -Djarmode=layertools -jar my_app.jar list It is applicable also to other arguments f.e. extract

the application runs as if the -Djarmode options are not being applied, instead of listing the layers.

I have checked various resources and followed the recommended configurations, but I still face this issue.

Could you please assist me in resolving this?

philwebb commented 1 day ago

I'm afraid there's not enough information in this report to help you. Please start by upgrading to the latest 3.2.x version (3.2.10 at the time of writing this comment). If that doesn't work, please provide a sample application that reproduces the problem.

river-cell commented 2 hours ago

I saw that problem occurs because layers aren't generated in MANIFEST file, somehow I read that problem may be related to those plugins

           <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                        <compress>true</compress>
                        <index>false</index>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <useUniqueVersions>false</useUniqueVersions>
                            <mainClass>path.to.Launcher</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <layers>
                        <enabled>true</enabled>
                    </layers>
                </configuration>
            </plugin>