Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
e8d476db
Commit
e8d476db
authored
Nov 29, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix use of `forceCreation` flag in `maven-jar-plugin`
parent
fcb405eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
32 deletions
+8
-32
howto.adoc
spring-boot-docs/src/main/asciidoc/howto.adoc
+6
-16
pom.xml
spring-boot-samples/spring-boot-sample-profile/pom.xml
+2
-16
No files found.
spring-boot-docs/src/main/asciidoc/howto.adoc
View file @
e8d476db
...
...
@@ -2737,7 +2737,10 @@ Often if you have an executable and a non-executable jar as build products, the
version will have additional configuration files that are not needed in a library jar.
E.g. the `application.yml` configuration file might excluded from the non-executable JAR.
Here's how to do that in Maven:
The `maven-jar-plugin` used to expose a `forceCreation` attribute that allows you to
create the jar _again_ once the `repackage` goal has ran. Arguably, this was a bit fragile
anyway since it was relying on the order of plugin executions. In Maven, the executable
jar must be the main artifact and you can add a classified jar for the library:
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
----
...
...
@@ -2746,31 +2749,18 @@ Here's how to do that in Maven:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>exec</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
<execution>
<id>lib</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<!-- Need this to ensure application.yml is excluded -->
<forceCreation>true</forceCreation>
<classifier>lib</classifier>
<excludes>
<exclude>application.yml</exclude>
</excludes>
...
...
spring-boot-samples/spring-boot-sample-profile/pom.xml
View file @
e8d476db
...
...
@@ -34,31 +34,17 @@
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<classifier>
exec
</classifier>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-jar-plugin
</artifactId>
<executions>
<execution>
<id>
exec
</id>
<phase>
package
</phase>
<id>
lib
</id>
<goals>
<goal>
jar
</goal>
</goals>
<configuration>
<classifier>
exec
</classifier>
</configuration>
</execution>
<execution>
<phase>
package
</phase>
<goals>
<goal>
jar
</goal>
</goals>
<configuration>
<!-- Need this to ensure application.yml is excluded -->
<forceCreation>
true
</forceCreation>
<classifier>
lib
</classifier>
<excludes>
<exclude>
application.yml
</exclude>
</excludes>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment