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. added
    status: waiting-for-triage
    on Jul 21, 2021
  2. 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.

  3. added
    status: declined
    and removed
    status: waiting-for-triage
    on Jul 21, 2021
  4. 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?

  5. added
    status: waiting-for-triage
    and removed
    status: declined
    on Jul 21, 2021
  6. 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.

  7. wangliang181230 commented on Jul 22, 2021

    @wangliang181230
    Author

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

  8. 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
  9. 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.

  10. wangliang181230 commented on Jul 22, 2021

    @wangliang181230
    Author

    Can the Maven plugin merge the metadata?

  11. 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>
    

    图片

  12. 2 remaining items

  13. 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.

  14. 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.

  15. 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
  16. added
    type: enhancement
    and removed
    for: team-attention
    status: waiting-for-triage
    on Jul 26, 2021
  17. added this to the 2.x milestone on Jul 26, 2021
  18. modified the milestones: 2.x, 3.x on Aug 19, 2022
  19. modified the milestones: 3.x, 4.x on Dec 10, 2025
  20. wilkinsona commented on Sep 3, 2026

    @wilkinsona
    Member

    Closing in favor of #51386.

  21. added
    status: superseded
    on Sep 3, 2026
  22. 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

    status: supersededtype: enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions