Commit Graph

278 Commits (7685d18ed85bdad26436d0359424cac394db8f2a)

Author SHA1 Message Date
Spring Buildmaster 74d0c5185a Next development version 10 years ago
Phillip Webb 92899474ac Polish 10 years ago
Andy Wilkinson 6f8d4778ad Prevent a jar from being repackaged more than once
Previously, Repackager would repackage a jar file as many times as
it was asked to do so. This lead to problems if a user made a mistake
when using Maven that led to the package phase being driven twice,
for example by running "mvn clean install package".

This commit updates Repackager so that a repackage call becomes a
no-op if the source jar's manifest already contains the
Spring-Boot-Version attribute which is added by repackaging.

Fixes #1251
10 years ago
Dave Syer 8853c7c352 Ensure properties that are not enumerable can be resolved from placeholders
Before this change a property whose key was in a non-enumerable property source would
not resolve placeholders, leading to ${style} values in @ConfigurationProperties beans
even if the placeholders ere resolvable.
10 years ago
Spring Buildmaster 40327e1ae6 Next development version 11 years ago
Phillip Webb 7455e4e86f Restore support for `files` gradle dependencies
Allow `compile files("$rootDir/vendor/foo.jar")` style declarations
with the jars repackaged from the gradle plugin.

Fixes gh-1215
11 years ago
Andy Wilkinson 1ffdc90f04 Further enhancements to Gradle repackaging logic
This commit refines the changes made under 4be688aa. 4be688aa made the
default jar task a special case which broke repackaging of the archive
produced by the default war task.

This commit refines RepackageTask’s logic so that, when it’s enabled,
it will repackage a jar task’s archive if:

- The jar task is equal to RepackageTask.withJarTask
- The name of the jar task is equal to RepackageTask.withJarTask
- RepackageTask.withJarTask is null, the jar task is not referenced
  by another RepackageTask’s withJarTask, and the jar task has an
  empty classifier

The last of these three is the default case and ensures the, when the
Spring Boot plugin is applied, default jar and war artifacts are
repackaged. The classifier check is required to prevent default source
and javadoc artifacts from being repackaged.

Fixes #1204
11 years ago
Andy Wilkinson 4be688aa78 Fix Gradle repackaging so it is only performed on the desired jars
The logic that determined whether or not the repackaging action should
be applied to a particular jar task was broken and caused problems
when a custom RepackageTask was used in a project's build.

This commit updates the logic so that repackaging will be applied:

 - To the default jar task if RepackageTask.withJarTask is null
 - To a jar task if it is equal to RepackageTask.withJarTask
 - To a jar task if its name is equal to RepackageTask.withJarTask

Repackaging is not applied if:

 - RepackageTask.enabled is false

Numerous integration tests have been added to verify the repackaging
behaviour.

Fixes #1204
11 years ago
Phillip Webb 8054426803 Format source code 11 years ago
Phillip Webb fa88c481a5 Remote trailing whitespace 11 years ago
Phillip Webb 6634322c13 Upgrade groovy-eclipse-batch version 11 years ago
Andy Wilkinson 53be0f8db7 Fix Gradle plugin logic for removing provided artifacts
The new ResolvedArtifact-based minus implementation was checking the
wrong Set when deciding whether or not a ResolvedArtifact should
be included in the result. This was leading to provided dependencies,
that should have only been packaging in WEB-INF/lib-provided also
being packaged in WEB-INF/lib.

The WarPackaging tests have been updated. In addition to checking that
WEB-INF/lib-provided does not contain anything that’s unexpected, they
also verify the contents of WEB-INF/lib

Fixes #1187
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
Dave Syer 43cf95b845 Tidy up (remove unneeded property) RepackageTask 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 5f8fbfd73a Add Library abstraction
Add a Library class update the LibraryCallback interface and
implementations to use it. This change is in preparation for
an addition `unpack` flag that will be required to allow the
automatic unpacking of certain nested jars.

See 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 5de2661b43 Drop RepackageTask.getDependencies()
Drop `RepackageTask.getDependencies` from the gradle plugin in favor of
exposing `getLibraries()` and using the callback.
Drop getDependencies
11 years ago
Phillip Webb c713c8091d Polish 11 years ago
Phillip Webb 72a2e5bc02 Polish Gradle repackage 11 years ago
Dave Syer 542896b28f Support for non-executable JAR in addition to the repackaged one
Stretches the Gradle boot plugin a bit, so there's a sample build
in the "profile" sample. Howto docs give examples.

Fixes gh-1135
11 years ago
Dave Syer 1b97e8d921 Skip dependency exclusions if groupId is null
Fixes gh-1133
11 years ago
Dave Syer 08ae390696 Add dependencies to inputs in bootRepackge
See gh-1113
11 years ago
Dave Syer 772df9bea7 Add inputs to gradle bootRepackage task
See gh-1113
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
Dave Syer 3411995736 Revert BootRunTask changes since they don't add anything
(Was an attempt to get Cygwin to recognise the interrupt, but it seems
to be doomed so not worth having the extra code in there really.)
11 years ago
Dave Syer e088ecd1bc Re-order shutdown hook in BootRunTask 11 years ago
Dave Syer a8663586dc Trap SIGINT in Gradle plugin 11 years ago
Phillip Webb 179e1558f6 Polish 11 years ago
Dave Syer 2433f721bc Add 'classifier' property to Gradle plugin
The default behaviour doesn't change with this commit, but now
the user has the option to specify a 'classifier' property
either in springBoot { classifier = 'exec' } (i.e. globally
for all repackage tasks) or in each repackage task, e.g.
bootRepackage { classifier = 'exec' }. In that case the original
archive is not overwritten but copied into <file>-<classifier>.jar
(or .war etc.) and then enhanced.

Fixes gh-1113, fixes gh-141 also I believe.
11 years ago
Dave Syer f0393f9ca6 Remove deprecated use of Compile to work with Gradle 2.0+
The class Compile was deprecated and will be removed in Gradle 2.0 (it is
already removed in the release canidate).

Instead we should use JavaCompile. Fixes gh-1066.
11 years ago
Dave Syer 4a40e8f833 Support for main class detection in installApp
I'm sure someone can do a better job of this, but here's a proposal
that works. It uses our FindMainTask to set the relevant properties
if theu are missing in the application plugin.

Fixes gh-1105
11 years ago
Phillip Webb 3a8a127285 Implement simpler exclusion logic for Gradle
Simplify the exclusion logic used in Gradle by implementing implicit
exclusions rather than trying to detect transitive excludes.

This commit reverts much of the code originally included to fix gh-1047
which adds far too much complexity to the build and still doesn't solve
the underlying issue.

Fixes gh-1103
11 years ago
Dave Syer f83c6aa7c1 Grab main class from "run" task if it exists
Fixes gh-1099
11 years ago
Phillip Webb d6a14c2b99 Revert "Add @Conditional to prevent HATEOAS blowing up"
This reverts commit e6e8907770
which has an incorrect commit message.
11 years ago
Dave Syer e6e8907770 Add @Conditional to prevent HATEOAS blowing up 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