Commit Graph

456 Commits

Author SHA1 Message Date
Andy Wilkinson
b146e76b63 Merge branch '1.1.x' 2014-09-07 18:27:23 -05:00
Andy Wilkinson
06ffd9dd86 Fix configuration of Spring Loaded on Gradle 1.6
The applicationDefaultJvmArgs property was added in Gradle 1.7. This
commit updates RunPluginFeatures to access the property defensively
so that the plugin can be used with Gradle 1.6.

Fixes gh-1511
2014-09-07 18:23:16 -05:00
Spring Buildmaster
d63e4b4329 Next development version 2014-09-04 12:15:18 -07:00
Phillip Webb
9cc893cd35 Merge branch '1.1.x'
Conflicts:
	spring-boot/src/test/java/org/springframework/boot/bind/RelaxedPropertyResolverTests.java
2014-09-04 09:41:58 -07:00
Phillip Webb
eaa3bd040d Apply eclipse formatting rules 2014-09-04 09:39:58 -07:00
Phillip Webb
6f62fc854b Merge branch '1.1.x' 2014-09-03 11:45:54 -07:00
Stephane Nicoll
f46fe32264 Add group discriminant in case of conflict
Prior to this commit, the repackage goal silently ignored the case of
two libraries having the same name and version but a different group.
As a result, the second library was overwriting the first one in the
repackaged jar.

This commit adds support for custom Library names and updates the
Maven and Gradle plugins so that the name includes the group ID
when there would otherwise be a duplicate.

Fixes gh-1475
2014-09-03 11:22:53 -07:00
Stephane Nicoll
a98c7613bf Merge branch '1.1.x' 2014-09-02 15:55:13 +02:00
Stephane Nicoll
9a8d05bd43 Clarify addResources parameter description
This commit clarifies the role of the 'addResources' flag and makes
it explicit that any duplicate found in the target directory are
actually removed

Fixes gh-1479
2014-09-02 15:54:40 +02:00
Phillip Webb
0dc389f5b3 1.Z -> 1.2 2014-08-28 17:57:25 -07:00
Phillip Webb
fdd79907e9 Polish 2014-08-26 09:43:27 -07:00
Phillip Webb
1381fe172e Polish 2014-08-26 09:40:33 -07:00
Andy Wilkinson
2b47d608f3 Merge branch '1.1.x' 2014-08-26 17:06:53 +01:00
Andy Wilkinson
28f7cf4487 Convert URL to File using a URI so that URL-encoding is removed
Fixes #1429
2014-08-26 17:04:50 +01:00
Stephane Nicoll
d1f4fd0ecb Add skip parameter to repackage goal
This commit adds a 'skip' parameter to the 'repackage' goal that is
false by default. When this parameter is enabled, the repackage goal
does not run at all.

This can be used when repackaging should occur conditionally or
when a particular module in a hierarchy should not use this feature.

Fixes gh-1424
2014-08-23 10:02:08 +02:00
Andy Wilkinson
2ed24ddcd5 Merge branch '1.1.x' 2014-08-21 16:26:52 +01:00
Andy Wilkinson
9717b7d840 Preserve JVM args when auto-configuring a Java agent in Gradle bootRun
Fixes #1411
2014-08-21 16:26:36 +01:00
Andy Wilkinson
0e7757decd Merge branch '1.1.x' 2014-08-21 15:38:13 +01:00
Andy Wilkinson
69c61d0e8e Include transitive file dependencies during Gradle repackaging
Previously, ProjectLibraries only considered a configuration's
direct file dependencies. This meant that a transitive file
dependency that should have been pulled in via a project dependency
was not included in the repackaged jar's lib directory.

ProjectLibraries has been updated to walk down the tree of project
dependencies and create libraries for any file dependencies that
are found.

Fixes gh-1368
2014-08-21 15:27:08 +01:00
Dave Syer
399238384f Merge branch '1.1.x' 2014-08-19 14:16:44 +01:00
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
2014-08-19 14:16:10 +01:00
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
2014-08-19 14:16:10 +01:00
Phillip Webb
54625cc2a0 Make LaunchedURLClassLoader lock provider static
Fixes gh-1380
2014-08-18 20:08:03 -07:00
Spring Buildmaster
74d0c5185a Next development version 2014-08-07 11:59:17 -07:00
Phillip Webb
7641f23f71 Merge branch '1.1.x' 2014-08-06 12:26:29 -07:00
Phillip Webb
92899474ac Polish 2014-08-06 09:10:23 -07:00
Andy Wilkinson
be2803a776 Merge branch '1.1.x' 2014-07-30 11:10:56 +01:00
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
2014-07-30 11:07:41 +01:00
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
2014-07-29 14:12:52 -07:00
Dave Syer
fc9b160a72 Merge branch '1.1.x' 2014-07-17 09:04:44 +01:00
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.
2014-07-17 09:02:04 +01:00
Stephane Nicoll
249e09d9bc Switch master to 1.2.0.BUILD-SNAPSHOT 2014-07-11 10:44:05 +02:00
Spring Buildmaster
40327e1ae6 Next development version 2014-07-08 02:33:36 -07:00
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
2014-07-07 13:24:33 -07:00
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
2014-07-03 13:33:32 +01:00
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
2014-07-03 11:42:11 +01:00
Phillip Webb
8054426803 Format source code 2014-07-02 15:17:25 -07:00
Phillip Webb
fa88c481a5 Remote trailing whitespace 2014-07-02 15:17:14 -07:00
Phillip Webb
6634322c13 Upgrade groovy-eclipse-batch version 2014-07-02 14:06:54 -07:00
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
2014-07-01 10:06:47 +01:00
Spring Buildmaster
981669b7c0 Next development version 2014-06-26 14:09:54 -07:00
Phillip Webb
35b26b52f2 Add caching to JarFile.getUrl()
Fixes gh-1178
2014-06-26 11:23:35 -07:00
Phillip Webb
200cd535c2 Revert "Next development version"
This reverts commit 67189477fe.
2014-06-26 11:03:09 -07:00
Spring Buildmaster
67189477fe Next development version 2014-06-26 10:51:35 -07:00
Phillip Webb
9632abf825 Formatting and cleanup 2014-06-26 09:41:15 -07:00
Phillip Webb
7e7733d45d Deal with spaces in file references
Fixes gh-1169
2014-06-25 15:43:07 -07:00
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
2014-06-25 14:32:31 -07:00
Dave Syer
43cf95b845 Tidy up (remove unneeded property) RepackageTask 2014-06-25 13:33:26 +01:00
Spring Buildmaster
542f3cbda8 Next development version 2014-06-24 13:53:56 -07:00
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
2014-06-24 11:46:15 -07:00
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
2014-06-24 00:46:56 -07:00
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
2014-06-24 00:34:19 -07:00
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
2014-06-23 22:35:37 -07:00
Phillip Webb
5de2661b43 Drop RepackageTask.getDependencies()
Drop `RepackageTask.getDependencies` from the gradle plugin in favor of
exposing `getLibraries()` and using the callback.
Drop getDependencies
2014-06-23 22:31:16 -07:00
Phillip Webb
c713c8091d Polish 2014-06-23 19:41:22 -07:00
Phillip Webb
72a2e5bc02 Polish Gradle repackage 2014-06-23 19:34:02 -07:00
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
2014-06-23 11:08:58 +01:00
Dave Syer
1b97e8d921 Skip dependency exclusions if groupId is null
Fixes gh-1133
2014-06-22 19:20:51 +01:00
Dave Syer
08ae390696 Add dependencies to inputs in bootRepackge
See gh-1113
2014-06-22 09:53:11 +01:00
Dave Syer
772df9bea7 Add inputs to gradle bootRepackage task
See gh-1113
2014-06-20 22:25:11 +01:00
Phillip Webb
20fb55ea47 Polish 2014-06-20 10:29:47 -07:00
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
2014-06-20 10:29:47 -07:00
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
2014-06-20 10:29:47 -07:00
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
2014-06-20 10:29:47 -07:00
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
2014-06-20 10:29:47 -07:00
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.)
2014-06-20 14:17:30 +01:00
Dave Syer
e088ecd1bc Re-order shutdown hook in BootRunTask 2014-06-20 14:17:30 +01:00
Dave Syer
a8663586dc Trap SIGINT in Gradle plugin 2014-06-20 11:27:56 +01:00
Phillip Webb
179e1558f6 Polish 2014-06-18 12:48:42 -07:00
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.
2014-06-18 16:06:09 +01:00
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.
2014-06-18 12:48:26 +01:00
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
2014-06-17 10:11:19 +01:00
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
2014-06-16 16:54:48 -07:00
Dave Syer
f83c6aa7c1 Grab main class from "run" task if it exists
Fixes gh-1099
2014-06-16 12:43:35 -07:00
Phillip Webb
d6a14c2b99 Revert "Add @Conditional to prevent HATEOAS blowing up"
This reverts commit e6e8907770
which has an incorrect commit message.
2014-06-16 12:42:41 -07:00
Dave Syer
e6e8907770 Add @Conditional to prevent HATEOAS blowing up 2014-06-16 18:20:22 +01:00
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
2014-06-15 09:11:51 -07:00
Spring Buildmaster
4ca26a21dc Next development version 2014-06-11 10:46:27 -07:00
Phillip Webb
c861f24ba3 Switch mergeDependencies to use a set. 2014-06-11 10:04:06 -07:00
Andy Wilkinson
f5f3903538 Resolve versionManagement configuration lazily and preserve exclusions
Previously, the versionManagement configuration was resolved as part of
the Boot Gradle plugin being applied. This meant that no dependencies
could be added to it and attempting to do so would result in a failure:
“You can't change a configuration which is not in unresolved state”.
This commit updates ApplyExcludeRules to wrap its processing in a
before resolve action. This defers the resolution of the
versionManagement configuration until one of the project’s other
configurations is being resolved. Fixes #1077

In addition to the above, the transitive exclusions that the Gradle
plugin provides were being lost if custom version management provided
a version for the same dependency. This commit updates
AbstractDependencies to preserve the exclusions from an existing
dependency declaration while using the version from the newer
dependency. This ensures that the exclusions remain while allowing
versions to be overridden. Fixes #1079
2014-06-11 15:51:39 +01:00
Spring Buildmaster
05ed7b3bcd Next development version 2014-06-10 12:40:35 -07:00
Phillip Webb
3007a777d0 Roll back to 1.1.0.BUILD-SNAPSHOT 2014-06-10 09:00:08 -07:00
Spring Buildmaster
c650f2391e Next development version 2014-06-09 21:55:19 -07:00
Phillip Webb
f0c0f00089 Polish 2014-06-09 15:20:37 -07:00
Andy Wilkinson
02de6e3531 Remove signal handling race condition from RunProcess
Fixes #1061
2014-06-09 21:29:33 +01:00
Phillip Webb
b5d267ca89 Polish 2014-06-09 12:33:49 -07:00
Phillip Webb
cef7ad7798 Support automatic exclude rules with Gradle
Update the Spring Boot Gradle plugin to automatically apply exclude
rules to dependencies.

See gh-1047
2014-06-09 00:41:22 -07:00
Phillip Webb
addc1f77bd Support transitive excludes in dependency-tools
Update spring-boot-dependency-tools to support transitive excludes.
Transitive excludes are useful with Gradle which considers each
dependency independently (see GRADLE-3061).

Transitive excludes are supported by parsing the dependency-tree file
from spring-boot-versions.

See gh-1047
2014-06-09 00:37:55 -07:00
Phillip Webb
9b982dabdb Restore dependency-tools API compatibility
Refactor dependency-tools to restore API compatibility with Spring
Boot 1.0. This should reduce reflection hacks that tools such as Gretty
would otherwise have to make.

See gh-1035
2014-06-08 23:58:02 -07:00
Phillip Webb
e891aa3525 Polish 2014-06-06 22:58:43 -07:00
Rob Winch
adb2205dd9 Make SpringBootPlugin more Groovy
- Remove ;
- Remove unnecessary public modifiers
- Remove unnecessary .class suffixes

Fixes gh-1032
2014-06-05 08:45:46 +01:00
Rob Winch
52382f962e Default Compile tasks to use UTF-8 encoding
We also convert the SpringBootPlugin to be .groovy to ease defaulting
the encoding to UTF-8. We do not make the file any "more groovy" to leave
this to a distinct commit.
2014-06-05 08:43:46 +01:00
Dave Syer
bc5a4bcc1e Compiler warnings 2014-06-03 08:44:30 +01:00
Dave Syer
3c6dfb72c5 Add ExitStatus to Command.run()
The main difference for now is the removal of the --nohup
(slightly hacky) option in TestCommand. Now a TestCommand
can signal to its caller that it wants to be hung up.

Fixes gh-975
2014-05-29 13:58:12 +01:00
Phillip Webb
bdcb9407eb Restore commons-logging dependency for spring-boot
Restore the dependency on commons-logging (transitively via spring-core)
for spring-boot. This means that we are not tied directly to SLF4J, but
it is still an option that can be used via `jcl-over-slf4j`.

The `spring-boot-starter-parent` continues to replace `commons-logging`
with `jcl-over-slf4j`.

Fixes gh-981
2014-05-28 23:03:26 +01:00
Andy Wilkinson
7a8be3d600 Use Spring Framework bom and fully exclude commons-logging
Closes #955
Closes #978
2014-05-28 20:12:29 +01:00
Phillip Webb
99af5dbe23 Merge branch '1.0.x'
Conflicts:
	spring-boot-dependencies/pom.xml
2014-05-28 14:57:13 +01:00
Phillip Webb
d848f03c43 Fix URL methods in JarURLConnection
Update JarURLConnection to return correct values from `getURL()`,
`getJarFileURL()` and `getEntryName()`.

Fixes gh-973
2014-05-28 14:41:15 +01:00
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.
2014-05-28 14:35:28 +01:00
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.
2014-05-27 21:25:34 +01:00
Phillip Webb
1a475102de Polish 2014-05-22 20:33:08 +01:00
Phillip Webb
794808b6b8 Various improvements to the Gradle plugin
Refactor and rework several areas of the Gradle plugin:

- Refactor package structure into functional areas and configure each
  area separately via a new PluginFeatures interface.
- Convert BootRunTask to extend RunTask rather than attempting to
  find existing RunTasks.
- Simplify agent integration by no longer needing specific BootRunTask
  code.
- Update the repackage task to consider the `mainClassName` property
  in addition to `springBoot.mainClass`.
- Automatically set `mainClassName` when calling `run` or `runBoot`
  from `springBoot.mainClass` if there is one.
- Ensure that explicitly defined `main` options on JavaExec tasks always
  take precedence.

Fixes gh-547, gh-820, gh-886, gh-912
2014-05-22 18:08:22 +01:00
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
2014-05-21 13:37:05 +01:00
Phillip Webb
4fd4744724 Add spring-boot-versions project
Add a new maven project containing a versions.properties file and
an effective POM. Rework existing projects to use the versions
artifacts.

Partially reverts 307fbba9e4

Fixes gh-913
2014-05-20 23:55:31 +01:00
Phillip Webb
8bcda1bcbe Polish 2014-05-20 18:26:56 +01:00
Andy Wilkinson
307fbba9e4 Use spring-boot-dependencies as spring-boot-dependency-tools' parent
Previously spring-boot-dependency-tools used spring-boot-tools as its
parent. This meant that it inherited spring-boot-parents' dependency
management that we did not want to expose to applications. The
solution to this was to generate the effective pom and then filter
out any thing that did not appear in spring-boot-dependencies' pom.
This filtering had to unwanted side-effect of breaking bom imports:
the effective pom would contain the dependency management from the
imported bom, but this would be filtered out as the entries didn't
appear in spring-boot-dependencies' pom.

This commit updates spring-boot-dependency-tools to use
spring-boot-dependencies as its parent. This means that its effective
pom contains the desired dependency management and nothing more,
allowing the filtering logic to be removed.

The use of Spring Security's bom has been reinstated as it will now
work as intended and versions for its modules will be available in the
CLI and via the Gradle plugin.

Closes #825
Fixes #838
2014-05-20 14:33:19 +01:00
Mark Ingram
dd83b58b05 Exact match for groupId excludes
Previous to this commit, any groupId starting with one of the
configured exclude would be excluded as well. This potentially
leads to unintentional dependency filtering: for example the
GroupIdFilter with an exclusion of "org.springframework"
also removes "org.springframework.boot" dependencies.

Add MatchingGroupIdFilter that uses an exact match instead.

See #649
2014-05-19 15:39:12 +02:00
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
2014-05-16 14:53:32 +01:00
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
2014-05-16 14:51:06 +01:00
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
2014-05-16 14:50:11 +01:00
Phillip Webb
7b170368e5 Require single main class
Update run tasks to ensure that only a single main class is required
when performing a class search.

See gh-886
2014-05-16 10:45:17 +01:00
Phillip Webb
01fcf61140 Polish 2014-05-15 09:51:16 +01:00
Stephane Nicoll
158b6a5c07 Skip the execution of repackage in parent projects
If an execution of the repackage goal is present in a project with
'pom' packaging, it is now skipped. This allows to configure the
plugin in the parent.

Fixes gh-867
2014-05-15 10:36:41 +02:00
Shawn Clark
4021ad43f7 Fix wrong closing tag
Fixes gh-874
2014-05-15 10:02:01 +02:00
Stephane Nicoll
dacad22fd3 Fix jvmArgs usage example
The  configuration within an execution is only applied when that
particular execution is invoked as part of the build. It is not
applied when the plugin is invoked on the command line (i.e.
mvn spring-boot:run).

This commit clarifies the situation so that users can safely copy/paste
those bits and get the expected behavior.

 Fixes gh-875
2014-05-15 09:59:46 +02:00
Stephane Nicoll
a93784207e Add jvmArguments property to maven plugin
The maven plugin now forks a new process when it starts a boot app. This
makes remote debugging of the app impossible without the ability to pass
extra JVM arguments.

This commit adds a "jvmArguments" attribute to the RunMojo that defines
additional JVM arguments to set on the forked process.

Fixes gh-848
2014-05-14 13:26:11 +02:00
Phillip Webb
506c0f50b9 Allow meta-data driven version overrides in Gradle
Add a `versionManagement` gradle configuration which can be used to
provide alternative version meta-data. Primarily added so that the
Spring IO platform can provide version overrides without causing a
cyclic build dependency.

Fixes gh-750
2014-05-08 14:37:42 +01:00
Dave Syer
894482df1a Initialize logback is it is present in CLI
This (empirically) fixes gh-726 using a new utility
(LogbackInitializer) in the loader tools. If anyone has enough
Gradle fu to understand where to put it (after the classpath is established
but before compilation) we could do the same thing in the Gradle plugin
(and that would fix gh-724).
2014-05-07 07:21:48 -07:00
Phillip Webb
32d2fc25c7 Polish 2014-05-07 11:01:02 +01:00
Stephane Nicoll
15501eaafb Exclude support in the maven plugin
This commit provides several options to exclude one or more
dependencies:

* excludes allows to specify an arbitrary number of exclude sub
  element defining the groupId and artifactId of the dependency
  to exclude
* excludedGroupIds defines the comma separated list of groupIds
  to exclude
* excludeArtifactIds defines the comma separated list of artifactIds
  to exclude

While any artifact can be excluded, this is designed to exclude
provided-scoped dependencies that should not be bundled in the
executable jar/war.

The outcome of java -jar myapp.jar should be consistent with the run
goal: these exclusions are therefore applied to the classpath that
the run goal computes to launch the application.

This commit also adds some integration tests and updates the
plugin's documentation

Fixes gh-649, gh-650 and gh-674
2014-05-06 15:15:28 +02:00
Stephane Nicoll
a0166076e0 Fix wrong import 2014-05-06 14:56:24 +02:00
Stephane Nicoll
33082fd56d Harmonized maven dependency management
This commit harmonizes the dependency management of internal modules
so that versions can be omitted everywhere. Update the maven coordinates
to provide the full groupId for consistency
2014-05-05 14:29:01 +01:00
Phillip Webb
34b7bb20fd Add maven implicit plugin group ID
Add previously implicit <groupId>org.apache.maven.plugins</groupId>
to plugin declarations.
2014-05-02 23:03:31 +01:00
Phillip Webb
7f41dbd677 Resore code formatting 2014-05-02 22:53:25 +01:00
Stephane Nicoll
bf4b347a96 Fix build failure
Commit e26e06d5dd broke the full build as the generated zip file for
the size is not generated. Actually, the site plugin has a jar goal that
is exactly meant for what we need to do.

This commit removes the use of the assembly plugin and invokes the
jar goal of the site plugin when the full profile is enabled.

Relates to #749
2014-05-02 22:21:43 +02:00
Dave Syer
1b7d8d9ade Add SignalUtils to handle OS interrupts
Extract into a utility to be shared between Shell and RunMojo

Fixes gh-773
2014-05-02 20:17:22 +01:00
Stephane Nicoll
888703cf26 Add maven plugin documentation
This commit adds the generated site for the maven plugin alongside
the developer guide and javadoc. The maven plugin is available in
the "/maven-plugin" context.

The advanced information described in the developer guide have
been migrated to the plugin site as most the information is taken
from the code itself, which avoids duplication.

Fixes #749
2014-05-02 17:12:56 +01:00
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
2014-05-02 15:03:16 +01:00
Dave Syer
8b251e546a Monkey with process forking for Windoze
There were several problems to fix. 1) a bug in the
JDK (1.7 up to 7_60):

https://bugs.openjdk.java.net/browse/JDK-8023130

which we can work around by detecting buggy VMs and not trying
to use inheritIO. 2) File<->URL conversion is platform dependent
and we shouldn't make any assumptions. The problem in this case
was that file URLs contain a ":" so they can 't be added to a
path in UNIX, but on Windows you need the absolute path with the
colon. Solution: use Files on the classpath for spring-boot:run.

Hopefully also fixes gh-767
2014-05-02 12:55:13 +01:00
Dave Syer
329010d29e Normalize paths in JvmUtils
Fixes problem in Windoze where file paths cannot be so easily
converted to URLs.

Fixes gh-767
2014-05-02 11:45:45 +01:00
Dave Syer
b04304b691 Add @since 2014-05-02 11:22:19 +01:00
Dave Syer
438cff252d Allow multiple agents to be attached 2014-05-01 09:48:05 +01:00
Dave Syer
b884a73396 Share RunProcess with CLI 2014-05-01 09:48:05 +01:00
Dave Syer
240788862e Make RunMojo fork a new process
By forking a new process we get to attach the agent
much earlier and JPA can co-exist.

Fixes gh-648
2014-05-01 09:48:05 +01:00
Phillip Webb
f53ee406c1 Merge branch '1.0.x' 2014-04-30 22:06:24 +01:00
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
2014-04-30 22:05:47 +01:00
Phillip Webb
6025f45aa0 Polish 2014-04-30 21:53:24 +01:00
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
2014-04-30 15:28:04 +01:00
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
2014-04-30 13:08:12 +01:00
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
2014-04-26 14:14:05 +01:00
sopov.ivan
10d82e28ff minor - correcting modifiers order 2014-04-25 18:20:09 +04:00
Phillip Webb
64a835e91a Move master to 1.1.0.BUILD-SNAPSHOT 2014-04-24 12:45:20 +01:00
Spring Buildmaster
d3954a1703 Next development version 2014-04-24 02:24:28 -07:00
Phillip Webb
fad5ce45db Polish 2014-04-23 12:35:33 +01:00
Dave Syer
34604a9602 Add assertion about non-special resource 2014-04-22 09:25:45 +01:00
Dave Syer
2d16c59147 Clarify usage of run.arguments with Maven plugin 2014-04-17 04:42:31 -07:00
Andy Wilkinson
283f1b169f Ensure that local file dependencies are packaged by the Gradle plugin
Prior to this commit, a dependency on a local file was not being
packaged by the Gradle plugin. This was a regression from the behaviour
in 0.5.0.M6 caused by the move to using a ResolvedConfiguration and
ResolvedArtifacts (4f677bec) to gain access to an artifact's type so
that non-jar artefacts could be filtered out. Since then, the approach
to filtering has been changed (38585bf3) and access to an artifact's
type is no longer needed.

This commit updates ProjectLibraries to restore its use of a
FileCollection rather than a ResolvedConfiguration when getting hold of
the files in a configuration. This means that the resulting jar will
now include dependencies that aren't resolved, such as those that are
provided as local files. The filtering that is applied to the files
is unaffected by this change and only files that are zip files will be
included.

Fixes #672
2014-04-15 15:44:54 +01:00
Dave Syer
620d8eb87e Re-order if blocks in RunMojo
Avoids loading a class if not needed, but doesn't seem to solve
any actual problems. I'll leave it in in case it helps later.

Testing gh-648
2014-04-11 16:48:00 +01:00
Dave Syer
bc7c6aa40c Print MAVEN_OPTS=-noverify for copy-pasters 2014-04-11 06:53:04 +01:00
Spring Buildmaster
a5864ebcd0 Next development version 2014-04-06 22:43:18 -07:00
Phillip Webb
2bb0f744e0 Polish 2014-04-06 21:49:12 -07:00
Dave Syer
2b616fb7d9 Extract logic for duplicate file removal so it can be shared
.. between Maven and Gradle plugins. Also fixed bug in recursive
scanning logic.

Really fixes gh-614
2014-04-02 11:02:06 +01:00
Dave Syer
ea2c491d1f Do not delete duplicate directories from main classpath
Before this change we were too aggressive in deleting duplicate resources
since directories might not have identical contents, and yet they were
being deleted anyway.

Fixes gh-614
2014-04-01 17:36:43 +01:00
Spring Buildmaster
15e9dbe98b Next development version 2014-04-01 03:05:51 -07:00
Phillip Webb
1e68b7e0a9 Remove superfluous <packaging> tags from POMs 2014-04-01 02:07:43 -07:00
Phillip Webb
0af7f7e347 Add missing POM info 2014-04-01 02:07:42 -07:00
Phillip Webb
488b03387f Polish POM formatting 2014-04-01 02:07:36 -07:00
Phillip Webb
6f9bb233ad Revert "Next development version"
This reverts commit b67bb70ee3.
2014-04-01 00:38:48 -07:00
Spring Buildmaster
b67bb70ee3 Next development version 2014-03-31 22:38:42 -07:00
Phillip Webb
ac4cdd33c3 Revert "Next development version"
This reverts commit 1d0eea12eb.
Returning to 1.0.0.BUILD-SNAPSHOT for an updated release.
2014-03-31 17:14:30 -07:00
Spring Buildmaster
1d0eea12eb Next development version 2014-03-28 11:47:09 -07:00
Phillip Webb
beaddb2362 Polish 2014-03-26 13:29:26 -07:00
Phillip Webb
54a5718b98 Minor polish 2014-03-25 22:20:43 -07:00
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
2014-03-24 22:41:05 -07:00
Phillip Webb
e23bcdbe29 Update OSX Java 1.6 compatibility fix for plugins
Change the initial fix for OSX Java 1.6 compatibility by removing the
need for a direct `tools.jar` dependency.

It appears that `system` dependencies are always pulled in when
used in a Maven plugin. This makes the the dependency on `tools.jar`
particularly brittle since we need to make assumptions about where
the jar is located.

Since the tools jar is *only* needed for Spring Loaded support, the
plugin has now been updated to locate the jar programmatically and
call it via reflection. This should reduce the risk of problems when
using the plugin and at the very least isolate them to Spring Loaded
support.

(See original commit b8c4720)

Fixes gh-497
2014-03-18 12:05:35 -07:00
Phillip Webb
ca0a12cedb Polish 2014-03-18 10:23:54 -07:00
Phillip Webb
f55ca99214 Polish zip file detection 2014-03-18 10:23:54 -07:00
Dave Syer
ae512193bf Add missing test mannifest 2014-03-18 16:37:53 +00:00
Dave Syer
935131cdab Clarification regarding format of loader.path 2014-03-18 15:31:45 +00:00
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
2014-03-18 14:28:23 +00:00
Dave Syer
2c60449836 Be defensive with File.listFiles() 2014-03-18 14:28:23 +00:00
Andy Wilkinson
38585bf3b6 Omit any file that is not a zip when repackaging
When repackaging an archive, the files in the resulting lib directory
must be zip files. If they're not zip files, the resulting archive
may fail to run (#324).

The previous approach was to consider an artifact's type when deciding
whether or not it should be packaged. The type is a string and, while
there are a number of well-known values, it can essentially be anything.
This caused a problem with an artifact incorrectly being identified as
being unsuitable for inclusion (#489).

This commit changes the approach. Rather than looking at an artifact's
type, it looks at the first four bytes  of the archive's file. Only if
these header bytes matche that of a zip file is the artifact included.
This is a better match for the requirement that all files in lib be zip
files.

Fixes #489
2014-03-18 10:03:38 +00:00
Trevor Menagh
b8c472007a Make Spring Boot work in Java 1.6 on Mac OS X
Currently Spring Boot fails in Java 1.6 on Mac OS X due to the
"tools.jar" being integrated into classes.jar in the Apple version of
Java 6.

Apple fixed this with Java 7, but we should still support Java 6. We had
to roll back to maven-plugin-plugin 3.1 to make this work with Java 6
and 7.

All tests pass with Java 6 and Java 7.
2014-03-17 12:12:29 +00:00
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
2014-03-16 23:00:12 -07:00
Phillip Webb
80ac1fb0cd Polish 2014-03-15 13:02:01 -07:00
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
2014-03-13 09:03:11 +00:00
Dave Syer
4d172ca742 Remove duplicate resources from classpath
We had been making a special case for logback.xml anyway, so
extending that to simply deleting recursively all of
src/main/resources (or equivalent) from target/classes (or
equivalent) seems like it's perfectly justifiable.

Fixes gh-451
2014-03-10 17:04:44 +00:00
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
2014-03-06 11:36:47 +00:00
Spring Buildmaster
b0d4e8ae69 Next development version 2014-03-03 22:46:12 -08:00
Spring Buildmaster
cb8668a151 Release version 1.0.0.RC4 2014-03-03 22:46:05 -08:00
Dave Syer
6b5828a820 Be defensive if there is no main/classes 2014-02-27 10:55:23 +00:00
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
2014-02-25 12:38:25 +00:00
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.
2014-02-24 13:44:09 -08:00
Dave Syer
511fff05bb Check for a mainClass in "run" task if there is one
If there is a run task with an explicit main it can be used
by the repackage task (assuming its own native setting is
not used).

Fixes gh-389
2014-02-24 08:54:04 +00:00
Dave Syer
825fc2f7df Omit jar: prefix from jarFileUrl 2014-02-19 13:59:05 +00:00
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
2014-02-19 13:41:09 +00:00
Phillip Webb
b69c659d8f Polish 2014-02-18 21:58:09 -08:00
Dave Syer
77bac876ce Add support for Spring Loaded in Maven and Gradle
Requires Loaded 1.1.5 (or better).

For Maven you can just add springloaded to the dependencies of the
spring-boot plugin (and also set MAVEN_OPTS=-noverify).

For Gradle add springloaded to the build dependencies (-noverify
can be added by the plugin).

In both cases there is also support for adding an arbitrary java agent
via configuration. Samples are provided in
spring-boot-sample-[simple,web-ui].

The ApplicationPlugin is only added if there is no JavaExec task
already present, and additionally it computes its own man class if
none is provided. So "gradle run" and "gradle bootRun" look
superficially similar, but "bootRun" has extra options, including
the agent and Loaded support.

Fixes gh-251, gh-183
2014-02-18 10:05:28 +00:00
Spring Buildmaster
1367d57e8c Next development version 2014-02-13 13:19:12 -08:00
Spring Buildmaster
eaff1677a7 Release version 1.0.0.RC3 2014-02-13 13:18:56 -08:00
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
2014-02-13 11:12:46 -08:00
Phillip Webb
5863795e10 Polish 2014-02-11 12:39:55 -08:00
Andy Wilkinson
4f677bec08 Filter non-jar artifacts when packaging libs in Gradle plugin
Previously, the Gradle plugin would package all of a project's
dependencies in the jar's lib directory, irrespective of each
dependency's type. This led to non-jar artifacts being packaged in
the lib directory where only jar dependencies are expected. See #334
for an example failure.

This commit updates the Gradle plugin such that it only packages
dependencies of type jar, ejb, ejb-client, test-jar, or bundle. This
brings the Gradle plugin into line with the Maven plugin.

Fixes #334.
2014-02-10 15:51:29 +00:00
Phillip Webb
5e7d6e608d Update copyright header 2014-02-07 10:12:54 -08:00
Phillip Webb
d4f5cf4496 Filter non 'jar' types from nested libs
Update the `ArtifactsLibraries` used by the maven plugin to filter
based on artifact types. This prevent `.pom` files from accidentally
being packaged in `/libs` and ultimately resulting in 'Unable to find
ZIP central directory records' errors.

Fixes gh-324
2014-02-07 10:10:03 -08:00
Phillip Webb
d137bcd80d Polish gradle repackage task formatting 2014-02-05 23:16:37 -08:00
Janne Valkealahti
32453b27d3 Add mainClass option for Repackage task
Add `mainClass` property option to the Repackage task. If the property
is defined within a task, it works in the same way as if it defined
within the springBoot{} 'ext' properties section.

Option is valid only for that specific task where it is defined, and
will override option defined in springBoot{} ext properties.

Fixes gh-283
2014-02-05 22:54:47 -08:00
Phillip Webb
ed9735361e Apply source cleanup and formatting 2014-02-05 22:53:28 -08:00
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
2014-02-05 21:22:57 -08:00
Phillip Webb
1552759584 Fix package tangle by moving AsciiBytes 2014-02-03 17:26:10 -08:00