Upload only war/jar files in gradle(restrict zip/tar generation and upload)

会有一股神秘感。 提交于 2019-12-01 21:29:47

Included the following code snippet in my gradle file

[distZip, distTar].each { task -> configurations.archives.artifacts.removeAll
{ it.class.simpleName == "ArchivePublishArtifact" && it.archiveTask == task }

task.enabled = false
}

For more details refer this link. Its issue with spring boot plugin.

arjuncc's solution doesn't seem to work on Gradle 4.10.2, so here's one that works and uses public APIs, hopefully it will continue to work.

configurations.archives.artifacts.removeAll {
    // exclude from the archives configuration all artifacts that were generated by distZip & distTar
    def depTasks = it.getBuildDependencies().getDependencies()
    depTasks.contains(distZip) || depTasks.contains(distTar)  
}

More or less the same as ajuncc's solution, but perhaps a bit more simple. Remove all .tar artifacts from the archives configuration:

configurations.archives.artifacts.removeAll {PublishArtifact publishArtifact -> publishArtifact.type == 'tar'} 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!