drunkenfist
drunkenfist

Reputation: 3036

Having application as standalone as well as dependency in Spring Boot 1.5

I have a spring boot application (application A) which I deploy as a standalone fat jar. But I also have another spring boot application (application B) which depends on app A. Now, when I try to import some classes from app A into app B, I get a package not found exception. However, IDEs such as Intellij / Eclipse are able to find the package properly. This used to work earlier when I was using Spring Boot 1.3.x. However, after upgrading to 1.5.x, it started failing.

On inspecting the actual jar files, I realized that with Spring Boot 1.3.3, all the classes were under the main package. However, with Spring Boot 1.5.x, they are under BOOT-INF folder. And in the META-INF/Manifest.MF file, we have properties which point to the BOOT-INF folder. And because of this, when I try to import the classes, it is not able to find the packages, because they are under BOOT-INF.

So how else can I have a project standalone application as well as have it as a dependency for another project?

Upvotes: 0

Views: 128

Answers (1)

drunkenfist
drunkenfist

Reputation: 3036

Seems to be a known issue with Spring Boot 1.4.x (https://github.com/spring-projects/spring-boot/issues/6792#issuecomment-243564648). Updating my pom file in application A to have the following fixed it:

<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>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Upvotes: 2

Related Questions