Merge branch '1.5.x'

This commit is contained in:
Stephane Nicoll
2016-10-05 13:48:51 +02:00
8 changed files with 44 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 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.
@@ -73,6 +73,7 @@ import org.springframework.util.Assert;
* @author Andy Wilkinson
* @author Phillip Webb
* @author Andrey Stolyarov
* @author Henri Kerola
*/
abstract class ArchiveCommand extends OptionParsingCommand {
@@ -104,6 +105,10 @@ abstract class ArchiveCommand extends OptionParsingCommand {
this.layout = layout;
}
protected Layout getLayout() {
return this.layout;
}
@Override
protected void doOptions() {
this.includeOption = option("include",
@@ -278,13 +283,18 @@ abstract class ArchiveCommand extends OptionParsingCommand {
libraries.add(new Library(entry.getFile(), LibraryScope.COMPILE));
}
else {
writer.writeEntry(entry.getName(),
new FileInputStream(entry.getFile()));
writeClasspathEntry(writer, entry);
}
}
return libraries;
}
protected void writeClasspathEntry(JarWriter writer,
MatchedResource entry) throws IOException {
writer.writeEntry(entry.getName(),
new FileInputStream(entry.getFile()));
}
protected abstract LibraryScope getLibraryScope(File file);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 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.
@@ -17,6 +17,7 @@
package org.springframework.boot.cli.command.archive;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import org.springframework.boot.cli.command.Command;
@@ -29,6 +30,7 @@ import org.springframework.boot.loader.tools.LibraryScope;
*
* @author Andrey Stolyarov
* @author Phillip Webb
* @author Henri Kerola
* @since 1.3.0
*/
public class WarCommand extends ArchiveCommand {
@@ -61,6 +63,13 @@ public class WarCommand extends ArchiveCommand {
super.addCliClasses(writer);
}
@Override
protected void writeClasspathEntry(JarWriter writer,
ResourceMatcher.MatchedResource entry) throws IOException {
writer.writeEntry(getLayout().getClassesLocation() + entry.getName(),
new FileInputStream(entry.getFile()));
}
}
}