Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for adding comments to generated build configuration #1490

Open
breun opened this issue Dec 4, 2023 · 2 comments
Open

Support for adding comments to generated build configuration #1490

breun opened this issue Dec 4, 2023 · 2 comments

Comments

@breun
Copy link

breun commented Dec 4, 2023

I'm using MavenBuild.ConfigurationBuilder to generate some Maven plugin configuration in a project that builds on top of Spring Initializr, like this:

appMavenBuild.plugins().add("com.google.cloud.tools", "jib-maven-plugin") { pluginBuilder ->
    pluginBuilder.configuration { configurationBuilder ->
        configurationBuilder.add("container") { containerBuilder ->
            containerBuilder.add("jvmFlags") { jvmFlagsBuilder ->
                jvmFlagsBuilder
                    .add("jvmFlag", "-XX:InitialRAMPercentage=50")
                    .add("jvmFlag", "-XX:MaxRAMPercentage=50")
            }
        }
    }
}

This results in the following XML in pom.xml, as expected:

<plugin>
  <groupId>com.google.cloud.tools</groupId>
  <artifactId>jib-maven-plugin</artifactId>
  <configuration>
    <container>
      <jvmFlags>
        <jvmFlag>-XX:InitialRAMPercentage=50</jvmFlag>
        <jvmFlag>-XX:MaxRAMPercentage=50</jvmFlag>
      </jvmFlags>
    </container>
  </configuration>
</plugin>

Now I'd like to add a comment to the generated jvmFlag entries, like this:

<plugin>
  <groupId>com.google.cloud.tools</groupId>
  <artifactId>jib-maven-plugin</artifactId>
  <configuration>
    <container>
      <jvmFlags>
        <jvmFlag>-XX:InitialRAMPercentage=50</jvmFlag>
        <jvmFlag>-XX:MaxRAMPercentage=50</jvmFlag><!-- See https://example.com/some/url for heap memory sizing recommendations. -->
      </jvmFlags>
    </container>
  </configuration>
</plugin>

I believe the current MavenBuild.ConfigurationBuilder API doesn't provide a way to generate Maven configuration with comments, or am I missing something?

What are your thoughts about extending the API to allow adding comments? I can also see use cases for adding comments in other places in generated build configuration, so maybe it would be a good idea to add support for comments to all add(...) methods in classes in the io.spring.initializr.generator.buildsystem package?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 4, 2023
@moupriyaroy25
Copy link

Hi, I have been using spring initializer for more than 6 months to create Springboot application. Mind if I take up this issue and start working on it?

@breun

This comment was marked as duplicate.

@mhalbritter mhalbritter added type: enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 1, 2024
@mhalbritter mhalbritter added this to the General Backlog milestone Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants