How to exclude files from embed jars? I want to ex...
# community-support
s
How to exclude files from embed jars? I want to exclude the classes in
META-INF/versions/24/
in the dependency jar embed. I'm embedding it with a custom configuration
Copy code
val embedBoot by configurations.register(lowerCamelCaseGradleName(featureName, "embedBoot")) {
    isTransitive = false
    attributes
        .attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.JAR_TYPE)
        .attribute(REMAPPED_ATTRIBUTE, false)
        .attribute(INCLUDE_TRANSFORMED_OUTPUT_ATTRIBUTE, true)
        .attribute(IncludeTransformationStateAttribute.ATTRIBUTE, IncludeTransformationStateAttribute.None)
}
project.dependencies {
    embedBoot(catalog.reflect)
    embedBoot(catalog.classTransform)
    embedBoot(catalog.classTransform.additionalClassProvider)
    embedBoot(catalog.bytebuddy.agent)
}
tasks {
    named(generateModsTomlTaskName) {
        enabled = false
    }
    named<Jar>(jarTaskName) {
        from(embedBoot) {
            into("libs/boot")
        }
    }
}
m
Probably something like so: Nevermind, that doesn't work if it's a jar of jars
Copy code
named<Jar>(jarTaskName) {
        from(embedBoot) {
            into("libs/boot")
            exclude("META-INF/versions/24/**")
        }
    }
(wildly untested, please double check)
s
it's jar. will it work?
m
Oh, it's a jar of jars?
s
ya. I'm injecting the jars into the classloader
m
If that's the case, you'll have to unzip your jars with
zipTree()
I would probably register a transform
s
I need a new attribute in that case right?
m
Yea
NO_JAVA_24_BYTECODE
🙌 1
Or something like so