Copies in the spring boot application

I have a spring boot application where during maven installation I want to create a jar and copy the dependencies to the lib folder. I am trying to use these two maven plugins that work fine in other maven projects but don't work in the spring boot application.

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <useDefaultManifestFile>true</useDefaultManifestFile> <archive> <manifest> <addClasspath>true</addClasspath> <mainClass>xxx.Main</mainClass> <classpathPrefix>lib/</classpathPrefix> </manifest> </archive> </configuration> </plugin> <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <phase>install</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> </configuration> </execution> </executions> </plugin> 

What happens is that the jar is created even if the maven-jar-plugin is omitted. And it does nothing with the maven-dependency plugin. Therefore, it almost ignores both of these plugins.

+5
source share
2 answers

I think you should try Spring boot + Gradle: Spring boot Gradle

In the build.gradle file, you can customize the build process and copy your dependencies to the lib folder using the gradle copy method.

0
source

I install the Spring Boot plugin after copy dependencies and work fine!

 <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> 

Notes: I empty the Maven repository to work!

0
source

All Articles