From e8d476dbcad0623ddecb25c0ea071bd456f9c0a2 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 29 Nov 2016 11:28:14 +0100 Subject: [PATCH] Fix use of `forceCreation` flag in `maven-jar-plugin` --- spring-boot-docs/src/main/asciidoc/howto.adoc | 22 +++++-------------- .../spring-boot-sample-profile/pom.xml | 18 ++------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-docs/src/main/asciidoc/howto.adoc index 2b12739c39..775f0a3de7 100644 --- a/spring-boot-docs/src/main/asciidoc/howto.adoc +++ b/spring-boot-docs/src/main/asciidoc/howto.adoc @@ -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: org.springframework.boot spring-boot-maven-plugin - - exec - maven-jar-plugin - exec + lib package jar - exec - - - - package - - jar - - - - true + lib application.yml diff --git a/spring-boot-samples/spring-boot-sample-profile/pom.xml b/spring-boot-samples/spring-boot-sample-profile/pom.xml index 97d022bceb..2bc148dc25 100644 --- a/spring-boot-samples/spring-boot-sample-profile/pom.xml +++ b/spring-boot-samples/spring-boot-sample-profile/pom.xml @@ -34,31 +34,17 @@ org.springframework.boot spring-boot-maven-plugin - - exec - maven-jar-plugin - exec - package + lib jar - exec - - - - package - - jar - - - - true + lib application.yml