Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
b1c5b30d
Commit
b1c5b30d
authored
Jul 22, 2013
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add --classpath to CLI
parent
1c6cbad3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
5 deletions
+48
-5
ui.groovy
spring-cli/samples/ui.groovy
+22
-0
RunCommand.java
...main/java/org/springframework/cli/command/RunCommand.java
+12
-0
ScriptCommand.java
...n/java/org/springframework/cli/command/ScriptCommand.java
+5
-0
GroovyCompiler.java
...java/org/springframework/cli/compiler/GroovyCompiler.java
+3
-0
GroovyCompilerConfiguration.java
...ngframework/cli/compiler/GroovyCompilerConfiguration.java
+5
-0
SampleIntegrationTests.java
.../java/org/springframework/cli/SampleIntegrationTests.java
+1
-5
bootstrap.min.css
spring-cli/src/test/resources/static/css/bootstrap.min.css
+0
-0
No files found.
spring-cli/samples/ui.groovy
View file @
b1c5b30d
...
@@ -8,4 +8,26 @@ class Example {
...
@@ -8,4 +8,26 @@ class Example {
return
"home"
;
return
"home"
;
}
}
}
@Configuration
@Log
class
MvcConfiguration
extends
WebMvcConfigurerAdapter
{
@Override
void
addInterceptors
(
def
registry
)
{
log
.
info
(
"Registering temporary file interceptor"
)
registry
.
addInterceptor
(
temporaryFileInterceptor
())
}
@Bean
HandlerInterceptor
temporaryFileInterceptor
()
{
log
.
info
(
"Creating temporary file interceptor"
)
new
HandlerInterceptorAdapter
()
{
@Override
postHandle
(
def
request
,
def
response
,
def
handler
,
ModelAndView
mav
)
{
log
.
info
(
"Model: "
+
model
)
}
}
}
}
}
\ No newline at end of file
spring-cli/src/main/java/org/springframework/cli/command/RunCommand.java
View file @
b1c5b30d
...
@@ -71,6 +71,8 @@ public class RunCommand extends OptionParsingCommand {
...
@@ -71,6 +71,8 @@ public class RunCommand extends OptionParsingCommand {
private
OptionSpec
<
Void
>
localOption
;
private
OptionSpec
<
Void
>
localOption
;
private
OptionSpec
<
String
>
classpathOption
;
private
SpringApplicationRunner
runner
;
private
SpringApplicationRunner
runner
;
@Override
@Override
...
@@ -86,6 +88,8 @@ public class RunCommand extends OptionParsingCommand {
...
@@ -86,6 +88,8 @@ public class RunCommand extends OptionParsingCommand {
"Do not attempt to guess dependencies"
);
"Do not attempt to guess dependencies"
);
this
.
verboseOption
=
option
(
asList
(
"verbose"
,
"v"
),
"Verbose logging"
);
this
.
verboseOption
=
option
(
asList
(
"verbose"
,
"v"
),
"Verbose logging"
);
this
.
quietOption
=
option
(
asList
(
"quiet"
,
"q"
),
"Quiet logging"
);
this
.
quietOption
=
option
(
asList
(
"quiet"
,
"q"
),
"Quiet logging"
);
this
.
classpathOption
=
option
(
asList
(
"classpath"
,
"cp"
),
"Additional classpath entries"
).
withRequiredArg
();
}
}
@Override
@Override
...
@@ -177,6 +181,14 @@ public class RunCommand extends OptionParsingCommand {
...
@@ -177,6 +181,14 @@ public class RunCommand extends OptionParsingCommand {
return
Level
.
INFO
;
return
Level
.
INFO
;
}
}
@Override
public
String
getClasspath
()
{
if
(
this
.
options
.
has
(
RunOptionHandler
.
this
.
classpathOption
))
{
return
this
.
options
.
valueOf
(
RunOptionHandler
.
this
.
classpathOption
);
}
return
""
;
}
}
}
}
}
...
...
spring-cli/src/main/java/org/springframework/cli/command/ScriptCommand.java
View file @
b1c5b30d
...
@@ -240,6 +240,11 @@ public class ScriptCommand implements Command {
...
@@ -240,6 +240,11 @@ public class ScriptCommand implements Command {
return
true
;
return
true
;
}
}
@Override
public
String
getClasspath
()
{
return
""
;
}
}
}
}
}
spring-cli/src/main/java/org/springframework/cli/compiler/GroovyCompiler.java
View file @
b1c5b30d
...
@@ -72,6 +72,9 @@ public class GroovyCompiler {
...
@@ -72,6 +72,9 @@ public class GroovyCompiler {
CompilerConfiguration
compilerConfiguration
=
new
CompilerConfiguration
();
CompilerConfiguration
compilerConfiguration
=
new
CompilerConfiguration
();
this
.
loader
=
new
ExtendedGroovyClassLoader
(
getClass
().
getClassLoader
(),
this
.
loader
=
new
ExtendedGroovyClassLoader
(
getClass
().
getClassLoader
(),
compilerConfiguration
);
compilerConfiguration
);
if
(
configuration
.
getClasspath
().
length
()
>
0
)
{
this
.
loader
.
addClasspath
(
configuration
.
getClasspath
());
}
// FIXME: allow the extra resolvers to be switched on (off by default)
// FIXME: allow the extra resolvers to be switched on (off by default)
addExtraResolvers
();
addExtraResolvers
();
compilerConfiguration
compilerConfiguration
...
...
spring-cli/src/main/java/org/springframework/cli/compiler/GroovyCompilerConfiguration.java
View file @
b1c5b30d
...
@@ -33,4 +33,9 @@ public interface GroovyCompilerConfiguration {
...
@@ -33,4 +33,9 @@ public interface GroovyCompilerConfiguration {
*/
*/
boolean
isGuessDependencies
();
boolean
isGuessDependencies
();
/**
* @return a path for local resources (colon separated)
*/
String
getClasspath
();
}
}
spring-cli/src/test/java/org/springframework/cli/SampleIntegrationTests.java
View file @
b1c5b30d
...
@@ -28,7 +28,6 @@ import org.apache.ivy.util.FileUtil;
...
@@ -28,7 +28,6 @@ import org.apache.ivy.util.FileUtil;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.BeforeClass
;
import
org.junit.BeforeClass
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.cli.command.RunCommand
;
import
org.springframework.cli.command.RunCommand
;
...
@@ -142,14 +141,11 @@ public class SampleIntegrationTests {
...
@@ -142,14 +141,11 @@ public class SampleIntegrationTests {
}
}
@Test
@Test
@Ignore
public
void
uiSample
()
throws
Exception
{
public
void
uiSample
()
throws
Exception
{
// FIXME Failing on OSX
// FIXME Failing on OSX
// To run this one from the command line you need to add target/test-classes to
start
(
"samples/ui.groovy"
,
"--classpath=.:src/test/resources"
);
// CLASSPATH
start
(
"samples/ui.groovy"
);
String
result
=
FileUtil
.
readEntirely
(
new
URL
(
"http://localhost:8080"
)
String
result
=
FileUtil
.
readEntirely
(
new
URL
(
"http://localhost:8080"
)
.
openStream
());
.
openStream
());
assertTrue
(
"Wrong output: "
+
result
,
result
.
contains
(
"Hello World"
));
assertTrue
(
"Wrong output: "
+
result
,
result
.
contains
(
"Hello World"
));
...
...
spring-cli/src/test/resources/css/bootstrap.min.css
→
spring-cli/src/test/resources/
static/
css/bootstrap.min.css
View file @
b1c5b30d
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment