|
18 | 18 |
|
19 | 19 | import java.io.File;
|
20 | 20 | import java.io.IOException;
|
| 21 | +import java.util.ArrayList; |
21 | 22 | import java.util.List;
|
22 | 23 | import java.util.Properties;
|
23 | 24 | import java.util.Set;
|
|
37 | 38 | import org.apache.maven.project.MavenProject;
|
38 | 39 | import org.apache.maven.project.MavenProjectHelper;
|
39 | 40 | import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
|
| 41 | +import org.apache.maven.shared.artifact.filter.collection.ScopeFilter; |
40 | 42 |
|
41 | 43 | import org.springframework.boot.loader.tools.DefaultLaunchScript;
|
42 | 44 | import org.springframework.boot.loader.tools.LaunchScript;
|
@@ -171,6 +173,13 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
|
171 | 173 | @Parameter(defaultValue = "false")
|
172 | 174 | private boolean excludeDevtools;
|
173 | 175 |
|
| 176 | + /** |
| 177 | + * Include system scoped dependencies. |
| 178 | + * @since 1.4 |
| 179 | + */ |
| 180 | + @Parameter(defaultValue = "false") |
| 181 | + public boolean includeSystemScope; |
| 182 | + |
174 | 183 | @Override
|
175 | 184 | public void execute() throws MojoExecutionException, MojoFailureException {
|
176 | 185 | if (this.project.getPackaging().equals("pom")) {
|
@@ -225,14 +234,18 @@ private Repackager getRepackager(File source) {
|
225 | 234 | }
|
226 | 235 |
|
227 | 236 | private ArtifactsFilter[] getAdditionalFilters() {
|
| 237 | + List<ArtifactsFilter> filters = new ArrayList<ArtifactsFilter>(); |
228 | 238 | if (this.excludeDevtools) {
|
229 | 239 | Exclude exclude = new Exclude();
|
230 | 240 | exclude.setGroupId("org.springframework.boot");
|
231 | 241 | exclude.setArtifactId("spring-boot-devtools");
|
232 | 242 | ExcludeFilter filter = new ExcludeFilter(exclude);
|
233 |
| - return new ArtifactsFilter[] { filter }; |
| 243 | + filters.add(filter); |
| 244 | + } |
| 245 | + if (!this.includeSystemScope) { |
| 246 | + filters.add(new ScopeFilter(null, Artifact.SCOPE_SYSTEM)); |
234 | 247 | }
|
235 |
| - return new ArtifactsFilter[] {}; |
| 248 | + return filters.toArray(new ArtifactsFilter[filters.size()]); |
236 | 249 | }
|
237 | 250 |
|
238 | 251 | private LaunchScript getLaunchScript() throws IOException {
|
|
0 commit comments