Commit Graph

386 Commits

Author SHA1 Message Date
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
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
Andy Wilkinson
a2c5b6a7bb Preserve dependencies when uninstalling from the CLI
Previously, the CLI did not keep track of a dependency's users. This
meant that installing two extensions with a common dependency and
then unistalling one extension would break the other extension as the
common dependency would be deleted:

 1. Install a that depends on c
 2. Install b that depends on c
 3. Uninstall b
 4. a is now broken as c has been deleted

This commit updates the CLI to maintain a count for each artifact
that's installed into /lib. An artifact is now only deleted when the
count reaches zero.

As part of this change the code has been
extensively refactored to bring the structure into line with other CLI
commands and to improve testability.

Closes gh-1410
2014-10-14 14:40:44 +01:00
Andy Wilkinson
f6bf32c3ee Add option help to the CLI's install and uninstall commands
Closes gh-1704
2014-10-14 10:07:18 +01:00
Dave Syer
f9010c18cc Fix install command on Windows
Windows absolute paths cannot be processed by the CLI compiler, so the install
command wasn't working on Windows. This change converts ths path to a URI first
and then it works as a Spring Resource.
2014-10-13 13:57:22 +01:00
Stephane Nicoll
8ed461947f Improve RabbitMQ support in CLI
This commit deprecates the proprietary EnableRabbitMessaging annotation
in favour of the standard @EnableRabbit introduced as of Spring Rabbit
1.4.

Fixes gh-1494
2014-09-05 17:52:20 +02:00
Andy Wilkinson
f5ab0cf2dc Update CLI install to prefer local snapshots to those in a remote repo
Previously, InstallCommand used a custom Grape root and then walked
the tree of files downloaded by Aether to determine which files it
should install or uninstall. In some scenarios two files for the
same module would be present: one named foo-1.0.0.BUILD-SNAPSHOT.jar
and one named foo-1.0.0.BUILD-20140905.091809-2.jar. The former is
from the local repository and the later is from a remote repository.
In this case, the visitor would do the wrong thing and the latter
would be installed into lib.

This commit updates InstallCommand to determine the jars that it
should process by consulting GroovyCompiler's classpath, rather than
by walking Aether's cache. This approach selects the correct jar as
Aether has already figured this out as part of resolving the
dependency. It also brings InstallCommand into line with JarCommand.

The previous implementation used Java 7-specific File APIs. As part
of the above-described change this usage has been removed. The
install command can now be used on Java 6.

Fixes gh-1515
2014-09-05 15:36:04 +01:00
Phillip Webb
8bf1f9567a Apply eclipse formatting and cleanup rules 2014-09-04 09:49:13 -07:00
Stephane Nicoll
85c95744f9 Avoid duplicate script
This commit avoids a script duplication: the integration test runs the
sample instead of a copy of it in the repro directory.

Also switched the sample from ActiveMQ to HornetQ as #323 revealed
some locking on CI. Hopefully that should fix it as HornetQ is non
persistent and can be embedded several times in the same VM.

Fixes gh-1456
2014-08-29 10:26:29 +02:00
Phillip Webb
f8a4df0838 Polish 2014-08-28 12:07:44 -07:00
Stephane Nicoll
dd6bf5730d Add support for EnableCaching in the cli
Fixes gh-1431
2014-08-28 17:13:16 +02:00
Stephane Nicoll
affb202e74 Improve JMS support in cli
This commit deprecates the proprietary EnableJmsMessaging annotation in
favour of the standard @EnableJms introduced as of Spring 4.1. This
commit also updates the sample and adds an integration test as the
feature was actually broken.

Fixes gh-1456
2014-08-28 14:25:14 +02:00
Phillip Webb
de7ff0670d Polish 2014-08-19 14:22:46 -07:00
Andy Wilkinson
90b12d738b Merge branch '1.1.x' 2014-08-19 19:44:11 +01:00
Andy Wilkinson
896a85b575 Add settings.xml used by AetherGrapeEngineTests 2014-08-19 19:43:46 +01:00
Andy Wilkinson
cee8c9f4ea Merge branch '1.1.x' 2014-08-19 17:56:10 +01:00
Andy Wilkinson
5f9fddd44a Explicitly apply mirror and auth settings to remote repos in the CLI
Previously, the CLI relied on Aether using the session's mirror
selector and authentication selector to customize the configured
repositories. These selectors are only used to configure what Aether
calls recessive repositories (repositories discovered when resolving
an artifact), rather than the explicitly configured repositories that
are typically used.

This commit updates AetherGrapeEngine to apply mirror and
authentication configuration to every added repository, bringing its
behaviour for these two settings into line with what it already does
for proxy configuration.

Fixes #1354
2014-08-19 17:55:54 +01:00
Dave Syer
eb4aee6c45 Improve error logging in InstallCommand 2014-08-19 07:40:33 +01:00
Dave Syer
1fe1399959 Add install command
Fixes gh-1393
2014-08-18 18:01:22 +01:00
Dave Syer
457cea60e6 Add ServiceLoader for AST transformations
The loading is via a marker interface SpringBootAstTransformation
to avoid clashing with other services registered as org.groovy.*

Fixes gh-1392
2014-08-18 16:15:06 +01: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
Dave Syer
26cc628535 Merge branch '1.1.x' 2014-08-04 15:47:54 -07:00
Dave Syer
0c6a0bde5f Export SPRING_HOME for commands to consume if needed 2014-08-04 15:47:38 -07:00
Dave Syer
67ba66dc4c Merge branch '1.1.x' 2014-07-31 15:58:30 -07:00
Dave Syer
6ba8269db8 Add public getter for dependency context 2014-07-31 15:57:41 -07:00
Dave Syer
59b8fc63d9 Scan for a valid MANIFEST.MF instead of taking the first one
Fixes gh-1321
2014-07-31 09:51:49 -07:00
Phillip Webb
53d24301d1 Merge branch '1.1.x' 2014-07-28 15:41:42 -07:00
Phillip Webb
f8bf0e2031 Polish 2014-07-28 15:40:40 -07:00
Andy Wilkinson
f97251b9cf Merge branch '1.1.x' 2014-07-24 20:38:41 +01:00
Andy Wilkinson
f5c8a8879a Isolate CLI integration tests from any settings decryption failures 2014-07-24 20:38:21 +01:00
Andy Wilkinson
3c99bbf524 Merge branch '1.1.x' 2014-07-24 18:02:34 +01:00