Import spring boot application into another project

So, I am trying to add a spring boot jar file as a dependency in another project (testing environment).

However, after it is added to pom and imported. Java import is not working properly. If I looked inside the jar, all packages are added:

BOOT-INF / classes.some.package.classname.class

There are also several spring packages for download, MANIFEST, etc. etc.

No, if I switch spring boot app build to just install and deploy a regular jar using spring-boot-maven-plugin

This is changing and everything is working fine. Unfortunately, this is not a solution for us, as we rely on an executable jar as part of our release process.

Can I build a deployment of both versions of the flag and use a classifier to define each?

thanks

+5
source share
1 answer

It turns out that this exact scenario can be achieved using spring-boot-maven-plugin.

Spring pom boot application:

<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>1.4.1.RELEASE</version> <executions> <execution> <goals> <goal>repackage</goal> </goals> <configuration> <classifier>exec</classifier> </configuration> </execution> </executions> ... </plugin> 

a project using the spring boot flag can add it as usual:

  <dependency> <groupId>com.springboot</groupId> <artifactId>app</artifactId> <version>1.0.0-SNAPSHOT</version> <scope>test</scope> </dependency> 

OR if you want to reference an executable jar

  <dependency> <groupId>com.springboot</groupId> <artifactId>app</artifactId> <version>1.0.0-SNAPSHOT</version> <scope>test</scope> <classifier>exec</classifier> </dependency> 
+9
source

Source: https://habr.com/ru/post/1259121/


All Articles