I have spring boot application where during maven install, I want it to create a jar and copy the dependencies into a lib folder. I am trying to use these two maven plugins that are working fine in other maven projects but doesn't work in a 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 is happening is that the jar gets created even if the maven-jar-plugin is omitted. And it doesn't do anything with the maven-dependency-plugin. So it pretty much ignores both these plugins.
I put 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 clean Maven repository to work!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With