mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
[bs-232] Use "jar" packaging instead of custom "executable-jar"
[Fixes #53376257]
This commit is contained in:
parent
4ce6b64dce
commit
6c3fd2b2d0
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,3 +13,4 @@ target
|
||||
.springBeans
|
||||
dependency-reduced-pom.xml
|
||||
build.log
|
||||
_site/
|
||||
|
@ -99,7 +99,7 @@
|
||||
<plugin>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<configuration>
|
||||
<goalPrefix>configurator</goalPrefix>
|
||||
<goalPrefix>spring</goalPrefix>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -3,9 +3,9 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.zero.maven.it</groupId>
|
||||
<artifactId>executable-jar</artifactId>
|
||||
<artifactId>jar</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<packaging>executable-jar</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@ -13,6 +13,13 @@
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>package</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
@ -2,6 +2,6 @@ import java.io.*;
|
||||
import org.springframework.maven.packaging.*;
|
||||
|
||||
Verify.verifyJar(
|
||||
new File( basedir, "target/executable-jar-0.0.1.BUILD-SNAPSHOT.jar" )
|
||||
new File( basedir, "target/jar-0.0.1.BUILD-SNAPSHOT.jar" )
|
||||
);
|
||||
|
@ -3,9 +3,9 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.zero.maven.it</groupId>
|
||||
<artifactId>executable-war</artifactId>
|
||||
<artifactId>war</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<packaging>executable-war</packaging>
|
||||
<packaging>war</packaging>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@ -13,6 +13,21 @@
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>package</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
@ -2,6 +2,6 @@ import java.io.*;
|
||||
import org.springframework.maven.packaging.*;
|
||||
|
||||
Verify.verifyWar(
|
||||
new File( basedir, "target/executable-war-0.0.1.BUILD-SNAPSHOT.war" )
|
||||
new File( basedir, "target/war-0.0.1.BUILD-SNAPSHOT.war" )
|
||||
);
|
||||
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2012-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.maven.packaging;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public interface ArchiveHelper {
|
||||
|
||||
/**
|
||||
* Returns the destination of an {@link Artifact}.
|
||||
* @param artifact the artifact
|
||||
* @return the destination or {@code null} to exclude
|
||||
*/
|
||||
String getArtifactDestination(Artifact artifact);
|
||||
|
||||
/**
|
||||
* Returns the launcher class that will be used.
|
||||
*/
|
||||
String getLauncherClass();
|
||||
|
||||
}
|
@ -17,6 +17,8 @@
|
||||
package org.springframework.maven.packaging;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
@ -30,7 +32,10 @@ import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugins.annotations.Component;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.plugins.annotations.ResolutionScope;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.MavenProjectHelper;
|
||||
import org.codehaus.plexus.archiver.Archiver;
|
||||
@ -38,6 +43,7 @@ import org.codehaus.plexus.archiver.jar.JarArchiver;
|
||||
import org.codehaus.plexus.archiver.zip.ZipEntry;
|
||||
import org.codehaus.plexus.archiver.zip.ZipFile;
|
||||
import org.codehaus.plexus.archiver.zip.ZipResource;
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
import org.sonatype.aether.RepositorySystem;
|
||||
import org.sonatype.aether.RepositorySystemSession;
|
||||
import org.sonatype.aether.repository.RemoteRepository;
|
||||
@ -52,11 +58,8 @@ import org.sonatype.aether.util.artifact.DefaultArtifact;
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
|
||||
|
||||
private static final String[] DEFAULT_EXCLUDES = new String[] { "**/package.html" };
|
||||
|
||||
private static final String[] DEFAULT_INCLUDES = new String[] { "**/**" };
|
||||
@Mojo(name = "package", defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
|
||||
public class ExecutableArchiveMojo extends AbstractMojo {
|
||||
|
||||
private static final String MAIN_CLASS_ATTRIBUTE = "Main-Class";
|
||||
|
||||
@ -113,26 +116,12 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
|
||||
|
||||
/**
|
||||
* Classifier to add to the artifact generated. If given, the artifact will be
|
||||
* attached. If this is not given,it will merely be written to the output directory
|
||||
* attached. If this is not given, it will merely be written to the output directory
|
||||
* according to the finalName.
|
||||
*/
|
||||
@Parameter
|
||||
private String classifier;
|
||||
|
||||
/**
|
||||
* List of files to include. Specified as fileset patterns which are relative to the
|
||||
* input directory whose contents is being packaged into the archive.
|
||||
*/
|
||||
@Parameter
|
||||
private String[] includes;
|
||||
|
||||
/**
|
||||
* List of files to exclude. Specified as fileset patterns which are relative to the
|
||||
* input directory whose contents is being packaged into the archive.
|
||||
*/
|
||||
@Parameter
|
||||
private String[] excludes;
|
||||
|
||||
/**
|
||||
* Directory containing the classes and resource files that should be packaged into
|
||||
* the archive.
|
||||
@ -151,7 +140,7 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
|
||||
/**
|
||||
* Whether creating the archive should be forced.
|
||||
*/
|
||||
@Parameter(property = "archive.forceCreation", defaultValue = "false")
|
||||
@Parameter(property = "archive.forceCreation", defaultValue = "true")
|
||||
private boolean forceCreation;
|
||||
|
||||
/**
|
||||
@ -160,27 +149,9 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
|
||||
@Parameter(defaultValue = "${repositorySystemSession}", readonly = true)
|
||||
private RepositorySystemSession repositorySystemSession;
|
||||
|
||||
/**
|
||||
* Returns the type as defined in plexus components.xml
|
||||
*/
|
||||
protected abstract String getType();
|
||||
private ExecutableJarHelper jarHelper = new ExecutableJarHelper();
|
||||
|
||||
/**
|
||||
* Returns the file extension for the archive (e.g. 'jar').
|
||||
*/
|
||||
protected abstract String getExtension();
|
||||
|
||||
/**
|
||||
* Returns the destination of an {@link Artifact}.
|
||||
* @param artifact the artifact
|
||||
* @return the destination or {@code null} to exclude
|
||||
*/
|
||||
protected abstract String getArtifactDestination(Artifact artifact);
|
||||
|
||||
/**
|
||||
* Returns the launcher class that will be used.
|
||||
*/
|
||||
protected abstract String getLauncherClass();
|
||||
private ExecutableWarHelper warHelper = new ExecutableWarHelper();
|
||||
|
||||
@Override
|
||||
public void execute() throws MojoExecutionException, MojoFailureException {
|
||||
@ -189,11 +160,24 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
|
||||
this.project.getArtifact().setFile(archiveFile);
|
||||
}
|
||||
else {
|
||||
getLog().info(
|
||||
"Attaching archive: " + archiveFile + ", with classifier: "
|
||||
+ this.classifier);
|
||||
this.projectHelper.attachArtifact(this.project, getType(), this.classifier,
|
||||
archiveFile);
|
||||
}
|
||||
}
|
||||
|
||||
private ArchiveHelper getArchiveHelper() throws MojoExecutionException {
|
||||
if (getType().equals("jar")) {
|
||||
return this.jarHelper;
|
||||
}
|
||||
if (getType().equals("war")) {
|
||||
return this.warHelper;
|
||||
}
|
||||
throw new MojoExecutionException("Unsupported packaging type: " + getType());
|
||||
}
|
||||
|
||||
private File createArchive() throws MojoExecutionException {
|
||||
File archiveFile = getTargetFile();
|
||||
MavenArchiver archiver = new MavenArchiver();
|
||||
@ -204,7 +188,8 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
|
||||
archiver.getArchiver().setRecompressAddedZips(false);
|
||||
|
||||
try {
|
||||
addContent(archiver);
|
||||
getLog().info("Modifying archive: " + archiveFile);
|
||||
copyContent(archiver, this.project.getArtifact().getFile());
|
||||
addLibs(archiver);
|
||||
ZipFile zipFile = addLauncherClasses(archiver);
|
||||
try {
|
||||
@ -220,6 +205,37 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
|
||||
}
|
||||
}
|
||||
|
||||
private String getType() {
|
||||
return this.project.getPackaging();
|
||||
}
|
||||
|
||||
private String getExtension() {
|
||||
return this.project.getPackaging();
|
||||
}
|
||||
|
||||
private void copyContent(MavenArchiver archiver, File file) throws IOException {
|
||||
|
||||
FileInputStream input = new FileInputStream(file);
|
||||
File original = new File(this.outputDirectory, "original.jar");
|
||||
FileOutputStream output = new FileOutputStream(original);
|
||||
IOUtil.copy(input, output, 2048);
|
||||
input.close();
|
||||
output.close();
|
||||
|
||||
ZipFile zipFile = new ZipFile(original);
|
||||
Enumeration<? extends ZipEntry> entries = zipFile.getEntries();
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry entry = entries.nextElement();
|
||||
// TODO: maybe merge manifest instead of skipping it?
|
||||
if (!entry.isDirectory()
|
||||
&& !entry.getName().toUpperCase().equals("/META-INF/MANIFEST.MF")) {
|
||||
ZipResource zipResource = new ZipResource(zipFile, entry);
|
||||
archiver.getArchiver().addResource(zipResource, entry.getName(), -1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private File getTargetFile() {
|
||||
String classifier = (this.classifier == null ? "" : this.classifier.trim());
|
||||
if (classifier.length() > 0 && !classifier.startsWith("-")) {
|
||||
@ -242,40 +258,18 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
|
||||
throw new MojoExecutionException("Unable to find a suitable main class, "
|
||||
+ "please add a 'mainClass' property");
|
||||
}
|
||||
this.archive.getManifestEntries().put(MAIN_CLASS_ATTRIBUTE, getLauncherClass());
|
||||
this.archive.getManifestEntries().put(MAIN_CLASS_ATTRIBUTE,
|
||||
getArchiveHelper().getLauncherClass());
|
||||
this.archive.getManifestEntries().put(START_CLASS_ATTRIBUTE, mainClass);
|
||||
}
|
||||
|
||||
protected void addContent(MavenArchiver archiver) {
|
||||
if (this.classesDirectrory.exists()) {
|
||||
archiver.getArchiver().addDirectory(this.classesDirectrory,
|
||||
getClassesDirectoryPrefix(), getIncludes(), getExcludes());
|
||||
}
|
||||
}
|
||||
|
||||
protected String getClassesDirectoryPrefix() {
|
||||
return "";
|
||||
}
|
||||
|
||||
protected final String[] getIncludes() {
|
||||
if (this.includes != null && this.includes.length > 0) {
|
||||
return this.includes;
|
||||
}
|
||||
return DEFAULT_INCLUDES;
|
||||
}
|
||||
|
||||
protected final String[] getExcludes() {
|
||||
if (this.excludes != null && this.excludes.length > 0) {
|
||||
return this.excludes;
|
||||
}
|
||||
return DEFAULT_EXCLUDES;
|
||||
}
|
||||
|
||||
private void addLibs(MavenArchiver archiver) {
|
||||
private void addLibs(MavenArchiver archiver) throws MojoExecutionException {
|
||||
getLog().info("Adding dependencies");
|
||||
for (Artifact artifact : this.project.getArtifacts()) {
|
||||
if (artifact.getFile() != null) {
|
||||
String dir = getArtifactDestination(artifact);
|
||||
String dir = getArchiveHelper().getArtifactDestination(artifact);
|
||||
if (dir != null) {
|
||||
getLog().debug("Adding dependency: " + artifact);
|
||||
archiver.getArchiver().addFile(artifact.getFile(),
|
||||
dir + artifact.getFile().getName());
|
||||
}
|
||||
@ -285,6 +279,7 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
|
||||
|
||||
private ZipFile addLauncherClasses(MavenArchiver archiver)
|
||||
throws MojoExecutionException {
|
||||
getLog().info("Adding launcher classes");
|
||||
try {
|
||||
List<RemoteRepository> repositories = new ArrayList<RemoteRepository>();
|
||||
repositories.addAll(this.project.getRemotePluginRepositories());
|
@ -21,33 +21,19 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.ResolutionScope;
|
||||
|
||||
/**
|
||||
* Build an executable JAR file.
|
||||
* Help build an executable JAR file.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
@Mojo(name = "executable-jar", defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
|
||||
public class ExecutableJarMojo extends AbstractExecutableArchiveMojo {
|
||||
public class ExecutableJarHelper implements ArchiveHelper {
|
||||
|
||||
private static final Set<String> LIB_SCOPES = new HashSet<String>(Arrays.asList(
|
||||
"compile", "runtime", "provided"));
|
||||
|
||||
@Override
|
||||
protected String getType() {
|
||||
return "executable-jar";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getExtension() {
|
||||
return "jar";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArtifactDestination(Artifact artifact) {
|
||||
public String getArtifactDestination(Artifact artifact) {
|
||||
if (LIB_SCOPES.contains(artifact.getScope())) {
|
||||
return "lib/";
|
||||
}
|
||||
@ -55,7 +41,7 @@ public class ExecutableJarMojo extends AbstractExecutableArchiveMojo {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLauncherClass() {
|
||||
public String getLauncherClass() {
|
||||
return "org.springframework.launcher.JarLauncher";
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2012-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.maven.packaging;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
||||
/**
|
||||
* Build an executable WAR file.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
public class ExecutableWarHelper implements ArchiveHelper {
|
||||
|
||||
private static final Map<String, String> SCOPE_DESTINATIONS;
|
||||
static {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("compile", "WEB-INF/lib/");
|
||||
map.put("runtime", "WEB-INF/lib/");
|
||||
map.put("provided", "WEB-INF/lib-provided/");
|
||||
SCOPE_DESTINATIONS = Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArtifactDestination(Artifact artifact) {
|
||||
return SCOPE_DESTINATIONS.get(artifact.getScope());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLauncherClass() {
|
||||
return "org.springframework.launcher.WarLauncher";
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.maven.packaging;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.archiver.MavenArchiver;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.plugins.annotations.ResolutionScope;
|
||||
|
||||
/**
|
||||
* Build an executable WAR file.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
@Mojo(name = "executable-war", defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
|
||||
public class ExecutableWarMojo extends AbstractExecutableArchiveMojo {
|
||||
|
||||
private static final Map<String, String> SCOPE_DESTINATIONS;
|
||||
static {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("compile", "WEB-INF/lib/");
|
||||
map.put("runtime", "WEB-INF/lib/");
|
||||
map.put("provided", "WEB-INF/lib-provided/");
|
||||
SCOPE_DESTINATIONS = Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* Single directory for extra files to include in the WAR. This is where you place
|
||||
* your JSP files.
|
||||
*/
|
||||
@Parameter(defaultValue = "${basedir}/src/main/webapp", required = true)
|
||||
private File warSourceDirectory;
|
||||
|
||||
@Override
|
||||
protected String getType() {
|
||||
return "executable-war";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getExtension() {
|
||||
return "war";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArtifactDestination(Artifact artifact) {
|
||||
return SCOPE_DESTINATIONS.get(artifact.getScope());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getClassesDirectoryPrefix() {
|
||||
return "WEB-INF/classes/";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addContent(MavenArchiver archiver) {
|
||||
super.addContent(archiver);
|
||||
if (this.warSourceDirectory.exists()) {
|
||||
archiver.getArchiver().addDirectory(this.warSourceDirectory, getIncludes(),
|
||||
getExcludes());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLauncherClass() {
|
||||
return "org.springframework.launcher.WarLauncher";
|
||||
}
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
<component-set>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
|
||||
<role-hint>executable-war</role-hint>
|
||||
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler
|
||||
</implementation>
|
||||
<configuration>
|
||||
<type>executable-jar</type>
|
||||
<extension>jar</extension>
|
||||
<language>java</language>
|
||||
<addedToClasspath>true</addedToClasspath>
|
||||
</configuration>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
|
||||
<role-hint>executable-jar</role-hint>
|
||||
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
|
||||
</implementation>
|
||||
<configuration>
|
||||
<lifecycles>
|
||||
<lifecycle>
|
||||
<id>default</id>
|
||||
<phases>
|
||||
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
|
||||
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
|
||||
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
|
||||
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
|
||||
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
|
||||
<package>org.springframework.zero:spring-package-maven-plugin:executable-jar</package>
|
||||
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
|
||||
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
|
||||
</phases>
|
||||
</lifecycle>
|
||||
</lifecycles>
|
||||
</configuration>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
|
||||
<role-hint>executable-war</role-hint>
|
||||
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler
|
||||
</implementation>
|
||||
<configuration>
|
||||
<type>executable-war</type>
|
||||
<extension>war</extension>
|
||||
<language>java</language>
|
||||
<addedToClasspath>true</addedToClasspath>
|
||||
</configuration>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
|
||||
<role-hint>executable-war</role-hint>
|
||||
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
|
||||
</implementation>
|
||||
<configuration>
|
||||
<lifecycles>
|
||||
<lifecycle>
|
||||
<id>default</id>
|
||||
<phases>
|
||||
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
|
||||
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
|
||||
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
|
||||
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
|
||||
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
|
||||
<package>org.springframework.zero:spring-package-maven-plugin:executable-war</package>
|
||||
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
|
||||
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
|
||||
</phases>
|
||||
</lifecycle>
|
||||
</lifecycles>
|
||||
</configuration>
|
||||
</component>
|
||||
</components>
|
||||
</component-set>
|
@ -200,6 +200,20 @@
|
||||
<version>2.0</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.springframework.zero</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${spring.zero.version}</version>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>package</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Support shade packaging -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -26,4 +26,23 @@
|
||||
<module>spring-zero-sample-web-ui</module>
|
||||
<module>spring-zero-sample-xml</module>
|
||||
</modules>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>package</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-zero-sample-actuator-ui</artifactId>
|
||||
<packaging>executable-jar</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
@ -41,8 +41,6 @@
|
||||
<plugin>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-zero-sample-actuator</artifactId>
|
||||
<packaging>executable-jar</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
@ -44,8 +44,6 @@
|
||||
<plugin>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-zero-sample-batch</artifactId>
|
||||
<packaging>executable-jar</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
@ -24,8 +24,6 @@
|
||||
<plugin>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-zero-sample-data-jpa</artifactId>
|
||||
<packaging>executable-jar</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
@ -34,7 +34,6 @@
|
||||
<plugin>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-zero-sample-integration</artifactId>
|
||||
<packaging>executable-jar</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
@ -24,8 +24,6 @@
|
||||
<plugin>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-zero-sample-jetty</artifactId>
|
||||
<packaging>executable-jar</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
@ -43,8 +43,6 @@
|
||||
<plugin>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-zero-sample-profile</artifactId>
|
||||
<packaging>executable-jar</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
@ -29,8 +29,6 @@
|
||||
<plugin>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-zero-sample-simple</artifactId>
|
||||
<packaging>executable-jar</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
@ -24,8 +24,6 @@
|
||||
<plugin>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-zero-sample-tomcat</artifactId>
|
||||
<packaging>executable-jar</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
@ -36,8 +36,6 @@
|
||||
<plugin>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-zero-sample-traditional</artifactId>
|
||||
<packaging>executable-war</packaging>
|
||||
<packaging>war</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
<m2eclipse.wtp.contextRoot>/</m2eclipse.wtp.contextRoot>
|
||||
@ -45,8 +45,6 @@
|
||||
<plugin>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-zero-sample-web-ui</artifactId>
|
||||
<packaging>executable-jar</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
@ -32,8 +32,6 @@
|
||||
<plugin>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-zero-sample-xml</artifactId>
|
||||
<packaging>executable-jar</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
@ -24,8 +24,6 @@
|
||||
<plugin>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>spring-package-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
Loading…
Reference in New Issue
Block a user