mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-15 01:07:30 +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>
|
</parent>
|
||||||
<artifactId>spring-bootstrap-launcher</artifactId>
|
<artifactId>spring-bootstrap-launcher</artifactId>
|
||||||
<packaging>jar</packaging>
|
<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>
|
</project>
|
||||||
|
@ -26,6 +26,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.springframework.bootstrap.launcher.jar.RandomAccessJarFile;
|
import org.springframework.bootstrap.launcher.jar.RandomAccessJarFile;
|
||||||
|
|
||||||
@ -37,6 +38,8 @@ import org.springframework.bootstrap.launcher.jar.RandomAccessJarFile;
|
|||||||
*/
|
*/
|
||||||
public abstract class Launcher {
|
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
|
* The main runner class. This must be loaded by the created ClassLoader so cannot be
|
||||||
* directly referenced.
|
* directly referenced.
|
||||||
@ -93,10 +96,12 @@ public abstract class Launcher {
|
|||||||
Enumeration<JarEntry> jarEntries = jarFile.entries();
|
Enumeration<JarEntry> jarEntries = jarFile.entries();
|
||||||
while (jarEntries.hasMoreElements()) {
|
while (jarEntries.hasMoreElements()) {
|
||||||
JarEntry jarEntry = jarEntries.nextElement();
|
JarEntry jarEntry = jarEntries.nextElement();
|
||||||
|
this.logger.fine("Adding: " + jarEntry.getName());
|
||||||
if (isNestedJarFile(jarEntry)) {
|
if (isNestedJarFile(jarEntry)) {
|
||||||
lib.add(jarFile.getNestedJarFile(jarEntry));
|
lib.add(jarFile.getNestedJarFile(jarEntry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.logger.fine("Done");
|
||||||
postProcessLib(jarFile, lib);
|
postProcessLib(jarFile, lib);
|
||||||
ClassLoader classLoader = createClassLoader(lib);
|
ClassLoader classLoader = createClassLoader(lib);
|
||||||
launch(args, jarFile, classLoader);
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.bootstrap</groupId>
|
<groupId>org.springframework.bootstrap</groupId>
|
||||||
@ -85,7 +86,7 @@
|
|||||||
<artifactId>exec-maven-plugin</artifactId>
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<includePluginDependencies>true</includePluginDependencies>
|
<includePluginDependencies>true</includePluginDependencies>
|
||||||
<mainClass>${start-class}</mainClass>
|
<mainClass>${start-class}</mainClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -114,9 +115,52 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
<configuration>
|
<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>
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</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>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user