diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope-default/pom.xml b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope-default/pom.xml
new file mode 100644
index 00000000000..10229883bf3
--- /dev/null
+++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope-default/pom.xml
@@ -0,0 +1,59 @@
+
+
+ 4.0.0
+ org.springframework.boot.maven.it
+ jar-system-scope-default
+ 0.0.1.BUILD-SNAPSHOT
+
+ UTF-8
+
+
+
+
+ @project.groupId@
+ @project.artifactId@
+ @project.version@
+
+
+
+ repackage
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.4
+
+
+
+ Foo
+
+
+
+
+
+
+
+
+ org.springframework
+ spring-context
+ @spring.version@
+
+
+ javax.servlet
+ javax.servlet-api
+ @servlet-api.version@
+ provided
+
+
+ com.example
+ sample
+ 1.0.0
+ system
+ ${project.basedir}/sample-1.0.0.jar
+
+
+
diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope-default/src/main/java/org/test/SampleApplication.java b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope-default/src/main/java/org/test/SampleApplication.java
new file mode 100644
index 00000000000..e8784d4593d
--- /dev/null
+++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope-default/src/main/java/org/test/SampleApplication.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2012-2014 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.test;
+
+public class SampleApplication {
+
+ public static void main(String[] args) {
+ }
+
+}
diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope-default/verify.groovy b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope-default/verify.groovy
new file mode 100644
index 00000000000..aa22640dfd1
--- /dev/null
+++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope-default/verify.groovy
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2012-2014 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.*;
+import org.springframework.boot.maven.*;
+
+File f = new File( basedir, "target/jar-system-scope-default-0.0.1.BUILD-SNAPSHOT.jar");
+new Verify.JarArchiveVerification(f, Verify.SAMPLE_APP) {
+ @Override
+ protected void verifyZipEntries(Verify.ArchiveVerifier verifier) throws Exception {
+ super.verifyZipEntries(verifier)
+ verifier.assertHasNoEntryNameStartingWith("BOOT-INF/lib/sample-1.0.0.jar")
+ }
+}.verify();
diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope/pom.xml b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope/pom.xml
new file mode 100644
index 00000000000..04a99d4e39f
--- /dev/null
+++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope/pom.xml
@@ -0,0 +1,62 @@
+
+
+ 4.0.0
+ org.springframework.boot.maven.it
+ jar-system-scope
+ 0.0.1.BUILD-SNAPSHOT
+
+ UTF-8
+
+
+
+
+ @project.groupId@
+ @project.artifactId@
+ @project.version@
+
+
+
+ repackage
+
+
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.4
+
+
+
+ Foo
+
+
+
+
+
+
+
+
+ org.springframework
+ spring-context
+ @spring.version@
+
+
+ javax.servlet
+ javax.servlet-api
+ @servlet-api.version@
+ provided
+
+
+ com.example
+ sample
+ 1.0.0
+ system
+ ${project.basedir}/sample-1.0.0.jar
+
+
+
diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope/src/main/java/org/test/SampleApplication.java b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope/src/main/java/org/test/SampleApplication.java
new file mode 100644
index 00000000000..e8784d4593d
--- /dev/null
+++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope/src/main/java/org/test/SampleApplication.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2012-2014 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.test;
+
+public class SampleApplication {
+
+ public static void main(String[] args) {
+ }
+
+}
diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope/verify.groovy b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope/verify.groovy
new file mode 100644
index 00000000000..534cdc7407b
--- /dev/null
+++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-system-scope/verify.groovy
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2012-2014 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.*;
+import org.springframework.boot.maven.*;
+
+File f = new File( basedir, "target/jar-system-scope-0.0.1.BUILD-SNAPSHOT.jar");
+new Verify.JarArchiveVerification(f, Verify.SAMPLE_APP) {
+ @Override
+ protected void verifyZipEntries(Verify.ArchiveVerifier verifier) throws Exception {
+ super.verifyZipEntries(verifier)
+ verifier.assertHasEntryNameStartingWith("BOOT-INF/lib/sample-1.0.0.jar")
+ }
+}.verify();
diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java
index 760c31fc326..3d478e7f652 100644
--- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java
+++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,6 +48,7 @@ public class ArtifactsLibraries implements Libraries {
scopes.put(Artifact.SCOPE_COMPILE, LibraryScope.COMPILE);
scopes.put(Artifact.SCOPE_RUNTIME, LibraryScope.RUNTIME);
scopes.put(Artifact.SCOPE_PROVIDED, LibraryScope.PROVIDED);
+ scopes.put(Artifact.SCOPE_SYSTEM, LibraryScope.PROVIDED);
SCOPES = Collections.unmodifiableMap(scopes);
}
diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java
index e2aa33d5463..f782692e28b 100644
--- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java
+++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java
@@ -18,6 +18,7 @@ package org.springframework.boot.maven;
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.Set;
@@ -37,6 +38,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
+import org.apache.maven.shared.artifact.filter.collection.ScopeFilter;
import org.springframework.boot.loader.tools.DefaultLaunchScript;
import org.springframework.boot.loader.tools.LaunchScript;
@@ -171,6 +173,13 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
@Parameter(defaultValue = "false")
private boolean excludeDevtools;
+ /**
+ * Include system scoped dependencies.
+ * @since 1.4
+ */
+ @Parameter(defaultValue = "false")
+ public boolean includeSystemScope;
+
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (this.project.getPackaging().equals("pom")) {
@@ -225,14 +234,18 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
}
private ArtifactsFilter[] getAdditionalFilters() {
+ List filters = new ArrayList();
if (this.excludeDevtools) {
Exclude exclude = new Exclude();
exclude.setGroupId("org.springframework.boot");
exclude.setArtifactId("spring-boot-devtools");
ExcludeFilter filter = new ExcludeFilter(exclude);
- return new ArtifactsFilter[] { filter };
+ filters.add(filter);
}
- return new ArtifactsFilter[] {};
+ if (!this.includeSystemScope) {
+ filters.add(new ScopeFilter(null, Artifact.SCOPE_SYSTEM));
+ }
+ return filters.toArray(new ArtifactsFilter[filters.size()]);
}
private LaunchScript getLaunchScript() throws IOException {