Commit Graph

421 Commits

Author SHA1 Message Date
Phillip Webb
1e40bff174 Polish 2015-06-18 12:52:41 -07: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
af067ae28b Add files that were accidentally omitted from 5e743fb2
See gh-3274
2015-06-18 13:30:20 +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
Spring Buildmaster
5d81c87b43 Next Development Version 2015-06-04 00:49:11 -07:00
Phillip Webb
968b68c322 Polish 2015-06-02 11:17:16 -07:00
Andy Wilkinson
2053f4b2bf Clear JAVA_OPTS in CLI tests; avoid permsize config error with Java 8
When a Java 8 JVM is launched with -XX:MaxPermSize a warning message
is output indicating that the option will be ignored. This causes the
CLI tests that assert that no error output has been produced to fail.

This commit updates the CLI's integration test harness to remove
JAVA_OPTS from the environment of the CLI process. This prevents any
unwanted max perm size configuration from leaking into that
environment and breaking the build.
2015-05-11 12:22:02 +01:00
Andy Wilkinson
0141f50ec8 Wait for stream reading threads to finish when awaiting CLI invocation
Closes gh-2787 (I hope)
2015-04-08 15:15:09 +01:00
Spring Buildmaster
e03c11dda8 Next development version 2015-03-30 22:56:20 -07:00
Spring Buildmaster
8f0ad02237 Next development version 2015-02-26 15:26:53 -08:00
Phillip Webb
56e31a8c6b Polish 2015-02-23 19:21:37 -08:00
Stephane Nicoll
9d0e50c6ac Support of spring initializr meta-data v2.1
Update the `init` command to support the latest meta-data format. Recent
Spring Initializr version also supports Spring Boot CLI now and generates
a textual service capabilities when requested. The command no longer
generates the capabilities of the service unless said service does not
support it.

Closes gh-2515
2015-02-18 17:43:53 +01:00
Andy Wilkinson
54e90c03fc Polish the javadoc in spring-boot-cli
Add missing @param and @return elements
2015-02-04 14:00:44 +00:00
Phillip Webb
072f873f34 Polish 2015-02-01 21:37:17 -08:00
Stephane Nicoll
4bee1b0e1b Fix wrong help page for archive detection logic
Fixes gh-2355
2015-01-23 17:24:14 +01:00
Andy Wilkinson
16cb44f890 Merge branch '1.1.x' 2015-01-14 16:55:45 +00:00
Andy Wilkinson
376de01636 Don't remove @GrabResolver in JarCommand, disable initClass instead
Previously, JarCommand removed all @GrabResolver annotations in an
AST transformation. This was being performed as custom resolver
configuration is not necessary in a jar as all of the dependencies are
available from the jar. Furthermore, leaving the annotations in place
caused a failure when the jar was run due to a missing Ivy dependency
that's required by Groovy's default GrapeEngine, GrapeIvy.

The removal of @GrabResolver annotations was being done before they
could be used by Groovy's GrabAnnotationTransformation to configure
the GrapeEngine's resolvers. This resulted in the annotations having
no effect such that a dependency that was only available from a
repository made available by @GrabResolver would fail to resolve if
it was not cached locally.

This commit updates the AST transformation to leave the @GrabResolver
annotations in place but to set their initClass attribute to false.
This allows the annotation to be used while the jar's being compiled,
but supresses the generation of the static initializer that adds the
custom resolver to the GrapeEngine when the compiled code's run via
java -jar.

Fixes gh-2330
2015-01-14 16:42:43 +00:00
Spring Buildmaster
60725cd8bd Next development version 2015-01-07 23:37:07 -08:00
Spring Buildmaster
63e6a25097 Next development version 2014-12-10 18:06:30 -08:00
Spring Buildmaster
1a788c1741 Next development version 2014-12-10 16:35:50 -08:00
Phillip Webb
a8ae4d1a3f Only include zip files when using spring jar
Update JarCommand to only include nested libraries that are actually
zip files. Similar to commit 38585bf3 which introduced the same
functionality to the Repackager.

Fixes gh-2094
2014-12-09 14:16:35 -08:00
Phillip Webb
3523bca79b Polish 2014-12-09 14:16:14 -08:00
Phillip Webb
d3ccdc6319 Polish 2014-12-08 08:51:01 -08:00
Stephane Nicoll
9b598b49c2 Fix JMS support in the CLI
Partly back port changes from affb202e and 85c95744f to fix the usage
of JMS in the CLI. Restore the integration test using HornetQ and fix the
coordinates of the JMS API.

Fixes gh-2075
2014-12-08 08:39:47 +01:00
Phillip Webb
064fee38b1 Formatting 2014-12-05 09:48:40 -08:00
Stephane Nicoll
8efdffbc0e Smarter output detection for generated projects
Previously, specifying a simple target name for a regular project would
store the (zip) archive in a file matching the target name. Only adding a
slash at the end of the name allows to extract it as a directory. It
turns out that such convention is not easy to catch and if a simple name
is provided on the command-line, the user probably wants to create a
directory with such a name with the content of the project.

Note that if a build file is required and the name does not have any
extension, we still store a file with the required name as auto-detecting
the extension to use is not that easy.

Fixes gh-2056
2014-12-05 14:43:31 +01:00
Stephane Nicoll
61223e709c Fix error message 2014-12-05 14:42:51 +01:00
Phillip Webb
447c9ff204 Polish 2014-12-02 15:19:51 -08:00
Graeme Rocher
dbcbebca4a Propagate exception / test failures so that the correct status code is returned.
Fixes gh-2048 and fixes gh-2051
2014-12-02 16:22:47 +00:00
Andy Wilkinson
8520554eb2 Allow the SpringApplication class used by the CLI to be configured
This commit adds support to the CLI for launching a custom
SpringApplication implementation. The class that is launched can be
configured using the spring.application.class.name System property
or the SPRING_APPLICATION_CLASS_NAME environment variable with the
former taking priority.

Closes gh-2030
2014-12-02 10:01:05 +00:00
Phillip Webb
2a8579026f Polish 2014-11-20 10:16:33 -08:00
Andy Wilkinson
0e2300cf85 Disable check of Groovy template location by default for CLI apps
In 1.1, the Groovy template support did not check that its configured
template location exists. A check was added in 1.2, however this
breaks CLI web applications that don't have the expected templates
location.

Rather than reintroducing 1.1's behaviour by removing the check, this
commit updates the CLI to set
spring.groovy.template.check-template-location to false by default.
This allows flow-blown applications to benefit from the check, while
allowing CLI apps to behave as they did in 1.1.

Closes gh-1959
2014-11-20 14:09:51 +00:00
Phillip Webb
c34cfb27a3 Polish 2014-11-19 10:52:26 -08:00
Stephane Nicoll
8f488bd019 Update init to new metadata format
Spring initializr now declares an improved metadata format (v2).

InitializrServiceMetadata has been updated to parse this format. Note
that the client could be further improved by using HAL generated links.

Closes gh-1953
2014-11-19 16:38:53 +01:00
Spring Buildmaster
46b7738334 Next development version 2014-11-11 17:12:24 -08:00
Phillip Webb
4fa8a94dd4 Update to latest Maven plugins
Fixes gh-1899
2014-11-11 12:44:31 -08:00
Phillip Webb
6027b2405c Add 'User-Agent' header to CLI REST calls
Update the InitializrService so that a 'SpringBootCli' User-Agent header
is sent with each request. This should allow the server-side code to
gracefully evolve the JSON format if needed.

Fixes gh-1869
2014-11-10 21:47:01 -08:00
Phillip Webb
e76a571dd3 Add @SpringBootApplication annotation
Add a new @SpringBootApplication which is equivalent to @Configuration,
@EnableAutoConfiguration and @ComponentScan.

See gh-1842
2014-11-06 22:49:10 -08:00
Phillip Webb
b6bacd5e8a Upgrade to Servlet 3.1, Tomcat 8 and Jetty 9
Upgrade to latest versions of Tomcat and Jetty and to the latest Servlet
API whilst will remaining compatible with Tomcat 7 and Jetty 8.

Fixes gh-1832, gh-369
2014-11-05 16:35:34 -08:00
Phillip Webb
a973fd41f4 Polish 2014-11-03 18:49:20 -08:00
Stephane Nicoll
0061f237b8 Add examples to the CLI
This commit updates the help command to also show some example(s) to
illustrate how the command can be used. The commit also defines useful
examples for the init command

Fixes gh-1809
2014-11-03 14:06:35 +01:00
Stephane Nicoll
6a18ece6a2 Explicit type takes precedence over build and format
Prior to this commit, specifying the --format and/or --build options
alongside --type did not use the explicit type as it should. This commit
ignores the --build and --format options if a type is explicitly set.

Fixes gh-1807
2014-11-03 13:12:06 +01:00
Stephane Nicoll
2e07f003c9 Init command takes the output as last argument
This commit moves the --output switch to a regular argument. This aligns
to other command, i.e. spring init my-project.zip would save the project
to "my-project.zip" in the current directory.

This commit also auto-detects the --extract option if the location ends
with a slash, i.e. spring init demo/ would extract the content of the
project in a demo directory that is local to the current directory.

Fixes gh-1802
2014-11-03 11:52:16 +01:00
Stephane Nicoll
96198e2999 polishing 2014-11-03 11:52:16 +01:00
Phillip Webb
aa2e32a041 Restore CLI startup performance
Change InitializrService to use a late binding CloseableHttpClient
since the calling `HttpClientBuilder.create().build()` is slow.

Fixes gh-1764
2014-11-01 09:56:28 -07:00
Phillip Webb
830ce80824 Polish CLI init command
Rename a few classes and methods and extract some logic into helper
classes. Also change 2 char shortcuts to a single char.

Closes gh-1751
2014-11-01 09:05:47 -07:00
Phillip Webb
b89e5e0ab7 Apply eclipse formatting rules
Apply eclipse formatting rules to b2fe2dd9.

See gh-1751
2014-11-01 08:20:12 -07:00
Stephane Nicoll
b2fe2dd912 Add init command to the CLI
This commit adds a new command to the CLI that allows to initialize a new
project from the command line. It uses the Spring initializr service to
actually generate the project.

The command offers two main operations:

1. Listing the capabilities of the service (--list or -l). This basically
dumps the defaults of a given service and the list of dependencies and
project types it supports
2. Generating a project. By default, http://start.spring.io is used and
its configured defaults are applied. Running spring init would therefore
have the same effect as clicking the 'generate project' on the UI without
entering any extra information. No file is overwritten by default.

The generation can be customized with the following options:

* --boot-version (-bv) Spring Boot version the project should use
* --dependencies (-d) comma separated list of dependencies to add to the
generated project
* --java-version (-jv) Java version to use
* --packaging (-p) the packaging for the project (jar, war)
* --target the url of the service to use

The actual type of the project can be defined in several ways:

1. Using the --type (-t) option that identifies a type that is supported
by the service
2. A combination of --build and/or --format that can be used to uniquely
identify matching these tags. Build represents the build system to use
(e.g. maven or gradle) while --format defines the format of the generated
project.

The project is saved on disk with the name provided by the server through
the Content-Disposition header, if any. It is possible to force it with
the --output option. It is possible to overwrite existing files by adding
the --force (-f) flag.

The --extract (-x) option allows to extract the project instead of saving
the zip archive. By default, the project is extracted in the current
working directory but it is possible to specify an alternate directory
using the --output option.

Fixes gh-1751
2014-10-31 08:39:03 +01:00
Phillip Webb
cf24af0bfb Rework logging to prevent double initialization
Prior to this commit LoggingSystem initialization would happen multiple
times. Once to configure "quiet" logging, and again to configure correct
settings once the Application was initialized. This could cause problems
if `logging.groovy` logback files were used.

The logging system is now only initialized once (when possible) by
following these steps:

- Standard logging initialization occurs via the actual logging
  implementation used (e.g. logback will load a logback.xml file if it
  exists)
- beforeInitization() is called to prevent early log output.
  Implementations now either use a Filter or simply set the root logging
  level.
- initialize() is called with an optional log configuration file (e.g
  a custom logback.xml location) and an optional log output file (the
  default is null indicating console only output).

The initialize() method will attempt to prevent double initialization
by checking if a standard configuration file exists. Double
initialization now only occurs in the following situations:

- The user has a standard configuration file (e.g. classpath:logback.xml)
  but also specifies a logging.config property. Double initialization is
  required since the specified configuration file supersedes the default.
- The user has a standard configuration file (e.g. classpath:logback.xml)
  and specifies a logging.file property. Double initialization is
  required since the standard configuration may use a ${LOG_FILE}
  reference.

In addition this commit removes the `logging.console` option and now
assumes that logging either occurs only to console or to both the
console and a file. This restriction helps simplify the LoggingSystem
implementations. If file only logging is required a custom logback.xml
can be used.

Fixes gh-1091
See gh-1612, gh-1770
2014-10-30 00:13:13 -07:00
Phillip Webb
2e7aa4685b Polish 2014-10-21 20:34:00 -07:00