mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
[bs-52] Add configuration for trad sample running as war
The launcher project is used to run a war file. Not working yet for me anyway. [#48386505] [bs-52] Support for running "traditional" webapps in place
This commit is contained in:
parent
3c34326208
commit
e98368e3e6
@ -8,12 +8,4 @@
|
||||
</parent>
|
||||
<artifactId>spring-bootstrap-launcher</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<type>maven-plugin</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -26,6 +26,7 @@ import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.springframework.bootstrap.launcher.jar.RandomAccessJarFile;
|
||||
|
||||
@ -37,6 +38,8 @@ import org.springframework.bootstrap.launcher.jar.RandomAccessJarFile;
|
||||
*/
|
||||
public abstract class Launcher {
|
||||
|
||||
private Logger logger = Logger.getLogger(Launcher.class.getName());
|
||||
|
||||
/**
|
||||
* The main runner class. This must be loaded by the created ClassLoader so cannot be
|
||||
* directly referenced.
|
||||
@ -93,10 +96,12 @@ public abstract class Launcher {
|
||||
Enumeration<JarEntry> jarEntries = jarFile.entries();
|
||||
while (jarEntries.hasMoreElements()) {
|
||||
JarEntry jarEntry = jarEntries.nextElement();
|
||||
this.logger.fine("Adding: " + jarEntry.getName());
|
||||
if (isNestedJarFile(jarEntry)) {
|
||||
lib.add(jarFile.getNestedJarFile(jarEntry));
|
||||
}
|
||||
}
|
||||
this.logger.fine("Done");
|
||||
postProcessLib(jarFile, lib);
|
||||
ClassLoader classLoader = createClassLoader(lib);
|
||||
launch(args, jarFile, classLoader);
|
||||
|
@ -1,4 +1,5 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.bootstrap</groupId>
|
||||
@ -85,7 +86,7 @@
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<includePluginDependencies>true</includePluginDependencies>
|
||||
<mainClass>${start-class}</mainClass>
|
||||
<mainClass>${start-class}</mainClass>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@ -114,9 +115,52 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>org.springframework.bootstrap.launcher.WarLauncher</mainClass>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Start-Class>org.springframework.bootstrap.sample.trad.TradBootstrapApplication</Start-Class>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-bootstrap-launcher</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<includeScope>provided</includeScope>
|
||||
<outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/lib-provided</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user