Commit Graph

590 Commits

Author SHA1 Message Date
Phillip Webb
893a6c32f3 Upgrade to checkstyle 6.17
Fixes gh-5547
2016-03-31 13:14:53 -07:00
Phillip Webb
c28f552883 Migrate SpringJUnit4ClassRunner to SpringRunner
Replace all existing SpringJUnit4ClassRunner references with the new
SpringRunner alias.

Fixes gh-5292
2016-03-23 22:18:18 -07:00
Phillip Webb
2f815a907a Migrate existing tests from deprecated package
Update the existing tests to use the relocated `spring-boot-test`
classes. Restructuring was achieved using the following command:

find . -type f -name '*.java' -exec sed -i '' \
-e s/org.springframework.boot.test.ConfigFileApplicationContextInitializer/\
org.springframework.boot.test.context.ConfigFileApplicationContextInitializer/g \
-e s/org.springframework.boot.test.EnvironmentTestUtils/\
org.springframework.boot.test.util.EnvironmentTestUtils/g \
-e s/org.springframework.boot.test.IntegrationTest/\
org.springframework.boot.test.context.IntegrationTest/g \
-e s/org.springframework.boot.test.IntegrationTestPropertiesListener/\
org.springframework.boot.test.context.IntegrationTestPropertiesListener/g \
-e s/org.springframework.boot.test.OutputCapture/\
org.springframework.boot.test.rule.OutputCapture/g \
-e s/org.springframework.boot.test.SpringApplicationConfiguration/\
org.springframework.boot.test.context.SpringApplicationConfiguration/g \
-e s/org.springframework.boot.test.SpringApplicationContextLoader/\
org.springframework.boot.test.context.SpringApplicationContextLoader/g \
-e s/org.springframework.boot.test.SpringBootMockServletContext/\
org.springframework.boot.test.mock.web.SpringBootMockServletContext/g \
-e s/org.springframework.boot.test.TestRestTemplate/\
org.springframework.boot.test.web.client.TestRestTemplate/g \
-e s/org.springframework.boot.test.WebIntegrationTest/\
org.springframework.boot.test.context.web.WebIntegrationTest/g {} \;

See gh-5293
2016-03-23 22:17:50 -07:00
Phillip Webb
644ae2c21a Merge branch '1.3.x' 2016-03-08 09:51:57 -08:00
Phillip Webb
5e722dae6a Polish 2016-03-08 09:37:13 -08:00
Dave Syer
120a39a689 Merge branch '1.3.x' 2016-02-29 16:49:24 +00:00
Dave Syer
baf7dda05a Accumulate state in a local variable, not a field in the instance
State is accumulating unnecessarily in AST tranformation instances.
We can fix the ones we have implemented so far just by using a
local variable and passing it into the methods where it is used.
All the methods are private so this change is safe in a point release.

Fixes gh-5283
2016-02-29 16:46:53 +00:00
Dave Syer
0dd3531f77 Fix apostrophe 2016-02-29 16:46:53 +00:00
Spring Buildmaster
225d877ab9 Next Development Version 2016-02-26 01:06:16 -08:00
Andy Wilkinson
44ddfcc7fa Upgrade copyright headers of all files changed in 2016 2016-02-25 12:09:42 +00:00
Phillip Webb
89b7704977 Extract spring-boot-test.jar
Relocate the `org.springframework.boot.test` package from the
`spring-boot.jar` to `spring-boot-test.jar`.

Fixes gh-5184
2016-02-19 19:28:37 -08:00
Andy Wilkinson
87fe0b2ade Use a conventional delegation model in LaunchedURLClassLoader
When an application is run as an executable archive with nested jars,
the application's own classes need to be able to load classes from
within the nested jars. This means that the application's classes need
to be loaded by the same class loader as is used for the nested jars.
When an application is launched with java -jar the contents of the
jar are on the class path of the app class loader, which is the
parent of the LaunchedURLClassLoader that is used to load classes
from within the nested jars. If the root of the jar includes the
application's classes, they would be loaded by the app class loader
and, therefore, would not be able to load classes from within the
nested jars.

Previously, this problem was resolved by LaunchedURLClassLoader being
created with a copy of all of the app class laoder's URLs and by
using an unconventional delegation model that caused it to skip its
parent (the app class loader) and jump straight to its root class
loader. This ensured that the LaunchedURLClassLoader would load both
the application's own classes and those from within any nested jars.
Unfortunately, this unusual delegation model has proved to be
problematic. We have seen and worked around some problems with Java
Agents (see gh-4911 and gh-863), but there are others (see gh-4868)
that cannot be made to work with the current delegation model.

This commit reworks LaunchedURLClassLoader to use a conventional
delegate model with the app class loader as its parent. With this
change in place, the application's own classes need to be hidden
from the app class loader via some other means. This is now achieved
by packaging application classes in BOOT-INF/classes (and, for
symmetry, nested jars are now packaged in BOOT-INF/lib). Both the
JarLauncher and the PropertiesLauncher (which supports the executable
jar layout) have been updated to look for classes and nested jars in
these new locations.

Closes gh-4897
Fixes gh-4868
2016-02-19 14:15:40 +00:00
Phillip Webb
962a598531 Use AssertJ in spring-boot-cli
See gh-5083
2016-02-06 15:51:26 -08:00
Phillip Webb
f276ff4bd0 Polish 2016-01-27 16:02:36 -08:00
Stephane Nicoll
83f5928e8d Update copyright header 2016-01-27 18:05:23 +01:00
Johannes Edmeier
0739717a7f Remove closure-execution from OptionHandler
It seems that the code for executing a groovy closure from the
OptionHandler is never executed and therefore not needed.

Removing the code gives the benefit that the Groovy-classes are not
needed if someone else wants to use the spring-boot-cli infrastructure to
run his own cli interface.

Closes gh-4411
2016-01-27 18:02:19 +01:00
Stephane Nicoll
cafe1dc4c6 Polish contribution
Fix additional use of \n

Closes gh-4707
2016-01-25 15:43:04 +01:00
mnhock
e0ec607735 Use a platform-specific line separator
See gh-4707
2016-01-25 14:37:38 +01:00
Phillip Webb
fbaf209240 Move master to 1.4.0.BUILD-SNAPSHOT 2016-01-24 10:45:24 -08:00
Spring Buildmaster
504d3e97ba Next development version 2016-01-21 18:41:30 -08:00
Andy Wilkinson
c4f756daee Fix MavenSettings’ handling of profiles activated by a file
Previously, MavenSettings used a FileProfileActivator with no
PathTransformer. If a settings.xml file contains a file-activated
profile this would result in an NPE within Maven. This was made worse
by the NPE not being included in the resulting failure message which
hampered diagnosis of the problem.

This commit updates MavenSettings to configure its FileProfileActivator
with a PathTransformer. It also improves the failure message that’s
created from any problems that are reported by Maven while determining
the active profiles to include a problem’s exception if it has one.

Closes gh-4826
2016-01-18 13:18:16 +00:00
Andy Wilkinson
93ef795159 More use entrySet() rather than using keySet() and get(key)
This commit replaces some more occurrances of keySet() and get(key)
with more efficient usage of the map's entry set.

See gh-4813
2016-01-15 17:02:42 +00:00
Phillip Webb
7397dbaf57 Allow ExitCodeGenerator to be used on Exceptions
Update exit code support to allow the ExitCodeGenerator interface to
be placed on an Exception. Any uncaught exception implementing the
interface and returning a non `0` status will now trigger a System.exit
with the code.

Fixes gh-4803
2016-01-13 12:31:37 +00:00
Spring Buildmaster
8db59059a5 Next Development Version 2015-12-18 05:43:02 -08:00
Kirill Vlasov
786aacf2e9 Use Collections.isEmpty() instead of .size() == 0
Ensure that Collections.isEmpty() is used to check if there are no
elements in a collections. This is more explicit and can be faster than
calling .size().

Closes gh-4783
2015-12-16 20:59:33 +00:00
Phillip Webb
0489a3b4de Polish 2015-12-10 19:43:29 +00:00
Andy Wilkinson
2efc4b8332 Add tests to verify improved exception message formatting 2015-12-07 13:25:12 +00:00
mnhock
bb35d18080 Improve exception messages to properly include specified sources
Closes gh-4687
2015-12-07 13:25:08 +00:00
Johnny Lim
efff4a0051 Polish
Closes gh-4554
2015-11-20 11:02:08 +01:00
Johnny Lim
da16d6d306 Polishing
Closes gh-4503
2015-11-18 11:40:19 +00:00
Spring Buildmaster
3f6f57a80e Next Development Version 2015-11-16 03:18:54 -08:00
Johnny Lim
1e4f8fdd8e Polish 2015-11-13 18:06:31 -08:00
Matt Benson
5e7376fb3c Interpolate property values for repositories
Update RepositoryConfigurationFactory to apply a RegexBasedInterpolator
to repository IDs and URLs.

Fixes gh-4318
Closes gh-4319
2015-11-11 14:41:28 -08:00
Phillip Webb
c614446d43 Merge branch '1.2.x' 2015-11-09 14:40:59 -08:00
Phillip Webb
49a5587558 Fully support -cp arguments
The CLI application advertises `-cp` support but it appears that only
`--cp` is really supported. The fix for gh-178 forgot to update the
call to `getParser().parse(...)`.

See gh-178
2015-11-09 14:38:54 -08:00
Stephane Nicoll
ce73dec992 Merge branch '1.2.x' 2015-11-06 17:51:17 +01:00
Stephane Nicoll
6d90188a27 Fix Maven/Gradle wrapper executable flag
Spring Initalizr now bundles a wrapper script for the build system. While
that wrapper has the necessary execute flag in the zip archive, that flag
is lost as the zip abstraction does not honor those.

The init command now makes sure to restore the execute flag on `mvnw`
and `gradlew` if necessary.

Unfortunately, this can't be tested as the Windows build would fail to
assert that the executable flag has been propertly set.

Closes gh-4392
2015-11-06 17:47:27 +01:00
Phillip Webb
9be0020f7b Fix package tangle in CLI 2015-10-20 15:00:32 -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
Spring Buildmaster
2b38a861e3 Next Development Version 2015-10-16 05:57:24 -07:00
Phillip Webb
b0d287356c Revert "Increase PermGen for CLI integration tests"
This reverts commit 4c26b0c194.
2015-10-16 00:28:05 -07:00
Phillip Webb
4c26b0c194 Increase PermGen for CLI integration tests 2015-10-15 23:36:18 -07:00
Andrey Stolyarov
9a63e574b6 Add spring war command
Add a `war` command to the CLI to generate WAR archives.

Fixes gh-925
Closes gh-4168
2015-10-14 20:16:21 -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
d10xa
d5e3e991fa Fix typo
Closes gh-4120
2015-10-09 17:02:13 +02:00
Phillip Webb
c525689b0f Polish 2015-10-07 23:40:34 -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
Stephane Nicoll
4ccbca259b Properly escape command line arguments
Closes gh-3841
2015-10-07 10:58:07 +02:00
Dave Syer
5d8ccbacdf Add a convenience AstTransformation base class for BOMs
Plugin authors can extend this class, provide missing methods,
and specify a BOM to add to the dependency management lookup
(i.e. dependencies by artifactId)
2015-10-06 09:31:23 +01:00
Dave Syer
44c1348094 Fix DependencyResolutionContext for multiple boms
The problem was that it was not accumulating DependencyManagement
instances. It was throwing away the old ones and replacing with
only the latest.
2015-10-05 21:39:20 +01:00
Andy Wilkinson
26324f68b9 Make system props available when building model for CLI dep mgmt bom
Certain Maven profile activator’s require access to System properties
to determine whether or not a profile should be activated.
JdkVersionProfileActivator is one such activator.

Prior to this commit, the presence of a Maven profile that was activated
based on the JDK in a bom imported using @DependencyManagementBom in the
CLI would trigger a failure as the JdkVersionProfileActivator could not
determine the version of Java on which it was running.

This commit updates the CLI to pass the JVM’s System properties to the
request to build a bom’s model so that those system properties can be
used by JdkVersionProfileActivator (and any other activators which need
them).
2015-10-05 11:33:04 +01:00
Dave Syer
ddbbd37718 Change order of bom transformation to allow others earlier 2015-10-05 09:54:58 +01:00
Spring Buildmaster
9409c49c10 Next development version 2015-09-16 09:00:17 -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
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
Phillip Webb
6193b640a4 Polish 2015-09-02 23:44:19 -07:00
Stephane Nicoll
6f3cc712bf Merge branch '1.2.x' 2015-08-20 14:48:31 +02:00
Stephane Nicoll
6869b0d987 Fix wrong imports on StringUtils
Closes gh-3792
2015-08-20 14:46:20 +02:00
Stephane Nicoll
7c0c953f81 Add value alias for SpringApplicationConfiguration
Given that Spring Boot uses java config accross the board, a new `value`
attribute is now aliased to the existing `classes` attribute such that
one could write the following:

@SpringApplicationConfiguration(MyConfig.class)
public class MyTest {}

Closes gh-3635
2015-08-19 17:09:34 +02:00
Stephane Nicoll
73ee6652fd Use project location to infer the artifactId
On start.spring.io, if you customize the artifactId it creates a zip file
with the same name. The `spring init` command did not have a similar
shortcut.

This commit updates the request to customize the artifactId if none is
set and a custom location was specified. Just as we check for the
presence of a dot to figure out if we have to extract the archive or not,
we check for it to generate an artifactId without an extension.

In practice, `spring init foo` creates a foo directory with a project
whose artifactId is `foo` and `spring init foo.zip` stores a foo.zip
file with the same project (i.e. the artifactId is `foo`).

Closes gh-3714
2015-08-14 17:10:21 +02:00
Stephane Nicoll
04b1de2d1d Add package-name option for spring init
For some reason, we forgot to add an attribute to customize the package
name when using spring init. This is now the case.

Closes gh-3716
2015-08-10 14:32:50 +02:00
Stephane Nicoll
42e230192f Polish 2015-07-24 07:19:53 +02:00
Phillip Webb
f0f5f78e25 Polish 2015-07-14 22:17:52 -07:00
Andy Wilkinson
5e4a450030 Gracefully handle profiles in settings.xml with no <activation>
See gh-3483
2015-07-14 14:05:04 +01:00
Andy Wilkinson
eb5c195c23 Add settings.xml that was missed in 84937551 2015-07-14 13:07:07 +01:00
Andy Wilkinson
8493755178 Configure CLI with repositories from active profiles in settings.xml
This commit enhances the CLI to use the repositories configured in the
profiles declared in a user's Maven settings.xml file during
dependency resolution. A profile must be active for its repositories
to be used.

Closes gh-2703
Closes gh-3483
2015-07-14 12:30:18 +01:00
Dave Syer
f6c395d0a6 Add Maven incantation to make STS 3.7 happy 2015-07-13 14:00:44 +01:00
Phillip Webb
ee3de5f38a Add ApplicationRunner support to CLI
Add ApplicationRunner and ApplicationArguments to the CLI compiler
auto-configuration.

See gh-1990
2015-07-10 13:51:57 -07:00
Dave Syer
924b9f9dde Add Maven incantation to make STS 3.7 happy 2015-07-10 15:56:40 +01:00
Stephane Nicoll
97634e85ac Remove unnecessary keyword 2015-07-09 14:33:01 +02:00
Stephane Nicoll
a073a505ae Move spring.oauth2.* to security.oauth2.*
Unfortunately, we have no other choice to flip the ignoreUnknownFields
attribute of `SecurityProperties` has many different target are now set
for that namespace outside the class. See gh-3445 for a potential way
to improve that.

Closes gh-3327
2015-07-08 18:26:25 +02:00
Spring Buildmaster
7ce391db4f Next development version 2015-07-01 22:48:01 -07:00
Phillip Webb
61fc4f3f12 Polish copyright headers 2015-06-23 10:22:14 -07:00
Stephane Nicoll
2ff9299bcf Fix typo 2015-06-19 15:53:17 +02:00
Phillip Webb
fffc6f5dd2 Merge branch '1.2.x' 2015-06-18 12:52:56 -07:00
Phillip Webb
1e40bff174 Polish 2015-06-18 12:52:41 -07:00
Andy Wilkinson
c60d65823b Merge branch '1.2.x' 2015-06-18 17:02:49 +01:00
Andy Wilkinson
7d80f0efea Update tests so that they also work on Windows
See gh-3274
2015-06-18 17:01:09 +01:00
Andy Wilkinson
a6a8d0b221 Merge branch '1.2.x' 2015-06-18 13:31:29 +01:00
Andy Wilkinson
af067ae28b Add files that were accidentally omitted from 5e743fb2
See gh-3274
2015-06-18 13:30:20 +01:00
Andy Wilkinson
77f303b42c Merge branch '1.2.x' 2015-06-18 12:38:33 +01:00
Andy Wilkinson
5e743fb299 Fully honour local repository location configured in settings.xml
Previously, DefaultRepositorySystemSessionAutoConfiguration would
read the local repository configuration from settings.xml, but did
not perform any property interpolation. This would leave placeholders
such as ${user.home} as-is and result in the use of the wrong
location. To address this, the code that reads settings.xml has been
updated to provide the current System properties as a property
interpolation source.

RepositoryConfigurationFactory configures the local repository as a
"remote" repository when the local repository location has been
overridden. This allows spring grab to copy dependencies from the
local repository into the grab output location (configured via the
grape.root system property) rather than having to download them again.
This logic did not consider the customization of the local repository
location via settings.xml so the dependencies would be downloaded again.
To address this, RepositoryConfigurationFactory has been updated to
attempt to use the location configured in settings.xml, before falling
back to the default location.

The logic that reads settings.xml has deliberately been duplicated. It
could have been extracted into a separate class, but this is only a
temporary measure until gh-3275 is tackled. Duplication was deemed
preferable to adding a new public class in 1.2.x that we’d then want to
remove in 1.3.

Closes gh-3274
2015-06-18 12:37:19 +01:00
Phillip Webb
49039c33ea Polish 2015-06-15 11:44:44 -07:00
Dave Syer
2c829c7229 Add support for Spring Retry in CLI 2015-06-12 14:55:07 +01:00
Andy Wilkinson
5defa42436 Update AetherGrapeEngineTests to only use milestone repo when needed
Closes gh-3051
2015-06-10 16:19:07 +01:00
Phillip Webb
5312be4a25 Fix CLI package tangle
Remove explicit TestFailedException catch in CommandRunner and instead
rely on the fact that TestFailedException extends CommandException.

Fixes gh-3167
2015-06-09 16:41:20 -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