Commit Graph

452 Commits (4c576f6d1917ef41f49d89c0fde6f8b5754a1587)

Author SHA1 Message Date
Stephane Nicoll 97634e85ac Remove unnecessary keyword 9 years ago
Spring Buildmaster 7ce391db4f Next development version 10 years ago
Phillip Webb b1f8a692a8 Merge branch '1.2.x' 10 years ago
Phillip Webb a1b87766a7 Fix PropertiesLauncher javadoc
See gh-3392
10 years ago
Phillip Webb 61fc4f3f12 Polish copyright headers 10 years ago
Phillip Webb f65dfe4bcb Fix javadoc errors and warnings 10 years ago
Phillip Webb 7609c43685 Switch Javadoc <code>...</code> to {@code ...}
Update Javadoc to use the {@code ...} syntax when possible.
10 years ago
Eddú Meléndez baca62a6c0 Fix typos 10 years ago
Spring Buildmaster 5d81c87b43 Next Development Version 10 years ago
Phillip Webb 49c4710f63 Merge branch '1.2.x' 10 years ago
Phillip Webb 968b68c322 Polish 10 years ago
Andy Wilkinson 02859cc2d4 Merge branch '1.2.x' 10 years ago
Andy Wilkinson ebb8d0c55f Read the time of a JarEntryData using MSDOS Date Time format
The format is rather unusual.

The time is 16 bits: 5 bits for the hour, 6 bits for the minutes, and 5
bits for the seconds. 5 bits only allows 32 values (0-31) so the number
must be doubled, meaning that the time is only accurate to the nearest
two seconds. Also, the JDK rounds this down by subtracting one. The
doubling and rounding is performed by shifting one place to the left
and masking off the right-most bit respectively.

The date is 16 bits: 7 bits for the year, 4 bits for the month, and 5
bits for the day. The year is from 1980, i.e. the earliest date that
can be represented is 1980-01-01.

See http://mindprod.com/jgloss/zip.html for more details of the format.

Fixes gh-2826
10 years ago
Phillip Webb 8143d1f36d Apply animal sniffer to entire build
Move animal sniffer configuration out of spring-boot-dependencies to
spring-boot-parent and apply it to all projects.

See gh-716
10 years ago
Spring Buildmaster e03c11dda8 Next development version 10 years ago
Andy Wilkinson 3649a89a03 Use maven-dependency-plugin 2.10 in Loader's integration test projects
Closes gh-2430
10 years ago
Phillip Webb a57a88f5cf Move master to 1.3.0.BUILD-SNAPSHOT 10 years ago
Spring Buildmaster 8f0ad02237 Next development version 10 years ago
Phillip Webb 8e398dc6a7 Polish Javadoc
Update Javadoc to add missing @return and @param elements.
10 years ago
Phillip Webb 0696695e16 Add package javadoc 10 years ago
Phillip Webb 3328c1369f Merge branch '1.1.x'
Conflicts:
	spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java
10 years ago
Phillip Webb 555827cad7 Polish 10 years ago
Andy Wilkinson ca69156afd Merge branch '1.1.x' 10 years ago
Andy Wilkinson bbd2486c04 Run invoker plugin with a single thread to avoid build failures
Running the invoker plugin with multiple threads against an empty
Maven cache results in strange build failures where Maven claims that
it cannot find a jar or pom file for an artifact that it should be
able to find. It would appear that Maven is unable to cope with
concurrent writes to its cache.

This commit removes the usage of multiple threads that was introduced
in 4e907f1.

Fixes gh-2389
10 years ago
Dave Syer 1be12ee945 Merge branch '1.1.x' 10 years ago
Dave Syer 4e907f19ce Carefully add nested archives from JAR in PropertiesLauncher
If user runs an executable archive then it and its lib directory will be
on the classpath. Entries from loader.path take precedence in a way that
should make sense to users (earlier wins like in CLASSPATH env var).

Also added new integration tests to verify the behaviour (big improvement
on the old ones, which probably aought to be beefed up to the same
standard).

Fixes gh-2314
10 years ago
Spring Buildmaster 60725cd8bd Next development version 10 years ago
Phillip Webb 1f775793ee Use Collections.addAll(...) instead of for loops
Replace various for loops which add items to collections with calls
to Collections.addAll(...).

Fixes gh-2277
10 years ago
Spring Buildmaster 63e6a25097 Next development version 10 years ago
Spring Buildmaster 1a788c1741 Next development version 10 years ago
Spring Buildmaster 46b7738334 Next development version 10 years ago
Phillip Webb b947d6001d Polish 10 years ago
Andy Wilkinson ade22c87ec Update WarLauncher to remove the root of the war from the classpath
Previously, WarLauncher included its root on the classpath. It also used
a filtered version of its root archive to hide both the WEB-INF and
META-INF directories. This meant that files in WEB-INF and META-INF
could be found by the classloader (as they were on the classpath) but
could not be read as the filtered archive was hiding them.

This commit updates WarLauncher to remove the root of the war file from
the classpath. It also removes the filtering of the archive, thereby
allowing files in META-INF and WEB-INF to be accessed via the
ServletContext.

Closes gh-1792
10 years ago
Andy Wilkinson b99ffcc170 Merge branch '1.1.x' 10 years ago
Michael Cramer f62664534d Update maven-dependency-plugin to version 2.9
Closes gh-1862
10 years ago
Phillip Webb 2e7aa4685b Polish 10 years ago
Andy Wilkinson 886bbc3b41 Merge branch '1.1.x' 10 years ago
Andy Wilkinson 9a2d654eba Rename test classes so that their tests are run by Maven 10 years ago
Andy Wilkinson 7211571969 Fix some grammar issues in docs
Closes gh-1695
10 years ago
Eric Dahl 16937746a0 Fix some grammar issues in docs 10 years ago
Spring Buildmaster 3e71a21b30 Next development version 10 years ago
Phillip Webb 509c3aef4e Merge branch '1.1.x' 10 years ago
Phillip Webb 6028d92a4e Support Windows UNC paths with fat jars
Update `Launcher` and `JarFile` to correctly deal with Windows UNC
paths.

Fixes gh-1641
10 years ago
Andy Wilkinson 316e5f78f9 Merge branch '1.1.x' 10 years ago
Andy Wilkinson f7d1f968b9 Improve error message when JarFile encounters a compressed nested jar
Closes gh-1643
10 years ago
Spring Buildmaster edb4b7ed7d Next development version 10 years ago
Spring Buildmaster d63e4b4329 Next development version 10 years ago
Dave Syer 399238384f Merge branch '1.1.x' 10 years ago
Dave Syer 8e84151f8f Normalize search path in PropertiesLauncher
* Windows: allow absolute file paths without file:/// prefix
* All: only add nested archives (not directories), so loader.path=lib/*
behaves the same as -classpath=lib/* (except for adding zip files)

Fixes gh-1352
10 years ago
Dave Syer ccfc47091c Fix URL filtering when loading from a directory
The ExplodedArchive would erroneously always attempt to filter
its contents (and thereby shield them from a classloader that wrapped
it) even if they haven't been explicitly provided.

See gh-1352
10 years ago
Phillip Webb 54625cc2a0 Make LaunchedURLClassLoader lock provider static
Fixes gh-1380
10 years ago
Spring Buildmaster 74d0c5185a Next development version 10 years ago
Phillip Webb 4f440fcbb9 Java 7 ClassLoader performance improvements
Use Java 7 `registerAsParallelCapable` and `getClassLoadingLock` methods
when possible. This should improve performance when running on JDK 7+
whilst still remaining JDK 6 compatible.

Closes gh-1284
10 years ago
Stephane Nicoll 249e09d9bc Switch master to 1.2.0.BUILD-SNAPSHOT 11 years ago
Spring Buildmaster 40327e1ae6 Next development version 11 years ago
Phillip Webb fa88c481a5 Remote trailing whitespace 11 years ago
Spring Buildmaster 981669b7c0 Next development version 11 years ago
Phillip Webb 35b26b52f2 Add caching to JarFile.getUrl()
Fixes gh-1178
11 years ago
Phillip Webb 200cd535c2 Revert "Next development version"
This reverts commit 67189477fe.
11 years ago
Spring Buildmaster 67189477fe Next development version 11 years ago
Phillip Webb 9632abf825 Formatting and cleanup 11 years ago
Phillip Webb 7e7733d45d Deal with spaces in file references
Fixes gh-1169
11 years ago
Phillip Webb 7654259f80 Fix JarFile issues when running on Windows
Fix 'fat jar' support for windows to correctly deal with URL and path
slash issues. The root cause of the original problem was caused by JAR
URLs not including a root slash (ie `file:C:/Users` vs `file:/C:/Users`)

Fixes gh-1145
11 years ago
Spring Buildmaster 542f3cbda8 Next development version 11 years ago
Phillip Webb 60ef031f78 Fix "signer information does not match" error
Update ExecutableArchiveLauncher so that `-cp` URLs are not added
when they are already contained as nested JARs. This prevents a
SecurityException "signer information does not match error" when using
signed jars. The root cause of the issue was that the primary JAR file
was on the default classpath with the URL "file:....jar" and in the
main URL set as "jar:file:....jar". It is now filtered so that only
the "jar:" variant is added.

Fixes gh-1134
11 years ago
Phillip Webb f30b962ff9 Add support for unpacking nested JARs
Update the executable JAR code to automatically unpack any entries
which include an entry comment starting `UNPACK:` to the temp folder.
The existing Maven and Gradle plugins have been updated with new
configuration options and the `spring-boot-tools` project has been
updated to write the appropriate entry comment based on a flag passed
in via the `Library` class.

This support has been added to allow libraries such a JRuby (which
assumes that `jruby-complete.jar` is always accessible as file) to work
with Spring Boot executable jars.

Fixes gh-1070
11 years ago
Phillip Webb 3d6c8a85f4 Allow URL resolution within nested JARs
Update JarURLConnection to allow the resolution of items within a nested
jar, even if the jarFile passed to the connection is several levels up.

This prevent a connection from incorrectly resolving an entry against
the wrong jar file.

See gh-1070
11 years ago
Phillip Webb 20fb55ea47 Polish 11 years ago
Phillip Webb a3ceaf63e2 Improve performance of fat jar loading
Tweak 'fat jar' handling to generally improve performance:

- Allow JarURLConnection to throw a static FileNotFoundException when
  loading classes. This exception is thrown many times when attempting
  to load a class and is silently swallowed so there is no point in
  providing the entry name.
- Expose JarFile.getJarEntryData(AsciiBytes) and store AsciiBytes in
  the JarURLConnection. Previously AsciiBytes were created, discarded
  then created again.
- Use EMPTY_JAR_URL for the JarURLConnection super constructor. The URL
  is never actually used so we can improve performance by using a
  constant.
- Extract JarEntryName for possible caching. The jar entry name
  extracted from the URL is now contained in an inner JarEntryName
  class. This could be cached if necessary (although currently it is
  not because no perceivable performance benefit was observed)

Fixes gh-1119
11 years ago
Phillip Webb a8777eda76 Add JarFile caching
Cache root jar files in the Handler and also store nested jar files in
the JarEntryData.

See gh-1119
11 years ago
Phillip Webb 88195292dd Reuse previously parsed entries for filtered JARs
Update JarFile to reuse the previously parsed entries when creating
filtered jars. This saves needing to re-scan the underlying file to
recreate a subset of entries.

See gh-1119
11 years ago
Phillip Webb e9aab1e90c Drop JarEntryFilters from constructor and methods
Drop JarEntryFilter arguments from the JarFile constructor and the
getNestedJarFile methods. Filtered JarFiles can still be obtained by
using the getFilteredJarFile() method.

This helps simplify the code a little and will make it easier to add
caching.

See gh-1119
11 years ago
Phillip Webb 54dc46f777 Allow prefixed bytes with fat JARs
Update `spring-boot-loader` ZIP processing code to support prefixed
bytes within the fat jar. This technique allows a bash script to be
embedded at the start of the JAR whilst still allowing `java -jar`
execution.

Fixes gh-1073
11 years ago
Spring Buildmaster 4ca26a21dc Next development version 11 years ago
Spring Buildmaster 05ed7b3bcd Next development version 11 years ago
Phillip Webb 3007a777d0 Roll back to 1.1.0.BUILD-SNAPSHOT 11 years ago
Spring Buildmaster c650f2391e Next development version 11 years ago
Phillip Webb b5d267ca89 Polish 11 years ago
Phillip Webb 99af5dbe23 Merge branch '1.0.x'
Conflicts:
	spring-boot-dependencies/pom.xml
11 years ago
Phillip Webb d848f03c43 Fix URL methods in JarURLConnection
Update JarURLConnection to return correct values from `getURL()`,
`getJarFileURL()` and `getEntryName()`.

Fixes gh-973
11 years ago
Phillip Webb 695571ad0b Unify versions in POMs started by the invoker
Unify the versions used in integration tests launched by the
maven-invoker-plugin. Allows for already cached local copies to be
used, hopefully speeding up the build.
11 years ago
Phillip Webb d4d3ffa93c Unify versions in POMs started by the invoker
Unify the versions used in integration tests launched by the
maven-invoker-plugin. Allows for already cached local copies to be
used, hopefully speeding up the build.
11 years ago
Phillip Webb 1a475102de Polish 11 years ago
Andy Wilkinson ee08667e81 Exclude Java agent jars from class path of launching class loader
ExecutableArchiveLauncher creates a ClassLoader that is used by the
Launcher to load an application’s classes. During the creation of this
ClassLoader URLs from another ClassLoader are copied over. This was
resulting in Java agents that are added to the system class loader
via the -javaagent launch option being available on both the system
class loader and the created class loader. Java agents are intended to
always be loaded by the system class loader. Making them available on
another class loader breaks this model.

This commit updates ExecutableArchiveLauncher so that it skips the URLs
of any Java agents (found by examining the JVM’s input arguments) when
copying URLs over to the new classloader, thereby ensuring that Java
agents are only ever loaded by the system class loader.

Fixes #863
11 years ago
Phillip Webb 8bcda1bcbe Polish 11 years ago
Phillip Webb 2cadf4165f Merge branch '1.0.x'
Conflicts:
	spring-boot-dependencies/pom.xml
	spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java
11 years ago
Phillip Webb 6a644e2e23 Protect against malformed URLs on Windows
Update JarFile to correctly create system independent URLs to prevent
potential URISyntaxExceptions when running on Windows.

Fixes gh-836
11 years ago
Dave Syer 845a86d548 Monkey with JarUrlConnection to make it work when LANG unset
The problem all along has been in AsciiBytes, so the fix in
commit ce3aaf was just a stop gap for a system where multi-byte
characters are supported but the default encoding is not UTF-8 (e.g.
most Windows systems). The real solution is not to leave it to
chance and always pick an encoding for the JarEntry names (i.e.
in AsciiBytes).

(Cherry picked from commit 06e364a9ff)

Fixes gh-764
11 years ago
Phillip Webb 34b7bb20fd Add maven implicit plugin group ID
Add previously implicit <groupId>org.apache.maven.plugins</groupId>
to plugin declarations.
11 years ago
Dave Syer 06e364a9ff Monkey with JarUrlConnection to make it work when LANG unset
The problem all along has been in AsciiBytes, so the fix in
commit ce3aaf was just a stop gap for a system where multi-byte
characters are supported but the default encoding is not UTF-8 (e.g.
most Windows systems). The real solution is not to leave it to
chance and always pick an encoding for the JarEntry names (i.e.
in AsciiBytes).

Fixes gh-764
11 years ago
Phillip Webb f53ee406c1 Merge branch '1.0.x' 11 years ago
Artem Bilan 471e6af2af Make `loader` Windows compatible
The encoding of UTF-8 (et al.) chars in the
JarUrlConnection has to be made explicit, otherwise
Wdinows apparently does not pick the default(?).

Fixes gh-711, Fixes gh-753
11 years ago
Phillip Webb 6025f45aa0 Polish 11 years ago
Dave Syer 689eb3e148 Add URLs from parent classloader in executable jar
$ (cd spring-boot-tools; mvn clean install -DskipTests=true)
$ (cd spring-boot-samples/spring-boot-sample-simple/; mvn clean package)
$ java -jar spring-boot-samples/spring-boot-sample-simple/target/spring-boot-sample-simple-1.1.0.BUILD-SNAPSHOT.jar

(vanilla executable jar archive: works)

$ java -cp spring-boot-samples/spring-boot-sample-simple/target/spring-boot-sample-simple-1.1.0.BUILD-SNAPSHOT.jar:spring-boot-tools/spring-boot-loader/src/test/resources/jars/app.jar org.springframework.boot.loader.JarLauncher

(jar archive plus vanilla plugin: works)

$ (cd spring-boot-samples/spring-boot-sample-simple/target; rm -rf app && mkdir $_ && cd $_ && jar -xf ../*.jar)
$ java -cp spring-boot-samples/spring-boot-sample-simple/target/app/ org.springframework.boot.loader.JarLauncher

(exploded directory: works)

$ java -cp spring-boot-tools/spring-boot-loader/s:spring-boot-tools/spring-boot-loader/src/test/resources/jars/app.jar org.springframework.boot.loader.JarLauncher

(exploded directory with plugin jar: works)

Potential fix for gh-529
11 years ago
Artem Bilan da5eae3ca5 Make `loader` Windows compatible
The encoding of UTF-8 (et al.) chars in the
JarUrlConnection has to be made explicit, otherwise
Wdinows apparently does not pick the default(?).

Fixes gh-711, Fixes gh-753
11 years ago
sopov.ivan 174b654faf minor test fixes
Reverting arguments in assertEquals where constant was placed on
the "actual" place. Replacing assertEquals with assertFalse, assertTrue
and assertNull where applicable.

Fixes gh-735
11 years ago
Phillip Webb 64a835e91a Move master to 1.1.0.BUILD-SNAPSHOT 11 years ago
Spring Buildmaster d3954a1703 Next development version 11 years ago
Dave Syer 34604a9602 Add assertion about non-special resource 11 years ago
Spring Buildmaster a5864ebcd0 Next development version 11 years ago
Spring Buildmaster 15e9dbe98b Next development version 11 years ago
Phillip Webb 1e68b7e0a9 Remove superfluous <packaging> tags from POMs 11 years ago
Phillip Webb 0af7f7e347 Add missing POM info 11 years ago
Phillip Webb 488b03387f Polish POM formatting 11 years ago
Phillip Webb 6f9bb233ad Revert "Next development version"
This reverts commit b67bb70ee3.
11 years ago
Spring Buildmaster b67bb70ee3 Next development version 11 years ago
Phillip Webb ac4cdd33c3 Revert "Next development version"
This reverts commit 1d0eea12eb.
Returning to 1.0.0.BUILD-SNAPSHOT for an updated release.
11 years ago
Spring Buildmaster 1d0eea12eb Next development version 11 years ago
Martin Lau 53cb8ccde2 Escape URL characters in JAR URLs
Update the spring-boot-loader JarURLConnection class to decode entry
names in the same way as the stock JDK class. This allows encoded
entry names in the form `%c3%ab` to be loaded.

Fixes gh-556
11 years ago
Phillip Webb ca0a12cedb Polish 11 years ago
Dave Syer ae512193bf Add missing test mannifest 11 years ago
Dave Syer 935131cdab Clarification regarding format of loader.path 11 years ago
Dave Syer a1d3bac7c8 More changes to teh way ExplodedArchive works in non-recursive mode
It is sufficient for most purposes (e.g. the ones PropertieLauncher needs)
to only read the META-INF directory (not the whole file tree). So a quick
fix is to make META-INF a special case when initializing non-recursive
entries.

Fixes gh-520
11 years ago
Dave Syer 2c60449836 Be defensive with File.listFiles() 11 years ago
Phillip Webb c5ee3c7eba Remove duplicate documentation
Remove README files that have been since been migrated to the reference
documentation. Also updated remaining markdown files to asciidoctor to
save having a mix of different formats.

Fixed gh-503
11 years ago
Phillip Webb 80ac1fb0cd Polish 11 years ago
Dave Syer a71c9b5de7 Add escape hatch for ClassLoader.findResource() for invalid path
The source of the exception is in sun.misc (so hard to track down precisely)
but it's clear that the LaunchedJarURLClassLoader needs to be more
defensive and return null from findResource() if it can't find it.

Fixes gh-486
11 years ago
Dave Syer 8168e8a327 Special case for root of classpath resource in archive
This turns out to affect JPA, but only because it looks for a URL for the
root of the classpath using ClassLoader.getResource("") which barfs in
an app launched from an executable JAR. It's easy to make a special case
for "" in the class loader, so I went ahead and did that. Possibly need
to think what the implication of getResources("") is as well (not
tested in an app yet).

Fixes gh-420
11 years ago
Spring Buildmaster b0d4e8ae69 Next development version 11 years ago
Spring Buildmaster cb8668a151 Release version 1.0.0.RC4 11 years ago
Dave Syer f0f73a4ead Current directory (lodaer.path=.) pathology workaround
It turns out that loader.path=. was pathological and before this
change ended up making the classpath empty (loader.path=.,lib/
would have fixed it). With this change the old behaviour is still
supported, but if the only user-supplied path entry is "." (or
empty) then it is now kept, and translates into the root of the
current archive if running as "java -jar ...".

Fixes gh-270
11 years ago
Phillip Webb 865c51d7ac Revert "Omit jar: prefix from jarFileUrl"
Restore previous behavior where JarFile URLs are always prefixed with
"jar:". I believe that the prefix is required in order to remain
compatible with standard JAR URLs.

This reverts commit 825fc2f7df.
11 years ago
Dave Syer 825fc2f7df Omit jar: prefix from jarFileUrl 11 years ago
Dave Syer ed15345df1 Try to make Jetty scan TLDs in nested JARs
Jetty apparently does it differently (different version of
Jasper maybe), so you need a unique jarFileURL for each
nested JAR (previously they were all set to the parent
archive URL).

Also added the root of the main archive as a valid
document root.

For gh-367
11 years ago
Spring Buildmaster 1367d57e8c Next development version 11 years ago
Spring Buildmaster eaff1677a7 Release version 1.0.0.RC3 11 years ago
Phillip Webb dfe6de8c1f Fallback to JVM URL handler on exception
Update the executable JAR `Handler` to fallback to the JVM handler if
the jar cannot be opened. This prevents exceptions when trying to
open URLs in the form "jar:jndi:/localhost...".

Fixes gh-347
11 years ago
Adam Brodziak f67b165f5a Prevent 404s in README.md links
Fix links to ensure that they don't cause 404 errors when published to
Github Pages.

Fixes gh-304
11 years ago
Phillip Webb 1552759584 Fix package tangle by moving AsciiBytes 11 years ago
Phillip Webb 3e7af3ddb8 Improve exception messages on nested jar failure
Updates gh-284
11 years ago
Phillip Webb 14bc06a387 Pull-up duplicated code to Launcher 11 years ago
Phillip Webb c852fb5a79 Update packaged JARs to use standard JarLauncher
Change CLI generated JARs to use the standard `JarLauncher` instead of
a custom `JarRunner`. The `PackagedSpringApplicationLauncher` is used
as the `Start-Class` which in turn calls `SpringApplication.run()`.
11 years ago
Andy Wilkinson 96e10104e4 Add a command to produce a self-contained executable JAR for a CLI app
A new command, jar, has been added to the CLI. The command can be
used to create a self-contained executable JAR file from a CLI app.

Basic usage is:

spring jar <jar-name> <source-files>

For example:

spring jar my-app.jar *.groovy

The resulting jar will contain the classes generated by compiling the
source files, all of the application's dependencies, and entries
on the application's classpath.

By default a CLI application has the current working directory on
its classpath. This can be overridden using the --classpath option.
Any file that is referenced directly by the classpath is always
included in the jar. Any file that is found a result of being
contained within a directory that is on the classpath is subject to
filtering to determine whether or not it should be included. The
default includes are public/**, static/**, resources/**,
META-INF/**, *. The default excludes are .*, repository/**, build/**,
target/**. To be included in the jar, a file must match one of the
includes and none of the excludes. The filters can be overridden using
the --include and --exclude options.

Closes #241
11 years ago
Phillip Webb ef2eb8af6c Fix URL from String creation to work on Windows
Fixed the nested jar URLHandler to correctly deal with files on
Windows.

Fixes gh-269
11 years ago
Phillip Webb 0afdb71345 Better getRootJar exception capturing 11 years ago
Dave Syer 91998d5942 Add loader.args to PropertiesLauncher
Also new section of README for propery keys used by the
launcher.
11 years ago
Phillip Webb 01550fcec6 Allow `new URL(String)` with nested JARs
Update JarFile to allow the custom registration of a JAR
`URLStreamHandler` that allows `jar:` URLs to be constructed from
Strings. This removes the previous requirement that all nested JAR URLs
be created with a 'context'.

To supported nested JARs the `java.protocol.handler.pkgs` system
property is changed so that our custom URLHandler is picked for 'jar'
protocols in preference to the Java default.

Fixes gh-269
11 years ago
Phillip Webb c1f8fd2bac Fix some compile warnings 11 years ago
Phillip Webb 43e54d38f7 Make fields private where possible 11 years ago
Phillip Webb ac54d7fe3c Final polish before 1.0.0.RC1 11 years ago
Phillip Webb 853b0a8027 Fix some maven warnings 11 years ago
Phillip Webb cdda330acd Update copyright header for files changed in 2014 11 years ago
Phillip Webb 68293f34af Upgrade version to 1.0.0.BUILD-SNAPSHOT
Fixes fg-243
11 years ago
Phillip Webb 4fc9dfc2d5 Revert "Add launcher.count as useful performance testing aid"
This reverts commit e1605b4691.
11 years ago
Dave Syer e1605b4691 Add launcher.count as useful performance testing aid 11 years ago
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 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
Dave Syer 99fd32d408 Attempt to make URL comparison windoze proof 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
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
Dave Syer fc40ad4b48 Add short description of launchers 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 b772f7c2e4 Polish
Minor formatting and consistent copyright header.
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
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
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
Phillip Webb 878ff13620 Documentation updates 11 years ago
Phillip Webb 0b7256e7f9 Fix compile failure on JDK 6 11 years ago
Phillip Webb cf655945aa Polish 11 years ago
Phillip Webb 4e11ae1671 Documentation
Various updates to README.md files.
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