Rename "agent" to "agents" to properly indicate its type

Closes gh-15455
pull/15595/head
Stephane Nicoll 6 years ago
parent 960d375f57
commit 51936e1a5c

@ -78,10 +78,19 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
* Path to agent jar. NOTE: the use of agents means that processes will be started by * Path to agent jar. NOTE: the use of agents means that processes will be started by
* forking a new JVM. * forking a new JVM.
* @since 1.0 * @since 1.0
* @deprecated since version 2.2. Use agents instead.
*/ */
@Parameter(property = "spring-boot.run.agent") @Parameter(property = "spring-boot.run.agent")
private File[] agent; private File[] agent;
/**
* Path to agent jars. NOTE: the use of agents means that processes will be started by
* forking a new JVM.
* @since 2.2
*/
@Parameter(property = "spring-boot.run.agents")
private File[] agents;
/** /**
* Flag to say that the agent requires -noverify. * Flag to say that the agent requires -noverify.
* @since 1.0 * @since 1.0
@ -218,7 +227,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
} }
private boolean hasAgent() { private boolean hasAgent() {
return (this.agent != null && this.agent.length > 0); File[] configuredAgents = determineAgents();
return (configuredAgents != null && configuredAgents.length > 0);
} }
private boolean hasJvmArgs() { private boolean hasJvmArgs() {
@ -360,11 +370,12 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
} }
private void addAgents(List<String> args) { private void addAgents(List<String> args) {
if (this.agent != null) { File[] configuredAgents = determineAgents();
if (configuredAgents != null) {
if (getLog().isInfoEnabled()) { if (getLog().isInfoEnabled()) {
getLog().info("Attaching agents: " + Arrays.asList(this.agent)); getLog().info("Attaching agents: " + Arrays.asList(configuredAgents));
} }
for (File agent : this.agent) { for (File agent : configuredAgents) {
args.add("-javaagent:" + agent); args.add("-javaagent:" + agent);
} }
} }
@ -373,6 +384,11 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
} }
} }
@SuppressWarnings("deprecation")
private File[] determineAgents() {
return (this.agents != null) ? this.agents : this.agent;
}
private void addActiveProfileArgument(RunArguments arguments) { private void addActiveProfileArgument(RunArguments arguments) {
if (this.profiles.length > 0) { if (this.profiles.length > 0) {
StringBuilder arg = new StringBuilder("--spring.profiles.active="); StringBuilder arg = new StringBuilder("--spring.profiles.active=");

Loading…
Cancel
Save