Commit Graph

1032 Commits (e4dd7ac959224d7d324e02ea14ccb65e3abb2c00)

Author SHA1 Message Date
Phillip Webb d125357bf6 Protect against JARs with different local headers
Fix JarEntryData to re-read the local header, rather than relying on
the central directory record.

This protects against the situation where a JAR file is written with an
'Extra Field Length' that is different in the local header to the
central directory header.

This appears to be the case with aspectj 1.7.4 which contains the
following central directory file header for ProceedingJoinPoint:

	50 4B 01 02     signature
	14 03           version made by
	0A 00           version required
	00 00           general
	08 00           compress methods
	0E 40 59 43     last modified
	2D 59 20 70     crc
	EC 00 00 00     csize
	8D 01 00 00     size
	2A 00           fname len
	00 00           ext field len
	00 00           file comment len
	00 00           disk num
	00 00           int file att
	00 00 A4 81     ext file att
	97 F3 00 00     relative offset of the local file header
	...             file name

and the following local header:

	50 4B 03 04     signature
	0A 00           version required
	00 00           general
	08 00           compress method
	0E 40 59 43     last modified
	2D 59 20 70     crc
	EC 00 00 00     csize
	8D 01 00 00     size
	2A 00           fname len
	14 00           ext field len
	...             file name
	...             extra field

Note that the 'ext field len' is 0x00 in the central record but 0x14 in
the local record.

Fixes gh-203
11 years ago
Phillip Webb 47da8a817a Polish 11 years ago
Dave Syer 51f9189923 Prevent 404 in gh-pages 11 years ago
Dave Syer 7b58718453 Add missing YAML file for test 11 years ago
Dave Syer 4e1245d9ee Restore changes from 0332501 (fix class loader test failure) 11 years ago
Dave Syer bf69da3983 Ignore failing test as short term measure 11 years ago
Janne Valkealahti 780397bd6b Fix for wildcard recursive classpath handling
Previous fix for handling wildcard entries in a classpath
imposed a new problem in a case where entry is a directory
with a jar files but also contains a lot of nested directories.

For example entry "./*" resulted for scanning whole disk starting
from "/". In case of default hadoop classpath, it scanned everything
under hadoop's installation. On some cases this deep scan was hidden
and was revealed by NPE's for file access exceptions.

When we want to support wildcard entries we only want to get
jar files from that directory, while boot itself have a need
to travel recursively to find classfiles from an expoded archive.

We handle this case by using recursive(true by default) flag in
ExplodedArchive and this flag is set to false in PropertiesLauncher
if we match wildcard.
11 years ago
Dave Syer 8fe696944a Delete duplicate logback.xml if running from Maven plugin
Fixes gh-143
11 years ago
Dave Syer 033250195b Allow user to specify classLoader as loader property
PropertiesLauncher now supports creating its own class loader
from looader.classLoader property. It will succeed if the
implementation specified has a default constructor or one
that takes a parent class loader, or one that takes a URL[]
and a parent class loader (like URLClassLoader).
11 years ago
Phillip Webb 1bcd3de7b5 Polish 11 years ago
Janne Valkealahti da889efde7 Fix PropertiesLauncher for wildcard entries in parent classpath
This small change now plays nice with wildcard classpath
entries coming from a parent classloader as its urls.
11 years ago
Dave Syer 3c7361fb3e Support for wildcard paths in PropertiesLauncher 11 years ago
Dave Syer ea59976277 Extract package discovery to separate method 11 years ago
Guo Du 2a10503167 fixed ExplodedArchive which fail on windows
* when run 'java org.springframework.boot.loader.JarLauncher'

Fixes gh-176
11 years ago
Phillip Webb 513c6a1de2 Polish 11 years ago
Janne Valkealahti 9ffa6bced5 Readme updates for gradle plugin 11 years ago
Dave Syer 99fd32d408 Attempt to make URL comparison windoze proof 11 years ago
Dave Syer e55e8f9863 Add build.gradle samples and rename runJar->bootRun 11 years ago
Janne Valkealahti 4c9c2b8dcf Tweaks for boot gradle plugin
Fixes gh-152.

... to ease excluding dependencies
eckage changed to bootRepackage

- Register BootRepackage order to use task foo(type: BootRepackage){}
- Allow user to use customConfiguration

configurations {
  hadoopruntime.exclude group: 'log4j'
  hadoopruntime.exclude group: 'org.slf4j'
  hadoopruntime.exclude group: 'org.apache.hadoop'
  hadoopruntime.exclude group: 'org.apache.hive'
  hadoopruntime.exclude group: 'commons-logging'
  hadoopruntime.exclude group: 'org.codehaus.jettison'
  hadoopruntime.exclude group: 'com.thoughtworks.xstream'
}
dependencies {
  compile "org.springframework.batch:spring-batch-core:$springBatchVersion"
  compile "org.springframework.batch:spring-batch-infrastructure:$springBatchVersion"
  compile "org.springframework.data:spring-yarn-batch:$springDataVersion"
  compile "org.springframework.data:spring-yarn-boot:$springDataVersion"
  runtime "org.springframework.data:spring-data-hadoop:$springDataVersion"
  runtime "org.springframework.data:spring-data-hadoop-core:$springDataVersion"
  runtime "log4j:log4j:$log4jVersion"
  runtime "org.slf4j:slf4j-log4j12:$slf4jVersion"
  testCompile "org.springframework.data:spring-yarn-test:$springDataVersion"
  testCompile "org.hamcrest:hamcrest-core:$hamcrestVersion"
  testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
  hadoopruntime configurations.runtime
}

springBoot {
  backupSource = true
  customConfiguration = 'hadoopruntime'
}

task appmasterJar(type: Jar) {
  appendix = 'appmaster'
  from sourceSets.main.output
  exclude('**/*Container*')
  exclude('**/*Client*')
}

task clientJar(type: Jar) {
  appendix = 'client'
  from sourceSets.main.output
  exclude('**/*Appmaster*')
  exclude('**/*Container*')
}

task clientBoot(type: BootRepackage, dependsOn: clientJar) {
  withJarTask = clientJar
}

task appmasterBoot(type: BootRepackage, dependsOn: appmasterJar) {
  customConfiguration = "hadoopruntime"
  withJarTask = appmasterJar
}

//jar.enabled = false
//bootRepackage.enabled = false

task bootJars
bootJars.dependsOn = [clientBoot,containerBoot,appmasterBoot]

build.dependsOn(clientBoot)
build.dependsOn(containerBoot)
build.dependsOn(appmasterBoot)
//build.dependsOn(bootJars)
11 years ago
Dave Syer f39b044cf7 Fix packaging for Layout.NONE
Fixes gh-139
11 years ago
Dave Syer 3f1cfbf241 Add JSTL to JSP sample 11 years ago
Dave Syer c0bcb5e8e9 Add layout=NONE to packaging tools 11 years ago
Phillip Webb 64f32893bb Source format and clean-up 11 years ago
Phillip Webb 883fd9162f Polish 11 years ago
Phillip Webb d2678e08de Improve startup performance for nested JARs
Refactor spring-boot-loader to work directly with low level zip data
structures, removing the need to read every byte when the application
loads.

This change was initially driven by the desire to improve tab-completion
time when working with the Spring CLI tool. Local tests show CLI
startup time improving from ~0.7 to ~0.22 seconds.

Startup times for regular Spring Boot applications are also improved,
for example, the tomcat sample application now starts 0.5 seconds
faster.
11 years ago
Phillip Webb 202e32425e Reinstate git commit ID in loader tools manifest
Add Spring-Boot-Commit-Id to MANIFEST.MF of spring-boot-loader-tools.
The reinstates functionality of 498ca07698
but does not cause issues in eclipse.
11 years ago
Dave Syer 8cb0211dce Add "integration" profile in Maven build
By default it is on, but you can switch it
off (`-P '!integration'`) to ignore integration tests
and get a faster build.

.travis.yml uses this feature so that it doesn't keep
failing on a timeout.
11 years ago
Phillip Webb 18147b24c0 Revert "Re-add Spring-Boot-Commit-Id to MANIFEST.MF of created jars"
This reverts commit 498ca07698.

Removed due to eclipse failures.
11 years ago
Phillip Webb d784cb6a88 Apply eclipse-formatter conventions 11 years ago
Christian Dupuis 498ca07698 Re-add Spring-Boot-Commit-Id to MANIFEST.MF of created jars 11 years ago
Dave Syer fc40ad4b48 Add short description of launchers 11 years ago
Phillip Webb a9c9c383f4 Polish pom.xml
Aplly consistent formatting, drop JDK 8 support and cleanup repo
locations to use spring.io.
11 years ago
Andy Wilkinson bde98defa5 Update Gradle plugin to only repackage main jar
Previously, Repackage would attempt to repackage every jar in the
project. This would cause it to incorrectly attempt to repackage source
and javadoc jars.

This commit updates Repackage so that it ignores any jar with a
classifier. Hopefully this is a reasonable approximation for ignoring
'special' jars that should not be repackaged such as sources and
javadoc.
11 years ago
Dave Syer f8d5802230 Fix typo in gradle plugin 11 years ago
Andy Wilkinson 629a77c3e2 Remove ASM dependency and use Spring Core's instead
Depending on ASM itself can cause problems as it can clash with other
libraries' dependency on it. This commit updates
spring-boot-loader-tools to depend upon spring-core and use its
repackaged copy of ASM instead. Depending on spring-core also brings
with it the advantage of giving access to its various bits of utility
code.

spring-boot-maven-plugin has been updated to remove its ASM
exclusions as they will no longer clash with the version from
spring-boot-loader-tools

(59483608)
11 years ago
Andy Wilkinson c0ae78f3ec Isolate Aether in a separate class loader
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.
11 years ago
Andy Wilkinson b0c6d8060c Remove Git plugin from Spring Boot tools
The Git plugin was primarily being used to provide version information
that Boot's maven plugin can add into the MANIFEST.MF of the uber-jars
that it creates under the Spring-Boot-Commit-Id attribute.

This commit removes the Git plugin from Boot's own projects, but
leaves it in the spring-boot-starter-parent for use by Spring
Boot-based applications.

The attribute in the uber-jars' MANIFEST.MF has been replaced with a
Spring-Boot-Version attribute. The value of this attribute is the
implementation version of Repackager class's package.
11 years ago
Phillip Webb 6220aba983 Allow 'java -jar' to work with signed nested jars
Fix RandomAccessJarFile to correctly read certificate information as
jar entries are loaded. This change allows signed nested jars to be
used as JCE providers.
11 years ago
Phillip Webb 5c6dd52e9a Polish 11 years ago
Dave Syer fede0d1c98 Add profiles to /env 11 years ago
Dave Syer 47cd5dd679 Tooling for PropertiesLauncher in JAR archives
To use PropertiesLauncher instead of JarLauncher in an
executable JAR we have provided tooling support. In Maven
(using the starter parent to default some of the settings):

    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      <configuration>
        <layout>ZIP</layout>
      </configuration>
    </plugin>

in Gradle:

    apply plugin: "spring-boot"
    springBoot {
        layout = 'ZIP'
      }
    }

[Fixes #58837492] [bs-330] Add tooling for PropertiesLauncher
11 years ago
Dave Syer ea11dafcbd Extend PropertiesLauncher to load nested archives
PropertiesLauncher can now be used to run an executable jar, and by
default it will pick up nested archives in lib/ (where the Boot
tools puts them). User can provide loader.path (colon-separated)
to change the nested path.

[#58837492] [bs-330] Add tooling for PropertiesLauncher
11 years ago
Dave Syer d4d9ebcabd Small re-org of PropertiesLauncher 11 years ago
Dave Syer be1263500d Ensure env vars are consulted for PATH 11 years ago
Dave Syer 281c650251 Add git commit id to MANIFEST in boot tools repackager 11 years ago
Dave Syer b0c54a6588 Add parent class loader entries if possible
...otherwise you can see cryptic NoClassDefFound errors
because the application class was loaded from the parent
on the file system, but then it doesn't have access to the
child loaders nested jars.
11 years ago
Dave Syer 114b7a5e95 Ensure UPPER_CASE overrides work in PropertiesLauncher 11 years ago
Phillip Webb 35ff983b40 Prevent duplicate resource enumeration form loader
Fix LaunchedURLClassLoader to only enumerate resources from the
rootLoader and the URLs.

Commit cd2c189 (Support javaagent instrumentation with loader) added
a parent classloader and used filtering in the loadClass() method
to ensure classes were loaded from the appropriate location. The change
in parent means that locally packaged resources are found twice, once
from the parent, and once from the self archive URL.

LaunchedURLClassLoader now overrides getResource and getResources to
filter out the parent classloader and instead only add resources from
the root classloader and the URLs.

Issue: #56232870
11 years ago
Phillip Webb af0d08c998 Polish 11 years ago
Phillip Webb b772f7c2e4 Polish
Minor formatting and consistent copyright header.
11 years ago
dave noel a1517de6db Add gradle runJar 11 years ago
Phillip Webb 15bc25dc29 Further re-organization of launcher code 11 years ago
Dave Syer 0e0eb7d3fa Add loader.system (flag to copy properties to System) 11 years ago
Dave Syer a3af83cf96 Add internal property replacement
E.g. in application.properties (for launcher)

foo: Application
loader.main: my.${foo}
loader.path: etc
11 years ago
Dave Syer a70d293c87 Re-organize the Launcher code a bit 11 years ago
Phillip Webb e9fd7c96b8 Loader changes 11 years ago
Dave Syer 053c072155 Add some tests for PropertiesLauncher 11 years ago
Dave Syer f83fd47184 Add PropertiesLauncher 11 years ago
Phillip Webb fd9e258d12 Replace 'springsource.org' with 'spring.io'
Replace all references to 'springsource.org' with the new 'spring.io'
domain.
11 years ago
Dave Syer 8a1e39c4dc Remove unused annotation 11 years ago
Phillip Webb e2b3c03fc4 Refine LaunchedURLClassLoader load order
Refine the loading order of LaunchedURLClassLoader to consider the
root loader before locally bundled classes.

The prevents classes from locally bundled JARs from replacing system
classes.

Issue: #56232870
11 years ago
Phillip Webb 680741fdc8 Fix LaunchedURLClassLoader Java 1.6 compatibility 11 years ago
Phillip Webb cd2c18965e Support javaagent instrumentation with loader
Update spring-boot-loader to allow `-javaagent` instrumentation when
running from executable jars.

Prior to this commit the `Launcher` skipped the application classloader
and instead used the system classloader as a parent. This was to ensure
that locally packaged classes were always loaded by the classloader
that had access to nested jars.  Unfortunately when using the
`-javaagent` option, it is the application classloader that is modified.

The `Launcher` class now uses the application classloader as parent
and `LaunchedURLClassLoader` has been updated to always search local
URLs before delegating to the parent. This is very similar to the way
that most application servers handle the loading of war files.

Issue: #56232870
11 years ago
Dave Syer 38e565e920 Back to SNAPSHOT for dev 11 years ago
Dave Syer b634b3bde6 Update to 0.5.0.M2 11 years ago
Phillip Webb 5b7d56895b Provide accurate InputStream.available() results
Provide accurate InputStream.available() results by using the size
attribute of the ZipEntry. This helps improve performance with
CGLib and also fixes issues where libraries expect that a non-zero
result from available() indicates that read() will not return -1.
11 years ago
Biju Kunjummen 29afcb7898 Added an @Execute annotation to RunMojo
Update RunMojo to include an @Execute annotation. Allows the use of
`mvn spring-boot:run` without having to compile/package first. Now a
command like `mvn clean spring-boot:run` works.

The phase for @Execute annotation is along the lines of what is used
for the `jetty:run` plugin.
11 years ago
Phillip Webb c999541fd3 Set source/target version to 1.6 for int. tests 11 years ago
Phillip Webb e6d9922cbc Stream maven-invoker-plugin logs 11 years ago
Daniel L. Buchko 7ecb99757b Prevent test failures under Windows
Cleaned up file separators to prevent tests failing on Windows.
11 years ago
Daniel L. Buchko 3c5fa0daa0 Fixed handling of spaces in file paths
Update Launcher to correctly handle spaced in file paths.
11 years ago
Phil Webb 3690ab16ba Fix README.md typo 11 years ago
Phillip Webb 878ff13620 Documentation updates 11 years ago
Phillip Webb ce5e145afa Add Libraries.NONE static final 11 years ago
Phillip Webb 0b7256e7f9 Fix compile failure on JDK 6 11 years ago
Phillip Webb cf655945aa Polish 11 years ago
Phillip Webb e773db2401 Remove unused test resources 11 years ago
Phillip Webb 4e11ae1671 Documentation
Various updates to README.md files.
11 years ago
Phillip Webb 1db22aca5c Rework POM structure
Rework main build POM to be an aggregator pom that does not inherit
from any parent. Introduce new spring-boot-dependencies module to
act as a parent for both spring-boot-starter-parent and
spring-boot-parent.
11 years ago
Dave Syer 413658fbca Change parent for tools poms 11 years ago
Dave Syer 4bb5de02e7 Switch back to SNAPSHOT for dev 11 years ago
Dave Syer 19a880dff6 Move tools modules under spring-boot-tools 11 years ago