Shadow Plugin Gradle: What does mergeServiceFiles() do?

醉酒当歌 提交于 2019-12-03 10:38:30
Opal

mergeServiceFiles is declared exactly here and its implementation is as follows:

/**
 * Syntactic sugar for merging service files in JARs
 * @return
 */
public ShadowJar mergeServiceFiles() {
    try {
        transform(ServiceFileTransformer.class);
    } catch (IllegalAccessException e) {
    } catch (InstantiationException e) {
    }
    return this;
}

As you can see it uses ServiceFileTransfomer which is defined here. From its docs:

Modified from org.apache.maven.plugins.shade.resource.ServiceResourceTransformer.java

Resources transformer that appends entries in META-INF/services resources into a single resource. For example, if there are several META-INF/services/org.apache.maven.project.ProjectBuilder resources spread across many JARs the individual entries will all be concatenated into a single META-INF/services/org.apache.maven.project.ProjectBuilder resource packaged into the resultant JAR produced by the shading process.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!