Commit Graph

675 Commits

Author SHA1 Message Date
Andy Wilkinson
826acf5d67 Set the working directory to that of the jar when using start-stop-daemon
By default, start-stop-daemon will chdir to the root directory before
starting the process. This prevents an application.properties file that
sits alongside the jar from being found.

This commit updates the call to start-stop-daemon to use --chdir to
set the working directory to that of the jar that’s being launched.

Closes gh-4281
2015-10-30 15:10:02 +00:00
Andy Wilkinson
1ef68ef231 Correct the reference to jarfolder in the init script
Closes gh-4287
2015-10-28 14:32:11 +00:00
Andy Wilkinson
17f61c1dad Update javadoc of LaunchedURLClassLoader to describe delegation model
Closes gh-3864
2015-10-27 10:09:10 +00:00
Phillip Webb
a7a2aa0461 Add "INIT INFO" property substitutions
Update the "INIT INFO section" of `launch.script` to include
`initInfoProvides`, `initInfoShortDescription` and `initInfoDescription`
property substitutions.

The Maven plugin has been updated to populate substitutions with
`${project.artifactId}`, `${project.name}` and `${project.description}`.

Fixes gh-4245
2015-10-20 17:48:22 -07:00
Stephane Nicoll
168fc2f61f Disable addResources by default
Flip the default value of `addResources` for both the Maven and Gradle
plugins. This effectively turns off static resources reloading and, more
importantly, the pruning of duplicate resources from the target
directory.

As devetools is our mainstram solution for such feature, the documantion
has been updated to reflect that.

Closes gh-4227
2015-10-20 15:04:25 +02:00
Andy Wilkinson
d071db8cc9 Align launch.script with the init script spec
The init script spec [1] describes a number of requirements with which
our launch.script did not comply. This commit makes the following
corrections:

 - Add support for force-reload which should be implemented by all
   init scripts
 - Don't fail restart if the service is already stopped or not running
 - Consider stop to be successful if the service is already stopped
 - Exit with 1 if stop fails (indicating a generic or unspecified error)
   rather than 3 (unimplemented feature)
 - Report a status of 1 if app is not running but the pid file exists
 - Report a status of 3 if the app is not running (no pid file)

Closes gh-4231

[1] http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
2015-10-20 11:27:43 +01:00
Stephane Nicoll
1d3386ba3f Remove spring-boot-dependency-tools
A merge from 1.2.x brought back this module that was deleted on master.

Closes gh-4246
2015-10-20 11:50:29 +02:00
Phillip Webb
90f7bc0321 Polish 2015-10-19 13:04:06 -07:00
Phillip Webb
634bb770b2 Organize imports with new settings
See gh-4234
2015-10-19 12:58:34 -07:00
Phillip Webb
1e4d974ec0 Merge remote-tracking branch 'local12x/1.2.x' 2015-10-19 12:56:55 -07:00
Phillip Webb
a79131f8d2 Organize imports with new settings
See gh-4234
2015-10-19 12:55:44 -07:00
Tommy Ludwig
e4230e61d7 Make the name of the log file produced by launch script configurable
Previously, the launch script would always use a file named
<appname>.log to capture the application's console output. This commit
adds a variable, LOG_FILENAME, for specifying the file name defaulting
to <appname>.log.

Fixes gh-4194
2015-10-19 11:38:22 +01:00
Spring Buildmaster
2b38a861e3 Next Development Version 2015-10-16 05:57:24 -07:00
Phillip Webb
03d54fa1d0 Polish 2015-10-15 16:15:23 -07:00
Stephane Nicoll
4eefd92e82 Customize active profiles via a dedicated property
This commit adds a dedicated property to specify the active profiles to
use when running an application via the Maven plugin. This works also
on the command line using the `run.profiles` system property and is
consistently applied whether the process is forked or not.

Closes gh-4199
2015-10-15 16:57:52 +02:00
Bruce Edge
df07151f10 Use start-stop-daemon if present in launch.script
Update `launch.script` to use `start-stop-daemon` when possible to
manage daemon processes. When `start-stop-daemon` is not available `su`
is used.

Closes gh-4137
2015-10-14 23:16:53 -07:00
Andy Wilkinson
30f24eac0a Merge branch '1.2.x' 2015-10-14 16:33:55 +01:00
Andy Wilkinson
7e718cda26 Remove redundant hash from path of unpacked nested library
Closes gh-4124
2015-10-14 16:32:58 +01:00
Stephane Nicoll
e79ef9b73b Add option to exclude devtools from fat jar
Add an `excludeDevtools` property to both the Maven and Gradle plugin
that removes `org.springframework.boot:spring-boot-devtools` (if
necessary) when repackaging the application.

Closes gh-3171
2015-10-14 01:22:57 -07:00
Andy Wilkinson
6c4e4520d4 Merge branch '1.2.x' 2015-10-12 10:37:25 +01:00
Andy Wilkinson
050a4fed17 Restore compatibility with Gradle 2.0
Gradle 2.0, and only 2.0, requires a Plugin implementation to be
public. The changes made in gh-4113 (9c14ed3) made the class
package-private.

Closes gh-4139
2015-10-12 10:33:33 +01:00
Andy Wilkinson
9c14ed3502 Remove stale Java source from src/main/groovy in the Gradle plugin
Closes gh-4113
2015-10-12 10:30:31 +01:00
Phillip Webb
6333426cbf Reformat package-info.java files with Eclipse Mars 2015-10-09 13:54:25 -07:00
Phillip Webb
04074fece1 Merge branch '1.2.x' 2015-10-09 13:39:09 -07:00
Phillip Webb
94736719f1 Reformat package-info.java files with Eclipse Mars 2015-10-09 13:32:57 -07:00
Andy Wilkinson
2afb641603 Merge branch '1.2.x' 2015-10-09 15:21:21 +01:00
Andy Wilkinson
04c2bd9c89 Update tests to expect additional entry in test jar
Closes gh-4124
2015-10-09 15:19:50 +01:00
Andy Wilkinson
8948322d7a Merge branch '1.2.x' 2015-10-09 14:59:54 +01:00
Andy Wilkinson
888fa90265 Ensure that JarFileArchive unpacks entries to unique location
Previously, JarFileArchive would always unpack any entries marked for
unpacking to ${java.io.tmpdir}/spring-boot-libs. This could cause
problems if multiple Spring Boot applications were running on the same
host:

- If the apps are run as different users the first application would
  create the spring-boot-libs directory and the second and subsequent
  applications may not have write permissions to that directory
- Multiple apps may overwrite each others unpacked libs. At best this
  will mean one copy of a jar is overwritten with another identical
  copy. At worst the jars may have different contents so that some of
  the contents of the original jar disappear unexpectedly.

This commit updates JarFileArchive to use an application-specific
location when unpacking libs. A directory beneath ${java.io.tmpdir} is
still used but it's now named <jar-file-name>-spring-boot-libs-<uuid>.
A loop, limited to 1000 attempts, is used to avoid problems caused by
the uuid clashing.

Closes gh-4124
2015-10-09 14:59:18 +01:00
Phillip Webb
aae38db9af Fix compiler warnings only shown in Eclipse Mars 2015-10-07 23:40:28 -07:00
Phillip Webb
c9fb9916b8 Reformat code using Eclipse Mars 2015-10-07 23:37:10 -07:00
Phillip Webb
e473364e4e Merge branch '1.2.x' 2015-10-07 23:34:08 -07:00
Phillip Webb
6ab376e2e8 Reformat code use Eclipse Mars 2015-10-07 23:32:31 -07:00
Phillip Webb
47576354f7 Merge branch '1.2.x' 2015-10-07 23:19:50 -07:00
Phillip Webb
ba7c1fda72 Convert Gradle plugin from Groovy to Java
Replace existing Groovy code with Java since the Groovy Eclipse tooling
currently forces the use of an old jdt plugin which has formatter bugs.

Fixes gh-4113
2015-10-07 23:12:25 -07:00
Thomas Raehalme
3865f3b303 Allow launch script to be used by accounts that use /sbin/nologin
Closes gh-3852
Closes gh-3906
2015-10-05 11:08:52 +01:00
Andy Wilkinson
051ebf3fac Polishing: fix a number of compiler warnings reported by Eclipse 2015-09-22 13:30:07 +01:00
Andy Wilkinson
94a737638e Update launch script to specify -jar as last option
The recommended usage for the java executable is:

    java [-options] -jar jarfile [args...]

This commit updates the default launch script to match this recommended
usage by moving -jar to be the last option, after both the
disableJarChecking system property and any JAVA_OPTS.

Closes gh-3930
2015-09-21 14:51:03 +01:00
Spring Buildmaster
9409c49c10 Next development version 2015-09-16 09:00:17 -07:00
Phillip Webb
269815dbcf Make LaunchedURLClassLoader constructor public
Restore the public constructor in LaunchedURLClassLoader which was
accidentally removed in commit e07df7e4c6.
2015-09-09 09:20:34 -07:00
Phillip Webb
e674d751de Polish Javadoc 2015-09-08 17:01:36 -07:00
Phillip Webb
e07df7e4c6 Remove redundant modifiers 2015-09-08 17:01:30 -07:00
Phillip Webb
460ca75fce Polish newline at end of file 2015-09-08 16:05:22 -07:00
Phillip Webb
d09805fd75 Polish license headers 2015-09-08 16:05:05 -07:00
Phillip Webb
6e29ee4557 Polish 2015-09-08 16:04:30 -07:00
Phillip Webb
67402405db Reformat code 2015-09-08 14:56:40 -07:00
Phillip Webb
2615990ffb Organize imports 2015-09-08 14:40:35 -07:00
Phillip Webb
0335053139 Merge branch '1.2.x' 2015-09-08 14:37:16 -07:00
Phillip Webb
15686ed4fd Reformat code 2015-09-08 14:07:06 -07:00
Phillip Webb
0f6b60d8c8 Organize imports 2015-09-08 14:05:00 -07:00
Phillip Webb
690da89c82 Fix warnings 2015-09-05 00:21:09 -07:00
Ilayaperumal Gopinathan
61ac04aa4c Make it easier to subclass Launchers
Change constructors from `package private` to `protected` for subclasses
to use.

Closes gh-3741
2015-09-03 14:40:23 -07:00
Phillip Webb
4aa2fed48b Revert "configure JRE that is different from compiler target level"
This reverts commit 678f36cfef.
2015-09-02 23:44:27 -07:00
Dave Syer
9dec0971d6 Change restart to fail if not running 2015-08-27 07:30:00 +01:00
Dave Syer
ff681adc5b Fix launch.script to not exit prematurely
Use "return" instead of "exit" where possible, especially in
function definitions.

Also fixed the exit codes to match the LSB spec for some specific
conditions (fixes gh-3521).

Fixes gh-3199, fixes gh-3535
2015-08-26 17:54:20 +01:00
Stephane Nicoll
35875c7f08 Merge manual item meta-data
Previously, manual meta-data were added to the existing set of entries
which could lead to duplicates if a manual entry is meant to complement
a property that is detected via the processor.

We now match the name and type of the item against the auto-detected
entries. If no match is found, we add the extra entry as we did before.
If a match is found we override the description, default value and
deprecation information.

Closes gh-3562
2015-08-20 17:08:54 +02:00
Martin Lippert
678f36cfef configure JRE that is different from compiler target level 2015-08-19 17:00:38 +01:00
Martin Lippert
511c6d39fa Replace ignore with lifecycle mapping to smooth import into Eclipse
Closes gh-3516
2015-08-13 13:24:15 +01:00
Stephane Nicoll
3763eda64e Merge branch '1.2.x' 2015-08-10 16:36:11 +02:00
Stephane Nicoll
1ee31e73d3 Avoid NPE if @ConfigurationProperties is not present
The annotation processor detects `@ConfigurationProperties` bean or
method definition and merges manual meta-data. The former step will fail
with a NPE if the annotation is not present on the classpath. This could
happen if the annotation processor is added to a module that is not
actually using Spring Boot.

We now have a defensive check that skips that steps but still attempts to
merge manual meta-data if present.

Closes gh-3720
2015-08-10 16:34:30 +02:00
Dave Syer
25ac258d22 Clarify plugin documentation for requiresUnpack 2015-08-10 12:52:00 +01:00
Phillip Webb
891dd5a0f6 Polish 2015-08-03 11:03:48 -07:00
Andy Wilkinson
4660a3ed4d Merge branch '1.2.x' 2015-08-03 15:50:26 +01:00
Andy Wilkinson
d241171fff Use fast exceptions in hasMoreElements in LaunchedURLClassLoader
When nested jars are being used, hasMoreElements requires opening a
connection for an entry in every nested jar. If that entry doesn't
exist, a FileNotFoundException is thrown to indicate that a particular
jar doesn't contain the requested entry. This exception is used to
indicate the lack of an entry and is then swallowed, i.e. its stack
trace is of no importance. This means that the performance of
hasMoreElements can be improved by switching on fast exceptions while
it's being called. When fast exceptions are switched on a general
purpose pre-initialized FileNotFoundException is thrown rather than
creating a new FileNotFoundException instance each time.

In certain situations, the use of fast exceptions as described above
can improve performance fairly significantly. The JRE's default SAAJ
implementation uses META-INF/services-based discovery for _every_
request that's handled by Spring Web Services. Each discovery attempt
results in hasMoreElements being called making its performance
critical to throughput.

See gh-3640
2015-08-03 15:39:56 +01:00
Stephane Nicoll
bc0487f791 Polish
Make sure that the meta-data can be serialized.
2015-07-29 14:01:21 +02:00
arghya88
64c6e5b403 Fix typo
Closes gh-3610
2015-07-28 10:39:10 +02:00
arghya88
9de4fd7913 Fix typo
Closes gh-3606
2015-07-27 15:30:48 +02:00
Stephane Nicoll
057824aca7 Fix maven plugin configuration
Closes gh-3601
2015-07-27 08:18:09 +02:00
Stephane Nicoll
94405455dd Fix maven plugin configuration
Closes gh-3601
2015-07-26 09:09:43 +02:00
Stephane Nicoll
e033daed0f Use standard name for main thread
DevTools look for a main thread named "main". The maven plugin is
actually using a different value and there is no real reason to. This
change fixes DevTools support as long as forking is enabled.

See gh-3315
2015-07-24 10:36:14 +02:00
Stephane Nicoll
42e230192f Polish 2015-07-24 07:19:53 +02:00
Stephane Nicoll
e9a6245a44 Remove unnecessary System.out 2015-07-22 16:59:53 +02:00
Stephane Nicoll
178c690d37 Fix meta-data root attributes ordering 2015-07-22 16:59:25 +02:00
Andy Wilkinson
434f528e0a Fix Gradle plugin task dependencies broken by removal of app plugin
8673250 updated the plugin so that the application plugin is no longer
applied by default. This exposed three problems:

 1. bootRepackage may run before findMainClass has run, leaving it with
    an unknown main class.
 2. findMainClass may run before the classes have been built, making it
    unable to find the main class by examining the class files
 3. The project's mainClassName property was still being used as a
    convention for the bootRun task's main property. If the application
    plugin has not be applied, then this property does not exist.

The first problem has been addressed by configuring bootRepackage to
depend on findMainClass.

The second problem has been addressed by configuring the main source
set's output as an input of findMainClass, and configuring findMainClass
to depend on the tasks that build the output.

The third problem has been addressed by only using the mainClassName
property if it exists and its value is not null. We then fallback to
using the mainClassName property on the project's extra properties in
the same way. 

See gh-2679
2015-07-22 13:47:29 +01:00
Andy Wilkinson
8673250955 Make use of Gradle's application plugin optional when using Boot plugin
Previously, the Spring Boot Gradle plugin would always apply the
application plugin to a project. It then piggy-backed on the application
plugin’s mainClassName and applicationDefaultJvmArgs properties for the
configuration of the bootRun task.

This commit updates the Spring Boot Gradle plugin so that it no longer
applies the application plugin. If the user applies the application
plugin then its configuration will be used, but it’s a no longer
requirement.

Users who do not need the application plugin, but who were using the
mainClassName or applicationDefaultJvmArgs properties will need to
change their builds as a result of this change as those properties will
no longer exist. As before, the mainClassName can be configured on the
springBoot extension:

springBoot {
	mainClassName 'com.example.YourApplication'
}

The applicationDefaultJvmArgs property can be used, but it must now be
declared with the project's ext block. For example:

ext {
	applicationDefaultJvmArgs = [ '-Dcom.example.property=true' ]
}

Closes gh-2679
2015-07-22 11:38:15 +01:00
Phillip Webb
e9d252e05c Add @DeprecatedConfigurationProperties annotation
Add a new @DeprecatedConfigurationProperties annotation which can be
used by the `ConfigurationMetadataAnnotationProcessor` to generating
meta-data deprecated blocks.

Fixes gh-3543
2015-07-17 14:14:37 -07:00
Phillip Webb
728e64b929 Polish 2015-07-16 12:56:49 -07:00
izeye
f4589e7cc3 Fix typos
Closes gh-3504
2015-07-15 15:45:02 +02:00
Stephane Nicoll
f2d32d3e98 Add support for property deprecation
Previously, an item could only have a 'deprecated' boolean flag to
indicate that the property is deprecated. It is desirable to provide an
additional description for the deprecation as well as the name of the
property to use instead.

The `deprecated` boolean flag is now supported. Instead, a `deprecated`
object can be specified with two optional attributes: `reason` to provide
an explanation for the deprecation and `replacement` to refer to the
property that should be used instead. If none of them is present, an
empty deprecation object should be set.

For backward compatibility, the `deprecated` field is still set.

Deprecation information can only set via manual meta-data.

Closes gh-3449
2015-07-15 15:41:52 +02:00
izeye
019140c901 Remove redundant check
Closes gh-3497
2015-07-15 09:58:15 +02:00
Phillip Webb
f0f5f78e25 Polish 2015-07-14 22:17:52 -07:00
Stephane Nicoll
68d875bdc6 Fix windows build 2015-07-14 21:39:54 +02:00
Stephane Nicoll
c4c24b1f44 Detect default value from factory method
If a field is initialized via a factory method taking a single argument,
we can relatively safely consider that said argument is a good
representation of its default value. This is typically the case for
Charset or MimeType instances.

We now make sure to detect such use case (i.e. method argument with a
single argument).

Closes gh-3482
2015-07-14 15:08:43 +02:00
Dave Syer
de02eaa26b Add missing jar (.gitignored) 2015-07-14 12:44:23 +01:00
Dave Syer
bfa816f2a3 Maintain classpath order in PropertiesLauncher
I think this is safe, judging by the integration tests, but I'm not
putting it in 1.2.x until we've had some feedback on it. The
integration tests actually had a bug that was masking this problem
because they were merging Properties from the whole classpath instead
of picking the first available resource (which is generally what
we do in Spring Boot applications for application.properties for
instance).

Fixes gh-3048
2015-07-14 10:22:36 +01:00
Phillip Webb
9ebe15232e Polish 2015-07-13 11:05:46 -07:00
Stephane Nicoll
cb5eccb5c1 Add missing handle-as meta-data
Liquibase has a `changeLog` property that is definitely used as a
`Resource` but cannot be defined as such as the original String value
should be kept against an API we don't control.

Update the tests also to make it more clear that if hints are added
against a property that is detected automatically, said property still
keeps all its auto-discovered capabilities.

Closes gh-3457
2015-07-13 13:45:23 +02:00
Stephane Nicoll
d64ee99b20 Add configuration meta-data parser
Add a new `spring-boot-configuration-metadata` module that provides an
API to manipulate Spring Boot configuration meta-data. Can read meta-data
from arbitrary locations, though the standard
`META-INF/spring-configuration-metadata.json` location must be preferred.

Closes gh-1970
2015-07-13 11:53:31 +02:00
izeye
f85f316873 Polish toString()
Closes gh-3465
2015-07-13 09:52:29 +02:00
Stephane Nicoll
3664895f04 Polish 2015-07-12 09:20:12 +02:00
Dave Syer
b2a2c5b168 Add Maven incantation to make STS 3.7 happy 2015-07-10 15:56:40 +01:00
Phillip Webb
e3b59774c8 Merge branch '1.2.x' 2015-07-09 10:37:30 -07:00
Phillip Webb
4b17f3ceef Formatting 2015-07-09 10:37:21 -07:00
Andy Wilkinson
a2d58030dd Merge branch '1.2.x' 2015-07-09 16:42:37 +01:00
Andy Wilkinson
68e54e1d5d Favour entries in source jar over standard libraries when repackaging
When writing a jar, once an entry has been written it will never be
overwritten, i.e. the first write of a given entry will win. Previously,
when repackaging a jar, the existing contents were written followed by
any libraries. This caused a problem when repackaged a WAR file and
a library needed to be unpacked as the existing entry in WEB-INF/lib
would prevent the library with the UNPACK comment from being written.
This was addressed in f761916b by inverting the order so libraries
would take precedence over entries in the source jar.

It’s now become apparent that this change in the order causes a problem
for users who are obfuscating their code. The obfuscated code exists in
the source jar but is also provided to the repackager in its original
form as a library. When libraries take precedence, this means that the
code in its original form ends up in the repackaged war and the
obfuscation is lost.

This commit updates the repackager to write libraries that require
unpacking first. This allows the UNPACK comment to be written even if
there’s also a source entry for the library. Next, source entries are
written. This allows obfuscated source entries to take precedence over
any unobfuscated library equivalents. Lastly, standard libraries that
do not require unpacking are written into the repackaged archive.

Closes gh-3444
2015-07-09 16:37:10 +01:00
Stephane Nicoll
97634e85ac Remove unnecessary keyword 2015-07-09 14:33:01 +02:00
Andy Wilkinson
2263095bbb Update launch.script to match chkconfig start levels with defaults
Closes gh-3419
2015-07-07 17:57:47 +01:00
Phillip Webb
0cf6efca4f Polish 2015-07-06 13:05:09 -07:00
Stephane Nicoll
e307fe3137 Honor outputDirectory properly
Previously, if the repackaged file was different from the main artifact
of the build, the maven plugin wrongly considered that it should attach
the file with a classifier.

The outputDirectory is honored properly now, regardless of the fact a
classifier is defined or not.

Fixes gh-3177
2015-07-06 15:24:48 +02:00
Stephane Nicoll
162cbdd5cb Fail the build if the meta-data are invalid
Make sure to fail the build with a proper compilation error message if
the user-defined meta-data are invalid. For now, this takes care of the
JSON format but other checks may be added in the future.

Closes gh-3329
2015-07-06 11:35:57 +02:00
Spring Buildmaster
7ce391db4f Next development version 2015-07-01 22:48:01 -07:00
Phillip Webb
b1f8a692a8 Merge branch '1.2.x' 2015-07-01 19:30:12 -07:00
Phillip Webb
a1b87766a7 Fix PropertiesLauncher javadoc
See gh-3392
2015-07-01 18:09:56 -07:00
Matt Benson
ae4559eb4f Create spring-boot-antlib module
Create a new spring-boot-antlib module which allows Apache Ant users
to easily create executable jars.

Fixes gh-3339
2015-06-30 00:30:28 -07:00
Phillip Webb
7879743b9f Polish 2015-06-25 12:00:48 -07:00
Stephane Nicoll
0ec9de9137 Add support for value provider
Improve the "hints" section of the metadata so that each hint can provide
the reference to a value provider.

A value provider defines how a tool can discover the potential values of
a property based on the context. The provider is identifed by a name and
may have an arbitrary number of parameters.

Closes gh-3303
2015-06-25 14:58:10 +02:00
Phillip Webb
778e3eb091 Polish 2015-06-24 16:15:12 -07:00
Stephane Nicoll
bc9321734f Add support for property hint
Create a new section in the meta-data called "hints" where users can
provide hints about a given property. The most basic use case for now
is to provide a list of values that a property can have. Each value may
have a description.

This sample JSON provides a basic example for a property called `foo.mode`
that exposes 3 values: "auto", "basic" and "advanced".

```
 "hints": [
    {
      "id": "foo.mode",
      "values": [
        {
          "value": "auto",
          "description": "Some smart description."
        },
        {
          "name": "basic"
        },
        {
          "name": "advanced"
        }
      ]
    }
]
```

This information can be read by tools (such as IDE) and offer an
auto-completion with the list of values.

Closes gh-2054
2015-06-24 18:53:11 +02:00
Phillip Webb
61fc4f3f12 Polish copyright headers 2015-06-23 10:22:14 -07:00
Phillip Webb
f22c91ac94 Add chkconfig comment to launch script
Update the embedded launch script to include a `chkconfig` comment. This
solves the "Service doesn't support chkconfig" error when executing
the chkconfig command.

Fixes gh-3115
2015-06-19 15:43:05 -07:00
Phillip Webb
f65dfe4bcb Fix javadoc errors and warnings 2015-06-19 14:04:55 -07:00
Johannes Stelzer
f0bb60bf9d Improve executable jar launch script
Update the launch script used in fully executable jars to:

- Include LSB-Header comments
- Source `.conf` files either next to the jar for additional script
  configuration

Fixes gh-3243
2015-06-18 23:11:07 -07:00
Phillip Webb
2f16a01dd5 Polish 2015-06-18 14:11:40 -07:00
Daniel Young and Mathew Johnson
e3c2fb7287 Add useTestClassPath to run/start maven goals
Add `useTestClasspath` flag to add test dependencies to the classpath of
the application. Works with both the `start` and `run` goals.

Closes gh-2792
2015-06-18 09:33:44 +02:00
Phillip Webb
d87f2713af Merge branch '1.2.x' 2015-06-15 11:38:24 -07:00
Phillip Webb
135e9d10a6 Polish 2015-06-15 10:52:02 -07:00
Stephane Nicoll
f87b2be2f9 Update default JMX name used by Maven plugin
Closes gh-3124
2015-06-10 17:31:06 +02:00
Stephane Nicoll
e0787cbaf0 Polish
Review 105039c that still refer to "lifecycle" instead of "admin". In
particular, harmonized the configuration properties.

Closes gh-3124
2015-06-10 11:28:47 +02:00
Stephane Nicoll
18c65f6e63 Merge branch '1.2.x' 2015-06-10 10:31:00 +02:00
Lugi Cardito
a37e983296 Create output directory if necessary
If the `repackage` goal defines an output directory that does not exist,
the maven plugin now creates it.

Closes gh-3136
2015-06-10 10:27:53 +02:00
Phillip Webb
105039cdb2 Rename SpringApplicationLifecycle => Admin
Rename SpringApplicationLifecycle JMX beans to SpringApplicationAdmin
and relocate to a dedicated package.

Fixes gh-3124
2015-06-09 16:06:28 -07:00
Phillip Webb
7609c43685 Switch Javadoc <code>...</code> to {@code ...}
Update Javadoc to use the {@code ...} syntax when possible.
2015-06-05 10:10:34 -07:00
Eddú Meléndez
baca62a6c0 Fix typos 2015-06-05 16:59:51 +02:00
Phillip Webb
316b07d3b9 Change the embedded script default to disabled
Update the Maven and Gradle repackage tasks so that the embedded
startup script is no longer included by default. This change is
primarily due to the `cf` command line not currently accepting
the unusual jar format.

Fixes gh-3045
2015-06-04 21:59:27 -07:00
Phillip Webb
bce4bb8860 Polish start stop support 2015-06-04 01:09:53 -07:00
Spring Buildmaster
5d81c87b43 Next Development Version 2015-06-04 00:49:11 -07:00
Phillip Webb
49c4710f63 Merge branch '1.2.x' 2015-06-02 12:32:46 -07:00
Phillip Webb
968b68c322 Polish 2015-06-02 11:17:16 -07:00
Stephane Nicoll
4ec519fd08 Merge branch '1.2.x' 2015-05-26 16:21:23 +02:00
Stephane Nicoll
f25ce8a381 Fix artifact extension retrieval
Do not rely on the packaging type to figure out what the extension of the
main artifact will be. So far, using `jar` and `war` packaging for `.jar`
and `.war` files worked by chance.

We know retrieve the actual extension as provided by Maven's
`ArtifactHandler`.

Fixes gh-2762
2015-05-26 16:21:00 +02:00
Andy Wilkinson
b7a02feda8 Make the Maven plugin’s start and stop tests more robust
- Verify that isReady has been called
 - When forking, use a random port for JMX
 - Don’t wait for application termination as it introduces a race
   condition and verifying that shutdown has been requested is
   sufficient

See gh-2525
2015-05-19 15:26:03 +01:00
Stephane Nicoll
e0dfe9fb86 Add start/stop goals to maven plugin
SpringApplicationLifecycle provides basic lifecycle operations on the
current Spring Boot application (that is checking if the application has
fully started and gracefully terminate the app). It can be registered as
an MBean of the platform MBean server if a specific property is set.

The Maven plugin uses that MBean to check that the application is ready
before ending the "start" phase. It uses it to trigger a proper shutdown
of the application during the "stop" phase.

If the process has to be forked, the platform MBean server is exposed on
a configurable port so that the maven plugin can connect to it.

Such change permits the maven plugin to integrate a classical integration
test scenario where the "start" goal is invoked during the
pre-integration phase and the "stop" goal during the post-integration
phase.

Closes gh-2525
2015-05-19 11:22:47 +02:00
Andy Wilkinson
63a7b24d27 Fix test that was broken in b24e736c 2015-05-12 10:46:25 +01:00
Dave Syer
b24e736cfe Add env var parameters to launch.script
Some of the features of the launch.script were not exposed for users
to be able to control at runtime. It now accepts things like
PID_FOLDER and LOG_FOLDER as environment variables, and also adopts
a clear naming convention where only the inputs are UPPER_CASE.
2015-05-12 10:23:44 +01:00
Andy Wilkinson
51c49b69c5 Support bom-based dependency management in the CLI
Previously, the CLI’s dependency management used proprietary Properties
file-based metadata to configure its dependency management. Since
spring-boot-gradle-plugin’s move to using the separate dependency
management plugin the CLI was the only user of this format.

This commit updates the CLI to use Maven boms to configure its
dependency management. By default it uses the spring-boot-dependencies
bom. This configuration can be augmented and overridden using the new
@DependencyManagementBom annotation which replaces @GrabMetadata.

Closes gh-2688
Closes gh-2439
2015-05-07 14:58:23 +01:00
Andy Wilkinson
4452bb1873 Revert "Upgrade Gradle plugin’s ID so it’s suitable for the Plugin Portal"
This reverts commit b1c0a7cda4.

The plugin publishing process has moved to a new plugin-based approach
that brings with it some significant limitations:

 - There's no staging to allow the promotion of good release builds
 - There's no easy way to upload an existing artifact
 - There's no control over the published pom.

The risk brought by these limitations, particularly the first, are
too great so we will no be publishing the Boot plugin to the Portal
until they're resolved.

Changing the plugin's ID was a breaking change that would require
users to do some work when they upgrade to Boot 1.3. The ID of the
plugin was changed purely so that it met the Portal's requirements.
Given that the plugin will not be published to the Portal for the
foreseaable future there's no need for us to inflict a breaking change
on people when there will be no benefit.

See gh-1567
2015-04-21 12:37:12 +01:00
Phillip Webb
2176afb49e Set timestamps of nested jars
Update JarWriter to set the entry timestamp for nested jars. The
timestamp is set to same time as the first (non directory) entry in
the nested jar.

This change should make it easier to created layered docker images.

Fixes gh-2807
2015-04-16 21:20:28 -07:00
Phillip Webb
a8d099f6b8 Revert "Add start/stop goals to maven plugin"
This reverts commit 54e12a07e6.
2015-04-16 12:32:06 -07:00
Stephane Nicoll
54e12a07e6 Add start/stop goals to maven plugin
SpringApplicationLifecycle provides lifecycle operations on the current
Spring Boot application. It can be registered as an MBean of the platform
MBean server if a specific property is set. Besides, the JMX name can
also be customized via a property in case more than one Spring Boot
application is started in the same process.

The Maven plugin uses that MBean to check that the application is ready
before ending the "start" phase. It uses it to trigger a proper shutdown
of the application during the "stop" phase.

If the process has to be forked, the platform MBean server is exposed on
a configurable port so that the maven plugin can connect to it.

Such change permits the maven plugin to integrate a classical integration
test scenario where the "start" goal is invoked during the
pre-integration phase and the "stop" goal during the post-integration
phase.

Closes gh-2525
2015-04-16 11:50:18 +02:00
Andy Wilkinson
02859cc2d4 Merge branch '1.2.x' 2015-04-15 17:04:05 +01:00
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
2015-04-15 17:03:06 +01:00
Phillip Webb
c2e2bc879e Fix broken RepackerTests on Windows
Update test to deal with the fact that POSIX operations aren't available
on Windows.

Fixes gh-1117
2015-04-14 10:39:27 -07:00
Sylvère Richard
d8308cbf45 Support ANSI color from gradle bootRun
Update the BootRunTask to record the state of the System.console() so
that it can be picked up later by AnsiOutput.

Fixes gh-747
2015-04-09 13:13:44 -07:00
Phillip Webb
793481843c Support embedded jar initialization scripts
Update the Maven and Gradle plugin to generate fully executable jar
files on Unix like machines. A launcher bash script is added to the
front of the jar file which handles execution.

The default execution script will either launch the application or
handle init.d service operations (start/stop/restart) depending on if
the application is executed directly, or via a symlink to init.d.

See gh-1117
2015-04-09 10:57:31 -07:00
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
2015-04-06 19:47:22 -07:00
Spring Buildmaster
e03c11dda8 Next development version 2015-03-30 22:56:20 -07:00
Andy Wilkinson
20a2f21493 Merge branch '1.2.x' 2015-03-26 10:01:01 +00:00
Andy Wilkinson
c3a040acb3 Polishing
Remove unwanted System.out.println call
2015-03-26 10:00:35 +00:00
Andy Wilkinson
b1c0a7cda4 Upgrade Gradle plugin’s ID so it’s suitable for the Plugin Portal
Gradle’s plugin portal requires each plugin’s ID to be in a namespace.
Our existing ID, spring-boot, does not meet this requirement. This
commit changes the plugin’s ID to org.springframework.boot.spring-boot.
Note that, as is recommended [1], the plugin’s ID does not include
“gradle”.

See gh-1567

[1] http://plugins.gradle.org/submit
2015-03-19 14:25:07 +00:00
Andy Wilkinson
0f51a53691 Remove manual Gradle plugin versionManagement test
Following the move to using the separate dependency management plugin
this test is no longer valid. It should have been removed as part of
2c3c62d7

See gh-2133
2015-03-19 13:55:32 +00:00