Browse Source
Prior to this commit, the Aether-based GrapeEngine was loaded in the same class loader as the rest of Boot. This led to Aether's and its dependencies' types polluting the application's class path. Most notably, this caused problems with logging as the logging framework could be permaturely initialized. This commit isolates AetherGrapeEngine, Aether and its dependencies into a separate class loader. This is done by customizing the packaging of the CLI's jar file with the internal directory housing all of the types that will be loaded by the separate class loader.pull/97/head
14 changed files with 342 additions and 165 deletions
@ -0,0 +1,175 @@
@@ -0,0 +1,175 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<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/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-parent</artifactId> |
||||
<version>0.5.0.BUILD-SNAPSHOT</version> |
||||
<relativePath>../spring-boot-parent</relativePath> |
||||
</parent> |
||||
<artifactId>spring-boot-cli-grape</artifactId> |
||||
<packaging>jar</packaging> |
||||
<properties> |
||||
<main.basedir>${basedir}/..</main.basedir> |
||||
<start-class>org.springframework.boot.cli.SpringCli</start-class> |
||||
</properties> |
||||
<dependencies> |
||||
<!-- Provided --> |
||||
<dependency> |
||||
<groupId>org.codehaus.groovy</groupId> |
||||
<artifactId>groovy</artifactId> |
||||
<scope>provided</scope> |
||||
</dependency> |
||||
<!-- Compile --> |
||||
<dependency> |
||||
<groupId>commons-logging</groupId> |
||||
<artifactId>commons-logging</artifactId> |
||||
<version>1.1.3</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.apache.maven</groupId> |
||||
<artifactId>maven-aether-provider</artifactId> |
||||
<exclusions> |
||||
<exclusion> |
||||
<artifactId>org.eclipse.sisu.plexus</artifactId> |
||||
<groupId>org.eclipse.sisu</groupId> |
||||
</exclusion> |
||||
</exclusions> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.eclipse.aether</groupId> |
||||
<artifactId>aether-api</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.eclipse.aether</groupId> |
||||
<artifactId>aether-connector-basic</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.eclipse.aether</groupId> |
||||
<artifactId>aether-impl</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.eclipse.aether</groupId> |
||||
<artifactId>aether-spi</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.eclipse.aether</groupId> |
||||
<artifactId>aether-transport-file</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.eclipse.aether</groupId> |
||||
<artifactId>aether-transport-http</artifactId> |
||||
<exclusions> |
||||
<exclusion> |
||||
<artifactId>jcl-over-slf4j</artifactId> |
||||
<groupId>org.slf4j</groupId> |
||||
</exclusion> |
||||
</exclusions> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.eclipse.aether</groupId> |
||||
<artifactId>aether-util</artifactId> |
||||
</dependency> |
||||
<!-- Test --> |
||||
<dependency> |
||||
<groupId>junit</groupId> |
||||
<artifactId>junit</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
</dependencies> |
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<artifactId>maven-surefire-plugin</artifactId> |
||||
<configuration> |
||||
<classpathDependencyExcludes> |
||||
<classpathDependencyExcludes>org.springframework:spring-core</classpathDependencyExcludes> |
||||
<classpathDependencyExcludes>org.springframework:spring-beans</classpathDependencyExcludes> |
||||
<classpathDependencyExcludes>org.springframework:spring-aop</classpathDependencyExcludes> |
||||
<classpathDependencyExcludes>org.springframework:spring-tx</classpathDependencyExcludes> |
||||
<classpathDependencyExcludes>org.springframework:spring-expression</classpathDependencyExcludes> |
||||
<classpathDependencyExcludes>org.springframework:spring-context</classpathDependencyExcludes> |
||||
<classpathDependencyExcludes>org.springframework:spring-test</classpathDependencyExcludes> |
||||
<classpathDependencyExcludes>org.springframework.retry:spring-retry</classpathDependencyExcludes> |
||||
<classpathDependencyExcludes>org.springframework.integration:spring-integration-core</classpathDependencyExcludes> |
||||
<classpathDependencyExcludes>org.springframework.integration:spring-integration-dsl-groovy-core</classpathDependencyExcludes> |
||||
</classpathDependencyExcludes> |
||||
</configuration> |
||||
</plugin> |
||||
<plugin> |
||||
<artifactId>maven-shade-plugin</artifactId> |
||||
<configuration> |
||||
<filters> |
||||
<filter> |
||||
<artifact>*:*</artifact> |
||||
<excludes> |
||||
<exclude>META-INF/*.SF</exclude> |
||||
<exclude>META-INF/*.DSA</exclude> |
||||
<exclude>META-INF/*.RSA</exclude> |
||||
</excludes> |
||||
</filter> |
||||
</filters> |
||||
</configuration> |
||||
<executions> |
||||
<execution> |
||||
<phase>package</phase> |
||||
<goals> |
||||
<goal>shade</goal> |
||||
</goals> |
||||
<configuration> |
||||
<transformers> |
||||
<transformer |
||||
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> |
||||
<transformer |
||||
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> |
||||
<mainClass>${start-class}</mainClass> |
||||
</transformer> |
||||
</transformers> |
||||
<createDependencyReducedPom>false</createDependencyReducedPom> |
||||
</configuration> |
||||
</execution> |
||||
</executions> |
||||
</plugin> |
||||
</plugins> |
||||
<pluginManagement> |
||||
<plugins> |
||||
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> |
||||
<plugin> |
||||
<groupId>org.eclipse.m2e</groupId> |
||||
<artifactId>lifecycle-mapping</artifactId> |
||||
<version>1.0.0</version> |
||||
<configuration> |
||||
<lifecycleMappingMetadata> |
||||
<pluginExecutions> |
||||
<pluginExecution> |
||||
<pluginExecutionFilter> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-antrun-plugin</artifactId> |
||||
<versionRange>[1.7,)</versionRange> |
||||
<goals> |
||||
<goal>run</goal> |
||||
</goals> |
||||
</pluginExecutionFilter> |
||||
<action> |
||||
<execute/> |
||||
</action> |
||||
</pluginExecution> |
||||
</pluginExecutions> |
||||
</lifecycleMappingMetadata> |
||||
</configuration> |
||||
</plugin> |
||||
</plugins> |
||||
</pluginManagement> |
||||
</build> |
||||
<pluginRepositories> |
||||
<pluginRepository> |
||||
<id>objectstyle</id> |
||||
<name>ObjectStyle.org Repository</name> |
||||
<url>http://objectstyle.org/maven2/</url> |
||||
<snapshots> |
||||
<enabled>false</enabled> |
||||
</snapshots> |
||||
</pluginRepository> |
||||
</pluginRepositories> |
||||
</project> |
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
#Generated by Git-Commit-Id-Plugin |
||||
#Tue Oct 22 10:25:03 BST 2013 |
||||
git.commit.id.abbrev=040321b |
||||
git.commit.user.email=awilkinson@gopivotal.com |
||||
git.commit.message.full=Isolate Aether in a separate class loader\n\nPrior to this commit, the Aether-based GrapeEngine was loaded in the\nsame class loader as the rest of Boot. This led to Aether's and its\ndependencies' types polluting the application's class path. Most\nnotably, this caused problems with logging as the logging framework\ncould be permaturely initialized.\n\nThis commit isolates AetherGrapeEngine, Aether and its dependencies\ninto a separate class loader. This is done by customizing the\npackaging of the CLI's jar file with the internal directory housing\nall of the types that will be loaded by the separate class loader.\n |
||||
git.commit.id=040321bf153db007290786623d45903cee27fa88 |
||||
git.commit.message.short=Isolate Aether in a separate class loader |
||||
git.commit.user.name=Andy Wilkinson |
||||
git.build.user.name=Andy Wilkinson |
||||
git.build.user.email=awilkinson@gopivotal.com |
||||
git.branch=aether-grab |
||||
git.commit.time=2013-10-21T16\:24\:40+0100 |
||||
git.build.time=2013-10-22T10\:25\:03+0100 |
||||
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
<assembly> |
||||
<id>repackaged</id> |
||||
<formats> |
||||
<format>jar</format> |
||||
</formats> |
||||
<includeBaseDirectory>false</includeBaseDirectory> |
||||
<dependencySets> |
||||
<dependencySet> |
||||
<includes> |
||||
<include>org.springframework.boot:spring-boot-cli:jar:*</include> |
||||
</includes> |
||||
<unpack>true</unpack> |
||||
<directoryMode>755</directoryMode> |
||||
</dependencySet> |
||||
<dependencySet> |
||||
<includes> |
||||
<include>org.springframework.boot:spring-boot-cli-grape:jar:*</include> |
||||
</includes> |
||||
<outputDirectory>internal</outputDirectory> |
||||
<directoryMode>755</directoryMode> |
||||
<scope>provided</scope> |
||||
<unpack>true</unpack> |
||||
</dependencySet> |
||||
</dependencySets> |
||||
</assembly> |
||||
@ -1,42 +0,0 @@
@@ -1,42 +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.boot.cli.command.tester; |
||||
|
||||
import java.io.FileNotFoundException; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* Abstract base class for tester implementations. |
||||
* |
||||
* @author Greg Turnquist |
||||
*/ |
||||
public abstract class AbstractTester { |
||||
|
||||
public TestResults findAndTest(List<Class<?>> compiled) throws FileNotFoundException { |
||||
Set<Class<?>> testable = findTestableClasses(compiled); |
||||
if (testable.size() == 0) { |
||||
return TestResults.NONE; |
||||
} |
||||
return test(testable.toArray(new Class<?>[] {})); |
||||
} |
||||
|
||||
protected abstract Set<Class<?>> findTestableClasses(List<Class<?>> compiled); |
||||
|
||||
protected abstract TestResults test(Class<?>[] testable); |
||||
|
||||
} |
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
#Generated by Git-Commit-Id-Plugin |
||||
#Tue Oct 22 10:25:04 BST 2013 |
||||
git.commit.id.abbrev=040321b |
||||
git.commit.user.email=awilkinson@gopivotal.com |
||||
git.commit.message.full=Isolate Aether in a separate class loader\n\nPrior to this commit, the Aether-based GrapeEngine was loaded in the\nsame class loader as the rest of Boot. This led to Aether's and its\ndependencies' types polluting the application's class path. Most\nnotably, this caused problems with logging as the logging framework\ncould be permaturely initialized.\n\nThis commit isolates AetherGrapeEngine, Aether and its dependencies\ninto a separate class loader. This is done by customizing the\npackaging of the CLI's jar file with the internal directory housing\nall of the types that will be loaded by the separate class loader.\n |
||||
git.commit.id=040321bf153db007290786623d45903cee27fa88 |
||||
git.commit.message.short=Isolate Aether in a separate class loader |
||||
git.commit.user.name=Andy Wilkinson |
||||
git.build.user.name=Andy Wilkinson |
||||
git.build.user.email=awilkinson@gopivotal.com |
||||
git.branch=aether-grab |
||||
git.commit.time=2013-10-21T16\:24\:40+0100 |
||||
git.build.time=2013-10-22T10\:25\:04+0100 |
||||
Loading…
Reference in new issue