Commit Graph

259 Commits

Author SHA1 Message Date
Andy Wilkinson
a010de955d Reinstate ./repository as a "remote" repository
The grab command downloads the dependencies of one or more Groovy
scripts to ./repository. This commit ensures that those previously
downloaded dependencies can be used by a subsequent invocation of the
run command.

The location and behaviour of the local cache is unaffected by this
change. If the dependencies in ./repository do not exist in the local
cache, Aether will "download" them from ./repository and store them in
the local cache.

Fixes #191
2014-01-08 11:34:17 +00:00
Andy Wilkinson
a58e4cbb1f Add support for configuring Aether via settings.xml
Previously, Aether's configuration was largely hard-coded making it
impossible to configure a mirror, provide credentials for accessing
a repository, etc.

This commit adds support for configuring Aether via Maven's
settings.xml file. The support is optional and must be enabled by
grabbing spring-boot-maven-settings in an init script. The Aether
instance that's used when running the application will then be
configured using settings.xml. The settings file is expected to be
found in ${user.home}/.m2/settings.xml.

The configuration of the following items is currently supported:

 - Offline
 - Proxies
 - Mirrors
 - Server authentication
 - Local repository location

If the support is not enabled, settings.xml does not exist, or
settings.xml does not configure certain things then sensible defaults
are applied.
2014-01-08 11:21:56 +00:00
Andy Wilkinson
2e81b1d0d0 Test that auto configurations can be added by init scripts
When an init command is run, it may add entries to the classpath. This
commit adds a test that verifies that, if an entry that is added to
the classpath contains a CompilerAutoConfiguration file in
META-INF/services, then the CompilerAutoConfigurations declared in it
are found by subsequent ServiceLoader.load calls.
2014-01-08 11:21:56 +00:00
Dave Syer
4e1245d9ee Restore changes from 0332501 (fix class loader test failure) 2014-01-08 07:30:09 +00:00
Andy Wilkinson
3336b6da44 Remove redundant @GrabResolver transform
Previously, a transform was used to add @GrabResolver annotations
during compilation that added the Spring milestone and snapshot
repositories. This functionality is now handled by
RepositoryConfigurationFactory so the transform is no longer required.
2014-01-07 10:31:10 +00:00
Greg Turnquist
b5b86d07ba Add Spring MVC's org.springframework.ui package to the list of automatic imports 2014-01-06 17:30:05 +00:00
Dave Syer
ac34f9c993 First proper draft of DSL for Groovy Commands
Users can declare or Command, OptionHandler classes in an init script
or they can use a DSL, e.g.

command("foo") { args -> println "Do stuff with ${args} array" }

or

command("foo") {
  options { option "bar", "Help text for bar option" ithOptionArg() ofType Integer }
  run { options -> println "Do stuff with ${options.valueOf('bar')}" }
}
2014-01-06 16:00:10 +00:00
Dave Syer
1e75c0a55b Extend programming model for script commands 2014-01-06 11:40:21 +00:00
Dave Syer
b5db4d3ff4 Enhance FileOptions to support multiple classpath resources 2014-01-06 11:40:21 +00:00
Dave Syer
cd7b1b19c5 Add InitCommand to execute groovy script on startup
InitCommand runs on creation of SpringCli so it can search for additional
Commands in updated classpath. Also added as interactive command in Shell
session.
2014-01-06 11:40:21 +00:00
Dave Syer
033250195b Allow user to specify classLoader as loader property
PropertiesLauncher now supports creating its own class loader
from looader.classLoader property. It will succeed if the
implementation specified has a default constructor or one
that takes a parent class loader, or one that takes a URL[]
and a parent class loader (like URLClassLoader).
2014-01-06 11:40:20 +00:00
Dave Syer
e48ddaeb99 Fix grab test 2014-01-06 10:41:49 +00:00
Dave Syer
df476bed1f Ensure local repository cache is always used 2014-01-03 09:56:22 +00:00
Phillip Webb
bd6c672bba Drop jumping into shell when running without args
Change SpringCli so that running without arguments no longer jumps into
the embedded REPL shell. This restores the ability to obtain quick usage
help by simply typing `spring` from the command prompt.

Windows users or developers that prefer the embedded shell can still
launch it using `spring shell`.
2014-01-02 14:26:04 -08:00
Phillip Webb
f56318e9b8 Polish embedded REPL shell 2014-01-02 14:13:22 -08:00
Phillip Webb
1bcd3de7b5 Polish 2014-01-02 12:10:37 -08:00
Phillip Webb
0f9c705980 Rework OptionHandler '-cp' argument support
Change OptionHandler to support '-cp' instead of '--cp'. This update
to the original fix (045088e8b) renders `help` output correctly and
should prevent potential issues if a `-p` command is added in the future.

Fixes gh-178
2014-01-02 11:42:59 -08:00
Dave Syer
045088e8b3 Add -cp to option help for compiler commands
Fixes gh-178
2013-12-31 12:24:49 +00:00
Dave Syer
4cfc7b6ad9 Make sure integration still works in CLI 2013-12-30 11:19:52 +00:00
Dave Syer
aa2b020660 Refactor metrics to expose richer feature set
Main user-facing interface is still Counter/GaugeService but the
back end behind that has more options. The Default*Services write
metrics to a MetricWriter and there are some variants of that, and
also variants of MetricReader (basic read-only actions).

MetricRepository is now a combination of MetricReader, MetricWriter
and some more methods that make it a bit more repository like.

There is also a MultiMetricReader and a MultiMetricRepository for
the common case where metrics are stored in related (often open
ended) groups. Examples would be complex metrics like histograms
and "rich" metrics with averages and statistics attached (which
are both closed) and "field counters" which count the occurrences
of values of a particular named field or slot in an incoming message
(e.g. counting Twitter hastags, open ended).

In memory and redis implementations are provided for the repositories.
Generally speaking the in memory repository should be used as a
local buffer and then scheduled "exports" can be executed to copy
metric values accross to a remote repository for aggregation.
There is an Exporter interface to support this and a few implementations
dealing with different strategies for storing the results (singly or
grouped).

Codahale metrics are also supported through the MetricWriter interface.
Currently implemented through a naming convention (since Codahale has
a fixed object model this makes sense): metrics beginning with "histogram"
are Histograms, "timer" for Timers, "meter" for Meters etc.

Support for message driven metric consumption and production are provided
through a MetricWriterMessageHandler and a MessageChannelMetricWriter.

No support yet for pagination in the repositories, or for HATEOAS style
HTTP endpoints.
2013-12-30 10:32:42 +00:00
Dave Syer
5d8e58d12c Remove support for Integration DSL (milestone only) 2013-12-30 07:39:36 +00:00
Dave Syer
de82557bd8 Change command set when entering shell
Fixes gh-147
2013-12-24 07:45:48 +00:00
Dave Syer
d50d378c33 Prevent more than one app at a time from running 2013-12-23 22:13:50 +00:00
Dave Syer
0bca416d3b Remove CLI_APP name if in shell 2013-12-23 22:13:50 +00:00
Dave Syer
cc8aa753da Add basic Banner to CLI Shell 2013-12-23 22:13:50 +00:00
Dave Syer
cccb5d4610 Add ShellCommand and friends 2013-12-23 22:13:50 +00:00
Dave Syer
75af18df7d Add support for beans{} in CLI scripts
User can add (a single) beans{} DSL declaration (see GroovyBeanDefinitionReader
in Spring 4 for more detail) anywhere at the top level of an application source
file. It will be compiled to a closure and fed in to the application context
through a GroovyBeanDefinitionReader. Cool!

The example spring-boot-cli/samples/beans.groovy runs in an integration test
and passes (see SampleIntegrationTests).
2013-12-19 17:11:01 +00:00
Dave Syer
e2c962ac28 Switch to thymeleaf-spring4 2013-12-19 13:40:24 +00:00
Phillip Webb
d04248a845 Use SHA1 checksum for homebrew 2013-12-18 23:19:24 -08:00
Phillip Webb
1931d6eb9d Fix broken homebrew 2013-12-18 23:09:34 -08:00
Phillip Webb
513c6a1de2 Polish 2013-12-16 14:38:52 -08:00
Dave Syer
f2cdb8c69f Change interface of CommandFactory slightly
It's super useful to get a reference to the current SpringCli
instance in the CommandFactory. Potentially implementations can
react to the properties of the Cli, or wrap it into something
more complex.

...supports the likely implementation of the REPL use
case that @jbrisbin has been working on.
2013-12-10 13:38:52 +00:00
Andy Wilkinson
b0c5d3254a Make "." be the CLI's default classpath
Previously, the default classpath was empty. Now, in the absence of the
user providing a classpath via the -cp option, the default classpath
will be ".". If the user does specify a classpath, the classpath that's
used will be exactly what they have specified, i.e. "." will no longer
be on the classpath unless specified by the user.

The app sample integration test has been updated to verify that "." is
only the classpath by default.

Fixes #115
2013-12-04 11:13:49 +00:00
Dave Syer
f1026b1202 Add JreProxySelector to handle global proxy configuration
The JreProxySelector is used it to adjust the repositories
as they are added to the GrapeEngine. It looks at standard
System proeprties like http.proxyHost and http.proxyPort
and in addition consults standard JRE Authenticator features
for credentials (falling back to System properties
http.proxyUser and http.proxyPassword).

Fixes gh-136
2013-11-29 10:12:08 +00:00
Dave Syer
47d079d937 Add default proxy settings from System proerties
Aether apparently doesn't use the java.net.* APIs for
TCP connections so it doesn't notice when a user sets
-Dhttp.Proxy*. To fix it is painful, and leads me to
suspect that actually we might want to parse a
settings.xml at some point (however unpalatable that
is).

For now I have added a Proxy to all RemoteRepository
instances that we create in the CLI if the user
has set -Dhttp.proxyHost (and/or -Dhttps.proxyHost for
a secure repository).

TODO: authentication. Is there a standard way to specify
that globally via system properties.

TODO: maybe use per-repository settings if provided
(e.g. in settings.xml).
2013-11-28 10:10:57 +00:00
Phillip Webb
f4f668a52b Polish 2013-11-25 17:12:56 -08:00
Dave Syer
bd26b28aa5 Extract actuator security into separate classes
So spring-security + a web app is secure by default
(you don't need the actuator).
2013-11-21 16:47:29 +00:00
Dave Syer
89332e230e Speed up grab command test
The autoconfiguration transformations (and loads of grabs
of spring-boot snapshots) were making the grab command
tests run really slowly. Snapshots are particularly bad.

Fixed by adding a --autoconfigure=false option to the
compiler configuration and using it in that test.
2013-11-20 09:58:09 +00:00
Dave Syer
a7368fcd33 Move grab-sample to resources dir 2013-11-20 08:58:29 +00:00
Andy Wilkinson
820f43d3bc Add grab command to collect script's dependencies
Previously, run --local could be used to collect a script's
dependencies in ./repository. However, with this mechanism it wasn't
possible to collect the dependencies without running the application.

This commit adds a new command, grab, that can be used to collect
a script's dependencies in ./repository without having to run it.
run is configured with ./repository as a location in which it can find
its dependencies so that the previously collected dependencies
can be used when subsequently running the app.

As part of this work RunCommand and TestCommand have been refactored
to use common code for their common options:

	--no-guess-imports
	--no-guess-dependencies
	--classpath

Previously, the declaration and handling of the options was duplicated
in the two classes. GrabCommand also has these three options and uses
the same common code.
2013-11-19 15:20:27 +00:00
Andy Wilkinson
fd2583ed28 Support concise @Grab on all types of imports
Previously, the automatic addition of the group and version to a
@Grab annotation based on the module name would only work on standard
import statements. This commit adds support for this functionality
on wildcard imports, static imports and wildcard static imports.

All of the following are now supported:

@Grab('spring-core')
import org.springframework.util.Assert

@Grab('spring-core')
import org.springframework.util.*

@Grab('spring-core')
import static org.springframework.util.Assert.isTrue

@Grab('spring-core')
import static org.springframework.util.Assert.*
2013-11-18 12:40:57 +00:00
Phillip Webb
64f32893bb Source format and clean-up 2013-11-16 00:08:18 -08:00
Phillip Webb
127da15c3c Add homebrew formula as generated artifact 2013-11-16 00:08:17 -08:00
Phillip Webb
077cd662e7 Add zsh shell completion script 2013-11-16 00:08:14 -08:00
Phillip Webb
fe0dd8e08f Don't provide hints for the hint command 2013-11-15 16:39:29 -08:00
Phillip Webb
ff635cf75b Move shell completion logic to Java
Refactor bash shell completion to move the majority of the logic into
the Java code. This commit also removes the need for the '--' prefix on
every command.
2013-11-09 09:31:38 -08:00
Phillip Webb
e6597e6f33 Fix broken tests 2013-11-07 10:30:18 -08:00
Dave Syer
0c1aa1942e Add tests for loading dependencies in starters without parent 2013-11-07 16:05:01 +00:00
Dave Syer
578fadf6f9 Attempt to allow Aether to load from local repo 2013-11-07 15:47:41 +00:00
Dave Syer
e46c427b75 Remove unused field 2013-11-07 15:47:41 +00:00
Andy Wilkinson
32fc2c3d1c Remove Boot-specifics from AetherGrapeEngine
With the goal of making AetherGrapeEngine generally useful with Groovy,
this commit removes any Boot specifics from it. Specifically, there
is now only a single default repository: Maven Central. The
Boot-specific Spring milestone and snapshot repositories are now added
via @GrabResolver annotations that are added using an ASTTransformation.

As part of this change, AetherGrapeEngine has also been updated to store
its repositories using a LinkedHashSet, this ensures that the same
repository is not used more than once while maintaining their ordering.
2013-11-06 17:46:53 +00:00
Andy Wilkinson
b05f3e2eec Fix CliTester so that sample integration tests can be run 2013-11-06 17:46:33 +00:00
Andy Wilkinson
6ab14a51eb Add detailed download reporting to AetherGrapeEngine
Groovy's Grape allows a user to enable download reports using the
system property groovy.grape.report.downloads. This commit updates
AetherGrapeEngine to honour this property and produce a detailed
download report when the system property is set to true. In the
absence of the system property, or when it's set to a value other than
true, the existing summary report is still produced.

[bs-344]
[60145094]
2013-11-06 15:52:33 +00:00
Andy Wilkinson
dc4bf01e95 Add support for @GrabExclude to AetherGrapeEngine
@GrabExclude can now be used to exclude certain transitive dependencies.
In Aether (Maven), exclusions are applied to an individual dependency
rather than being global. In Grape, exclusions are global.
AetherGrapeEngine adheres to the Grape convention by applying every
exclusion create by @GrabExclude to every dependency, effectively making
them global.
2013-11-06 14:36:13 +00:00
Andy Wilkinson
5aba3272c2 Add support for @GrabResolver to AetherGrapeEngine
@GrabResolver can now be used to add a repository to the list that is
used for dependency resolution. Any repository that is added via the
annotation will then be available for the lifetime of the
AetherGrapeEngine instance. In reality, this equates to the lifetime
of the Boot application. This is in keeping with the documented default
behaviour [1]: "By default, the grape subsystem is shared globally, so
added resolvers will become available for any subsequent grab calls".

[1] - http://groovy.codehaus.org/api/groovy/lang/GrabResolver.html

[bs-345]
[60145036]
2013-11-06 13:20:08 +00:00
Andy Wilkinson
acfdfb789d Update main class to reflect use of JarLauncher
b19f6bb238 updated the CLI so that it should be launched using Spring
Boot Loader's JarLauncher, however the spring and spring.bat shell
scripts were not updated so they still launched the CLI by using
SpringCli as the main class. This led to a NoClassDefFoundError
as none of the dependencies in the jar's /lib directory could be
found.

This commit updates the two shells scripts to use JarLauncher as the
main class.
2013-11-06 11:48:27 +00:00
Dave Syer
8cb0211dce Add "integration" profile in Maven build
By default it is on, but you can switch it
off (`-P '!integration'`) to ignore integration tests
and get a faster build.

.travis.yml uses this feature so that it doesn't keep
failing on a timeout.
2013-11-06 09:43:58 +00:00
Dave Syer
dac470a8fc Add useful features to CliTester 2013-11-06 09:43:58 +00:00
Phillip Webb
aede0165a0 Favor groovy.jar instead of groovy-all.jar
Update CLI application to use groovy.jar rather than groovy-all.jar.
This prevents classloading issues when a user project @Grabs groovy-ant.
2013-11-05 09:56:59 -08:00
Phillip Webb
557f69a449 Remove accidental commit 2013-11-05 09:10:43 -08:00
Phillip Webb
b19f6bb238 Isolate class loading for launched CLI apps
Rework classloading for launched applications so that CLI classes and
dependencies are not visible. This change allows many of the previous
hacks and workarounds to be removed.

With the exception of the 'org.springframework.boot.groovy' package
and 'groovy-all' all user required depndencies are now pulled in
via @Grab annotations.

The updated classloading algorithm has enabled the following changes:

- AetherGrapeEngine is now back in the cli project and the
  spring-boot-cli-grape project has been removed. The AetherGrapeEngine
  has also been simplified.

- The TestCommand now launches a TestRunner (similar in design to the
  SpringApplicationRunner) and report test failures directly using
  the junit TextListener. Adding custom 'testers' source to the users
  project is no longer required. The previous 'double compile' for
  tests has also been removed.

- Utility classes have been removed in favor of using versions from
  spring-core.

- The CLI jar is now packaged using the 'boot-loader' rather than using
  the maven shade plugin.

This commit also applied minor polish refactoring to a number of
classes.
2013-11-04 23:19:46 -08:00
Phillip Webb
d7ae8cafbf Move tests from 'samples' to 'test-samples' 2013-11-04 22:21:37 -08:00
Phillip Webb
bec1c8f00f Polish 2013-11-04 22:17:38 -08:00
Andy Wilkinson
b631c113ba Update AetherGrapeEngine to honour --local
When running an application, --local can be used to collect the
application's dependencies in a local directory. Prior to
AetherGrapeEngine being introduced, using --local would result in the
dependencies being written to ./grapes. When AetherGrapeEngine was
introduced --local no longer had any effect.

This commit updates AetherGrapeEngine so that it honours --local,
writing its dependencies to ./repository. When --local is not specified
dependencies are written to ~/.m2/repository (the standard location
for the local Maven cache). As part of this change TestCommand has
been refactored so that it lazily initialises its GroovyCompiler. This
ensures that RunCommand has a chance to set the system property that
backs --local before AetherGrapeEngine is initialised and accesses the
property.

Fixes #99
2013-11-04 11:08:18 +00:00
Andy Wilkinson
e741557a38 Generate springcli.properties before resources are copied
Generate springcli.properties in generate-resources so that it can
be copied by the resources plugin in the process-resources phase.
2013-11-04 11:08:18 +00:00
Greg Turnquist
cc92ba1a5c Fix spring test to properly handle failures
Failing test cases weren't not properly handled and instead caused
test to break. Added a test case and verified it works for both JUnit
and Spock.
2013-11-04 10:09:48 +00:00
Dave Syer
78b2f17502 Fix typo in Javadocs 2013-11-02 15:50:09 +00:00
Andy Wilkinson
45c61eb96b Remove special case for integration sample's milestone dependency
3d714d301 allowed all integration tests to download snapshots and
milestones. The test for the integration sample, which depends upon a
milestone, no longer needs to be a special case.
2013-10-31 11:59:03 +00:00
Phillip Webb
a6a1929274 Extract inner-classes from GroovyCompiler
Extract and refactor inner-classes from the GroovyCompiler to improve
code readability.
2013-10-29 00:04:31 -07:00
Phillip Webb
eff587d5b0 Create CliTester JUnit @Rule
Extract logic from SampleIntegrationTests into a reusable JUnit @Rule.
2013-10-28 07:38:07 -07:00
Phillip Webb
a9c9c383f4 Polish pom.xml
Aplly consistent formatting, drop JDK 8 support and cleanup repo
locations to use spring.io.
2013-10-28 07:37:02 -07:00
Phillip Webb
3d714d3016 Allow snapshot repositories in integration tests
Update CLI SampleIntegrationTests to no longer disable snapshot repos.
2013-10-28 05:44:01 -07:00
Andy Wilkinson
1a76c972e3 Always install new GrapeEngine
Previously, GrapeEngineInstaller would only install its GrapeEngine
if an engine had not already been installed. As the Grape class stores
the engine in a static field, this meant that the engine would only be
installed once for the lifetime of Grape's classloader. This caused
an ordering issue in SampleIntegrationTests.

The test for the integration sample clears the
disableSpringSnapshotRepos system property to allow M1 of the
integration DSL to be resolved. However, this property is only
examined and honoured in AetherGrapeEngine's constructor. If another
test had run and had already created and installed an
AetherGrapeEngine, the new AetherGrapeEngine that allowed the use of
snapshot repositories would not be installed and the test would fail.

This commit updates GrapeEngineInstaller so that it always installs
its GrapeEngine, overwriting any previously installed engine.
2013-10-25 14:33:00 +01:00
Andy Wilkinson
ecc5463a76 Allow integration sample to download DSL milestone 2013-10-24 16:22:11 +01:00
Andy Wilkinson
4f47f71dc2 Allow use of snapshot repos to be disabled
Previously, the Ivy-based Grape engine used a system property,
disableSpringSnapshotRepos, to control whether or not Spring's
snapshot and milestone repositories were used for dependency
resolution. This commit adds the same capability to AetherGrapeEngine.

[#59489826]
2013-10-24 15:33:39 +01:00
Andy Wilkinson
1d5cb7731d Support transitive=false in AetherGrapeEngine
@Grab allows a dependency to be declared, but for its transitive
dependencies to be excluded by setting transitive to false. This
commit enhances AetherGrapeEngine to honour this setting by using a
wildcard exclusion on any dependency so declared.
2013-10-24 13:57:38 +01:00
Andy Wilkinson
00a0cab781 Remove remaining git.properties files 2013-10-22 17:26:44 +01:00
Andy Wilkinson
c0ae78f3ec Isolate Aether in a separate class loader
Prior to this commit, the Aether-based GrapeEngine was loaded in the
same class loader as the rest of Boot. This led to Aether's and its
dependencies' types polluting the application's class path. Most
notably, this caused problems with logging as the logging framework
could be permaturely initialized.

This commit isolates AetherGrapeEngine, Aether and its dependencies
into a separate class loader. This is done by customizing the
packaging of the CLI's jar file with the internal directory housing
all of the types that will be loaded by the separate class loader.
2013-10-22 17:13:20 +01:00
Andy Wilkinson
39e8e46e2a Provide an Aether-based Grape Engine
Previously, @Grab annotations would use Ivy to download the
dependencies with some of Ivy's known limitations being worked around
by GrapeEngineCustomizer.

This commit adds a GrapeEngine implementation that uses Aether,
the dependency resolution 'engine' used by Maven and Grails. To ensure
consistent behaviour with a Maven build, the Aether-powered dependency
resolution uses the dependency management configuration from the
spring-boot-starter-parent pom file.
2013-10-22 16:06:53 +01:00
Andy Wilkinson
97f93bfa64 Support simple @Grab annotations everywhere
Previously, simple @Grab annotations only worked on classes. This commit
updates the simple @Grab support so that they can be used on anything
that can be annotated with @Grab.

The simplified @Grab support relies upon springcli.properties having
been generated. This commit adds an M2E lifecycle mapping for the
antrun plugin so that springcli.properties is generated as part of an
Eclipse build, thereby making it easier to run tests in Eclipse that
rely upon the simplified @Grab support.
2013-10-10 16:57:13 +01:00
Andy Wilkinson
b855ab6cae Treat Maven artifacts with bundle packaging as jars
Previously, LocalM2Resource used the pom's packaging configuration to
determine the suffix of the file that it should look for, e.g. if
the pom's packaging was jar, it would look for a file with a .jar
suffix in artifactExists(). This logic fails for artifacts with bundle
packaging as it would look for a .bundle file rather than a .jar file,
fail to find the file, and incorrectly report that the artifact does not
exist.

This commit updates LocalM2Resource to look for a file with a .jar
suffix when the packaging configuration in the pom is bundle.
2013-10-10 14:42:28 +01:00
Dave Syer
3adfdd34ec Use simplified @Grab where possible 2013-10-09 10:16:01 -04:00
Dave Syer
1dd0cca294 Update M4->M5 in README 2013-10-09 09:04:39 -04:00
Phillip Webb
af0d08c998 Polish 2013-10-08 21:17:39 -07:00
Phillip Webb
b772f7c2e4 Polish
Minor formatting and consistent copyright header.
2013-10-08 20:30:45 -07:00
Phillip Webb
efe102bd51 Polish CLI tester code
Reduce duplication by extracting FileOptions class to be shared by
both the RunCommand and the TestCommand.

Also applied minor code convention tweaks.
2013-10-08 20:22:59 -07:00
Dave Syer
ef17ff8d24 Adapt device change to new springcli.properties 2013-10-08 17:50:55 -04:00
Roy Clarkson
5cdaa43912 Add Spring Mobile Device Resolver autoconfiguration 2013-10-08 17:43:09 -04:00
Dave Syer
84a213f774 Add README to cli 2013-10-08 16:27:47 -04:00
Dave Syer
a72ab9eb7d Refactor cli properties into single project 2013-10-08 15:53:55 -04:00
Dave Syer
b5f0f97110 Clean up TestCommand paraphenalia 2013-10-08 15:39:37 -04:00
Greg Turnquist
1ce13cc2c2 Add 'spring test [files]' command to compile and test code automatically
- Look for JUnit test symbols, and add JUnit automatically
- Look for Spock test symbols, and add Spock automatically
- Based on what test libraries were used, invoke relevant embedded testers
  and accumulate results
- Make it so that multiple testers can be invoked through a single 'test' command
- Print out total results and write out detailed trace errors in results.txt
- Update based on the new artifact resolution mechanism
2013-10-08 12:09:54 -05:00
Andy Wilkinson
c1ec5e5c0e Support @Grab without a version or group
Usually, use of @Grab requires you to specify a group, module, and
version when identifying a dependency. This can be done in two
different ways:

@Grab(group='alpha', module='bravo', version='1.0.0')
@Grab('alpha:bravo:1.0.0')

This commit allows users to only specify a module: the group is
inferred and the version is the one dictated by the boot CLI. Both
forms are supported:

@Grab(module='bravo')
@Grab('bravo')

Groovy's global AST transformations, which is how Grab is implemented,
do not support ordering and we need to augment the AST for the Grab
annotation before its processed by the Grab AST transformation. To
work around this, reflection is used to get hold of the compile
operations in the conversion phase, and a new AST transformation is
inserted immediately before the first AST transformation operation.

To allow a module's groupId and version to be resolved consistently,
META-INF/springcli.properties has been enhanced to include properties
for each module that we want to support in the following form:

<module>.groudId = <groudId>
<module>.version = <version>

<groupId> and <version> are taken from the Maven project's
dependencies and VPP, a Velocity-based pre-processor, is used to
automatically generate the enhanced properties file.

To prevent pollution of spring-boot-cli's class path with the
dependencies that are only required to populate springcli.properties,
a separate project, spring-boot-cli-properties, has been created.
spring-boot-cli depends upon this now project causing it to, via the
shade plug, include the properties file in its jar.

Previously DependencyCustomizer allow a dependency to be added by
specifying its full coordinates, i.e. a group ID, artifact ID, and
version. This commit updates DependencyCustomizer to only require
an artifact/module ID. The group ID and version are then resolved
using the same mechanism as the enhanced @Grab support.

[#56328644] [bs-312] Allow @Grab without version
2013-10-08 10:41:35 +01:00
Greg Turnquist
941d163709 Add support for Spring Rabbit (via Spring AMQP) to Boot
- If RabbitTemplate is on the classpath, turn on autodetection.
- Create a RabbitTemplate, a Rabbit ConnectionFactory, and a RabbitAdmin is spring.rabbitmq.dynamic:true
- Enable some **spring.rabbitmq** properties like host, port, username, password, and dynamic
- Add tests to verify functionality
- Add Groovy CLI functionality. Base it on @EnableRabbitMessaging. Add spring-amqp to the path.
- Create rabbit.groovy test to prove it all works.
- Make Queue and TopicExchange top-level Spring beans in rabbit.groovy test script
2013-09-26 12:14:06 -04:00
Greg Turnquist
fa6e6fde6c Add JMS autoconfig support
* application.properties support for spring.jms and spring.activemq

* more tests to verify ActiveMQConnectionFactory pooling

* Groovy support and simple sample with activemq

* Groovy detection mechanism is @EnableJmsMessaging annotation
2013-09-26 11:53:06 -04:00
Phillip Webb
c544921eaa Polish whitespace 2013-09-24 15:42:45 -07:00
Phillip Webb
fd9e258d12 Replace 'springsource.org' with 'spring.io'
Replace all references to 'springsource.org' with the new 'spring.io'
domain.
2013-09-23 14:44:59 -07:00
Christian Dupuis
a1631d581b Add license and legal information on third party open source software that is part of the CLI distribution 2013-09-20 16:40:02 +01:00
Greg Turnquist
97af88a8d8 Switch activemq to version 5.4.0 to avoid slf4j issue 2013-09-20 15:38:59 +01:00
Dave Syer
04ba4d064e Investigating failing tests 2013-09-20 15:38:49 +01:00
Phillip Webb
9a529b41c1 Polish 2013-09-18 12:50:47 -07:00
Phillip Webb
b857a9001d Cleanup trailing whitespace 2013-09-18 12:17:56 -07:00
Greg Turnquist
5801e422cf [BS-48] Add autoconfigured JMS support
* Add ability to detect spring-jms on the path and create a JmsTemplate with
  ActiveMQConnectionFactory
* Create tests showing autoconfigured JmsTemplate with ActiveMQ, but prove it
  backs off if a separate ConnectionFactory exists.
* Add support to spring-boot-cli to that it detects JmsTemplate, DefaultMessageListenerContainer,
  or SimpleMessageListenerContainer, and turns on autoconfiguration as well as
  add proper @Grab's and import statements.
* Write a jms.groovy test showing proper CLI support

Simplify ActiveMQ configuration

Update ActiveMQ to 5.7.0
2013-09-18 17:52:14 +01:00
Dave Syer
f76662a6ec Add spring-jdbc as well if necessary 2013-09-14 11:01:55 -07:00
Dave Syer
621ecd3901 Added JDBC and @Transactional support to Groovy CLI
* @EnableTransactionManagement triggers spring-tx imports
* Field or method of type JdbcTemplate or NamedParameterJdbcTemplate
  of DataSource triggers spring-jdbc imports
2013-09-13 08:02:56 -07:00
Dave Syer
8467a66e84 Add security.management.enabled flag 2013-09-06 19:54:15 +01:00
Phillip Webb
a33425920b Rework POMs to support automated CI release 2013-09-05 22:05:29 -07:00
Phillip Webb
a44f8bc59e Increase SampleIntegrationTests run timeouts
Increase the timeouts to give CI builds more time should dependencies
be missing.
2013-09-05 22:04:39 -07:00
Dave Syer
38e565e920 Back to SNAPSHOT for dev 2013-09-05 17:15:15 -07:00
Dave Syer
b634b3bde6 Update to 0.5.0.M2 2013-09-05 17:15:15 -07:00
Phillip Webb
347f30d135 Recognize @RestController as MVC Application
Update CLI SpringMvcCompilerAutoConfiguration to recognize Spring's new
@RestController annotation.
2013-09-05 17:15:14 -07:00
Phillip Webb
13f51b7901 Add version properties
Add version properties to dependencies POM so that users can easily
override. Also use consistent naming for all property keys.
2013-09-05 17:15:14 -07:00
Dave Syer
5fa0166dea Upgrade to Reactor 1.0.0.M2 2013-09-05 17:14:17 -07:00
Dave Syer
082678d660 Use echo+exit instead of die 2013-09-05 17:14:17 -07:00
Phillip Webb
1d4f86452f Use web-starter for CLI MVC compiler auto-config 2013-09-05 17:14:16 -07:00
Phillip Webb
47d0ba5c8e Remove superfluous ivy log output 2013-09-05 17:14:15 -07:00
Phillip Webb
0a9d7c6ef2 Use managed spring-integration-groovy-dsl
Update SpringIntegrationCompilerAutoConfiguration to use the managed
version of spring-integration-groovy-dsl.
2013-09-05 17:14:15 -07:00
Phillip Webb
4ad3d30a40 Fixup CLI POM
Fix classloader issues by excluding spring JARs from test classpath
and also include spring-integration-groovy-dsl as a managed dependency.
2013-09-05 17:14:15 -07:00
Dave Syer
05e678acb3 Clean out grapes 2013-09-05 17:14:10 -07:00
Dave Syer
d88e1b4b7a Add test case for ivy customization
A bug in ivy (tickled by maven leaving a pom
but no jar in the local repo) would make the
default Grapes ivy config fail (cannot grab...).
Phil's workaround now has a test case.
2013-09-05 17:14:09 -07:00
Phillip Webb
39aea5d944 Ensure localm2 ivy repo can resolve artifacts
Fix the localm2 repository to only consider that a pom exists when
its artifact is contained in the repository.

This prevents a download error that can occur when the local m2
repository contains a POM file but not a JAR.

Issue: #55532358
2013-09-05 17:14:09 -07:00
Dave Syer
b720f7e688 Startup time for CLI app much quicker now
The Boot resolver didn't transfer enough of the settings
of the default ChainResolver. Adding a boolean flag was
enough to make the chatter die down for dependencies
that were unneeded.

[Fixes #55358344] [bs-291]
2013-09-05 17:14:08 -07:00
Dave Syer
0993f3da0a Restore Tomcat in CLI
Seems to work. I think the problem was the race conditions
that we hopefully already eliminated. I got an out of memory
error running the samples tests in Eclipse, but then it went
away again (something to look out for).

[Fixes #54925992] [bs-280]
2013-09-05 17:14:08 -07:00
Dave Syer
0d583deb27 Add CLASSPATH elements back to spring CLI script
Also add @WebConfiguration as a shortcut for groovy
scripts to get MVC behaviour (without a @Controller)

[#54926366]
2013-08-12 18:18:11 +01:00
Phillip Webb
cf655945aa Polish 2013-08-09 12:28:54 -07:00
Phillip Webb
f25b9e109f Remove trailing whitespace from bash script 2013-08-08 05:07:44 -07:00
Dave Syer
3b9df63f73 Add bash completion for spring command
* Added src/main/content/bash_completion.d/spring
* Also made all commands alias to "--<self>" so
"--help" is a synonym for "help" (for instance). This
helps with the completion generation.

[Fixes #54827292]
2013-08-08 11:00:41 +01:00
Phillip Webb
f4c129a063 Don't use snapshot repos for CLI test
Update SampleIntegrationTests to only use local maven repo when
running integration tests.
2013-08-06 01:22:59 -07:00
Phillip Webb
5189d9d3e6 Don't generate dependency reduced POM 2013-08-06 00:14:49 -07:00
Phillip Webb
4e11ae1671 Documentation
Various updates to README.md files.
2013-08-05 22:36:22 -07:00
Phillip Webb
40a9176937 Restructure distribution content
Include LICENCE and INSTALL text files and ensure that .bat file is
not set with executable Unix file permissions.
2013-08-05 22:31:28 -07:00
Phillip Webb
54cb7b39c9 Change assembly name to '-bin' and add tar.gz 2013-08-05 15:54:38 -07:00
Phillip Webb
f08b283b08 Implement CLI --version command 2013-08-05 15:37:11 -07:00
Phillip Webb
02f0c2b639 Get the version to clean from the pom.xml 2013-08-05 15:33:57 -07:00
Phillip Webb
aaebb3f3fb Improve Ivy resolution
Refactor GrapeEngineCustomizer to improve ivy resolution times by
failing early when resolution is known to fail.
2013-08-05 15:25:16 -07:00
Phillip Webb
e5918b6756 Restore grapes cleaner 2013-08-05 14:53:19 -07:00
Phillip Webb
77455ec3dc Fix CLI test failures 2013-08-05 13:48:14 -07:00
Phillip Webb
4038b39496 Add OutputCapture test class 2013-08-05 13:48:14 -07:00
Phillip Webb
174427881a Revert "Attempt to sort out logging dependencies"
This reverts commit e99d2199d8.

The main spring-boot project should not have compile scope dependencies
to any org.slf4j artifacts.
2013-08-05 13:48:14 -07:00
Phillip Webb
7d3ac266e8 Fix GrapesCleaner to work with renamed artifacts 2013-08-05 13:48:14 -07:00
Phillip Webb
6bb628adb4 Indicate downloading dependencies progress in CLI
Update CLI to show a "Downloading Dependencies..." message if the
initial dependency resolution takes more than 3 seconds. Whilst
downloading dots are appended to the message.

Issue: #54589094
2013-08-05 08:51:39 -07:00
Dave Syer
e99d2199d8 Attempt to sort out logging dependencies 2013-08-05 15:00:02 +01:00
Dave Syer
34500632d4 Accept SPRING_HOME if already set 2013-08-05 11:00:24 +01:00
Phillip Webb
8a4b4bd155 Add spring.bat start script for Windows 2013-08-04 14:20:26 -07:00
Phillip Webb
8a19e48e21 Polish and simplify spring bash script 2013-08-04 14:20:03 -07:00
Phillip Webb
a9700c92f3 Fix a few problems with spring start script
Fixed a few issues with the spring start script, mainly around symlinks.
Test on OSX, Ubuntu and Windows (Cygwin) with and would symlinks.
2013-08-04 08:58:07 -07:00
Phillip Webb
94855bf4ec Correct directory permissions in dist zip 2013-08-04 07:21:22 -07:00
Dave Syer
55ed0bdf45 Fix problem locating spring home 2013-08-03 09:27:57 +01:00
Phillip Webb
1db22aca5c Rework POM structure
Rework main build POM to be an aggregator pom that does not inherit
from any parent. Introduce new spring-boot-dependencies module to
act as a parent for both spring-boot-starter-parent and
spring-boot-parent.
2013-08-02 21:58:24 -07:00
Dave Syer
4bb5de02e7 Switch back to SNAPSHOT for dev 2013-08-02 12:00:14 +01:00