"spring war" should copy resources to WEB-INF/classes
Closes gh-6351
This commit is contained in:
committed by
Stephane Nicoll
parent
07690bab25
commit
d07f689446
@@ -17,7 +17,6 @@
|
||||
package org.springframework.boot.cli.command.archive;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -73,6 +72,7 @@ import org.springframework.util.Assert;
|
||||
* @author Andy Wilkinson
|
||||
* @author Phillip Webb
|
||||
* @author Andrey Stolyarov
|
||||
* @author Henri Kerola
|
||||
*/
|
||||
abstract class ArchiveCommand extends OptionParsingCommand {
|
||||
|
||||
@@ -93,7 +93,7 @@ abstract class ArchiveCommand extends OptionParsingCommand {
|
||||
|
||||
private final String type;
|
||||
|
||||
private final Layout layout;
|
||||
protected final Layout layout;
|
||||
|
||||
private OptionSpec<String> includeOption;
|
||||
|
||||
@@ -278,13 +278,15 @@ 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 abstract void writeClasspathEntry(JarWriter writer,
|
||||
MatchedResource entry) throws IOException;
|
||||
|
||||
protected abstract LibraryScope getLibraryScope(File file);
|
||||
|
||||
}
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
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;
|
||||
import org.springframework.boot.loader.tools.JarWriter;
|
||||
import org.springframework.boot.loader.tools.Layouts;
|
||||
import org.springframework.boot.loader.tools.LibraryScope;
|
||||
|
||||
@@ -27,6 +30,7 @@ import org.springframework.boot.loader.tools.LibraryScope;
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @author Phillip Webb
|
||||
* @author Henri Kerola
|
||||
*/
|
||||
public class JarCommand extends ArchiveCommand {
|
||||
|
||||
@@ -46,6 +50,13 @@ public class JarCommand extends ArchiveCommand {
|
||||
return LibraryScope.COMPILE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeClasspathEntry(JarWriter writer,
|
||||
ResourceMatcher.MatchedResource entry) throws IOException {
|
||||
writer.writeEntry(entry.getName(),
|
||||
new FileInputStream(entry.getFile()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,12 @@ public class WarCommand extends ArchiveCommand {
|
||||
super.addCliClasses(writer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeClasspathEntry(JarWriter writer,
|
||||
ResourceMatcher.MatchedResource entry) throws IOException {
|
||||
writer.writeEntry(this.layout.getClassesLocation() + entry.getName(),
|
||||
new FileInputStream(entry.getFile()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user