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
fb2ab67f
Commit
fb2ab67f
authored
May 11, 2018
by
Johnny Lim
Committed by
Stephane Nicoll
May 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
Closes gh-13148
parent
b17c58b1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
24 deletions
+28
-24
AbstractRunMojo.java
.../java/org/springframework/boot/maven/AbstractRunMojo.java
+24
-20
run-env-variables.apt.vm
...ven-plugin/src/site/apt/examples/run-env-variables.apt.vm
+1
-1
run-system-properties.apt.vm
...plugin/src/site/apt/examples/run-system-properties.apt.vm
+2
-2
SystemPropertyFormatterTests.java
...ingframework/boot/maven/SystemPropertyFormatterTests.java
+1
-1
No files found.
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java
View file @
fb2ab67f
...
...
@@ -256,6 +256,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
* @see #enableForkByDefault()
*/
protected
void
logDisabledFork
()
{
if
(
getLog
().
isWarnEnabled
())
{
if
(
hasAgent
())
{
getLog
().
warn
(
"Fork mode disabled, ignoring agent"
);
}
...
...
@@ -269,6 +270,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
getLog
().
warn
(
"Fork mode disabled, ignoring working directory configuration"
);
}
}
}
private
void
doRunWithForkedJvm
(
String
startClassName
)
throws
MojoExecutionException
,
MojoFailureException
{
...
...
@@ -338,7 +340,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
* @return a {@link RunArguments} defining the JVM arguments
*/
protected
RunArguments
resolveJvmArguments
()
{
final
StringBuilder
stringBuilder
=
new
StringBuilder
();
StringBuilder
stringBuilder
=
new
StringBuilder
();
if
(
this
.
systemPropertyVariables
!=
null
)
{
stringBuilder
.
append
(
this
.
systemPropertyVariables
.
entrySet
().
stream
()
.
map
((
e
)
->
SystemPropertyFormatter
.
format
(
e
.
getKey
(),
e
.
getValue
()))
...
...
@@ -358,7 +360,9 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
private
void
addAgents
(
List
<
String
>
args
)
{
if
(
this
.
agent
!=
null
)
{
if
(
getLog
().
isInfoEnabled
())
{
getLog
().
info
(
"Attaching agents: "
+
Arrays
.
asList
(
this
.
agent
));
}
for
(
File
agent
:
this
.
agent
)
{
args
.
add
(
"-javaagent:"
+
agent
);
}
...
...
@@ -390,7 +394,9 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
.
append
((
classpath
.
length
()
>
0
?
File
.
pathSeparator
:
""
)
+
new
File
(
ele
.
toURI
()));
}
if
(
getLog
().
isDebugEnabled
())
{
getLog
().
debug
(
"Classpath for forked process: "
+
classpath
);
}
args
.
add
(
"-cp"
);
args
.
add
(
classpath
.
toString
());
}
...
...
@@ -468,11 +474,9 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
}
private
void
logArguments
(
String
message
,
String
[]
args
)
{
StringBuilder
sb
=
new
StringBuilder
(
message
);
for
(
String
arg
:
args
)
{
sb
.
append
(
arg
).
append
(
" "
);
if
(
getLog
().
isDebugEnabled
())
{
getLog
().
debug
(
Arrays
.
stream
(
args
).
collect
(
Collectors
.
joining
(
" "
,
message
,
""
)));
}
getLog
().
debug
(
sb
.
toString
().
trim
());
}
private
static
class
TestArtifactFilter
extends
AbstractArtifactFeatureFilter
{
...
...
@@ -569,11 +573,11 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
*/
static
class
SystemPropertyFormatter
{
public
static
String
format
(
Object
key
,
Object
value
)
{
public
static
String
format
(
String
key
,
String
value
)
{
if
(
key
==
null
)
{
return
""
;
}
if
(
value
==
null
||
String
.
valueOf
(
value
)
.
isEmpty
())
{
if
(
value
==
null
||
value
.
isEmpty
())
{
return
String
.
format
(
"-D%s"
,
key
);
}
return
String
.
format
(
"-D%s=\"%s\""
,
key
,
value
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-env-variables.apt.vm
View file @
fb2ab67f
...
...
@@ -40,7 +40,7 @@ Dmytro Nosan
If the value is empty or not defined (i.e. <<<<MY_ENV/>>>>), the env variable is set
with an empty String as the value. Maven trims values specified in the pom so it is
not possible to specify a
env variable who
needs to start or end with a space.
not possible to specify a
n env variable which
needs to start or end with a space.
Any String typed Maven variable can be passed as system properties. Any attempt to pass
any other Maven variable type (e.g. a <<<List>>> or a <<<URL>>> variable) will cause the
...
...
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-system-properties.apt.vm
View file @
fb2ab67f
...
...
@@ -27,7 +27,7 @@
<systemPropertyVariables>
<property1>test</property1>
<property2>${my.value}</property2>
</
profi
les>
</
systemPropertyVariab
les>
</configuration>
...
</plugin>
...
...
@@ -41,7 +41,7 @@
If the value is empty or not defined (i.e. <<<<my-property/>>>>), the system property
is set with an empty String as the value. Maven trims values specified in the pom so it
is not possible to specify a System property wh
o
needs to start or end with a space via
is not possible to specify a System property wh
ich
needs to start or end with a space via
this mechanism: consider using <<<jvmArguments>>> instead.
Any String typed Maven variable can be passed as system properties. Any attempt to pass
...
...
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/SystemPropertyFormatterTests.java
View file @
fb2ab67f
...
...
@@ -49,7 +49,7 @@ public class SystemPropertyFormatterTests {
}
@Test
public
void
parseKeyWithOnlySpace
()
{
public
void
parseKeyWithOnlySpace
s
()
{
assertThat
(
SystemPropertyFormatter
.
format
(
"key1"
,
" "
))
.
isEqualTo
(
"-Dkey1=\" \""
);
}
...
...
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