Skip to content

Automatically filter additional-spring-configuration-metadata.json from Spring Boot-built archives #27430

Closed as duplicate

Description

@wangliang181230

Exclude additional-spring-configuration-metadata.json from the jars.
This file is not required.

图片

Activity

  1. bclozel commented on Jul 21, 2021

    @bclozel
    Member

    This file is packaged with your project to provide additional information to developers when working with your library, as explained in our reference documentation.

    Not packaging it with the library would make that file useless.

  2. added
    status: declinedA suggestion or change that we don't feel we should currently apply
    and removed
    status: waiting-for-triageAn issue that has not yet been triaged. Contributions will not be accepted.
    on Jul 21, 2021
  3. bclozel commented on Jul 21, 2021

    @bclozel
    Member

    @wilkinsona pointed out that this information is indeed merged in the main metadata file.

    I’m not sure how we can prevent this file from being packaged with the library. Is there anything we can do here? Maybe document how to filter out this file in the build?

  4. added
    status: waiting-for-triageAn issue that has not yet been triaged. Contributions will not be accepted.
    and removed
    status: declinedA suggestion or change that we don't feel we should currently apply
    on Jul 21, 2021
  5. wangliang181230 commented on Jul 22, 2021

    @wangliang181230
    Author

    Can put the additional-spring-configuration-metadata.json in the src/main/xxx directory? Not the /src/main/resources/META-INF directory.

  6. wangliang181230 commented on Jul 22, 2021

    @wangliang181230
    Author

    Outside the /src/main/resources directory, I think it will not be packaged into the library.

  7. changed the title [-]remove `additional-spring-configuration-metadata.json` from the jar of the spring-boot application[/-] [+]Remove `additional-spring-configuration-metadata.json` from the jar[/+] on Jul 22, 2021
  8. bclozel commented on Jul 22, 2021

    @bclozel
    Member

    I'm not sure the annotation processor will be able to find these files if they're not shipped as resources.

  9. wangliang181230 commented on Jul 22, 2021

    @wangliang181230
    Author

    Can the Maven plugin merge the metadata?

  10. wangliang181230 commented on Jul 23, 2021

    @wangliang181230
    Author

    @bclozel The maven-jar-plugin can exclude additional, and is merged to the main metadata.

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <excludes>
                        <exclude>**/META-INF/additional-spring-configuration-metadata.json</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>
    

    图片

  11. 2 remaining items

  12. wilkinsona commented on Jul 26, 2021

    @wilkinsona
    Member

    I think it would be nice to avoid bundling the additional metadata file by default if we can.

    It would be straightforward in our own build, but I'm not sure it's possible to do it automatically for users while using a location beneath src/main/resources. They could be building a shared module without our Maven or Gradle plugins so we don't have a chance to filter things.

    The only other option that I can think of is to use a location outside src/main/resources for the metadata as suggested above. I wonder about the additional complexity of this, though, and the possible impact on up-to-date checks and incremental compilation with Gradle.

  13. wilkinsona commented on Jul 26, 2021

    @wilkinsona
    Member

    We're going to update the Maven and Gradle plugins to filter out the file automatically. We'll also update the documentation to suggest that anyone building a library without our plugins configures their build to do the same.

  14. changed the title [-]Remove `additional-spring-configuration-metadata.json` from the jar[/-] [+]Automatically filter `additional-spring-configuration-metadata.json` from Spring Boot-built archives[/+] on Jul 26, 2021
  15. added and removed
    for: team-attentionAn issue we'd like other members of the team to review
    status: waiting-for-triageAn issue that has not yet been triaged. Contributions will not be accepted.
    on Jul 26, 2021
  16. added this to the 2.x milestone on Jul 26, 2021
  17. modified the milestones: 2.x, 3.x on Aug 19, 2022
  18. modified the milestones: 3.x, 4.x on Dec 10, 2025
  19. wilkinsona commented on Sep 3, 2026

    @wilkinsona
    Member

    Closing in favor of #51386.

  20. removed this from the 4.x milestone on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions