question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Maven plugin (spring-boot:run) should take list for JVM arguments

See original GitHub issue

Problem: It is too easy to break spring-boot:run by passing in garbage in the <jvmArguments> configuration. Currently it looks like this (not a list):

<plugin>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-maven-plugin</artifactId>
  <configuration>
    <jvmArguments>any kind of garbage</jvmArguments>
  </configuration>
</plugin>

Solution: The Maven plugin should allow passing in Java (JVM) system properties via some kind of list definition in XML.

Example solution:

<plugin>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-maven-plugin</artifactId>
  <configuration>
    <jvmArguments>
      <options>
        <option>-Xms512m</option>
        <option>-Xmx1024m</option>
      </options>
      <systemProperties>
        <systemProperty>systemProperty1=value1</systemProperty>
        <systemProperty>systemProperty2=value2</systemProperty>
      </systemProperties>
    </jvmArguments>
  </configuration>
</plugin>

where each <option> is passed in as-is to the JVM, and each <systemProperty> is pre-pended with a -D:

-Xms512m -Xmx1024m -DsystemProperty1=value1 -DsystemProperty2=value2

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
alan-czajkowskicommented, Oct 11, 2017

@vadeg i’m not a fan of “listing” elements like that in XML, my preference is that element lists should be clean looking whereby the top-level element is the plural word of what the list is, and each element is the singular word, example:

<apples>
  <apple>red</apple>
  <apple>green</apple>
  <apple>yellow</apple>
</apples>

even Spring uses this approach! https://www.tutorialspoint.com/spring/spring_injecting_collection.htm

0reactions
snicollcommented, Apr 24, 2018

Closing in favour of PR #10741

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot Maven Plugin – spring-boot:run
JVM arguments that should be associated with the forked process used to run the application. On command line, make sure to wrap multiple...
Read more >
How to add JVM options to program started by mvn spring ...
You can configure spring-boot-maven-plugin to always include you jvm options when run: <plugin> <groupId>org.springframework.boot</groupId> ...
Read more >
Command-line Arguments in Spring Boot - Baeldung
First, let's see how we can pass arguments while running our application using Maven Plugin. Later, we'll see how to access the arguments...
Read more >
Maven cheatsheet
As a example I will use the Spring boot plugin. The project you can easily ... jvmArguments User property: spring-boot.run.jvmArguments JVM ...
Read more >
IntelliJ IDEA - Spring Boot run configuration - JetBrains
Save the run configuration settings to a file that you can share with other team members. The default location is .idea/runConfigurations. However, if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found