File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import org.gradle.api.attributes.Category
2+
13apply plugin : ' maven-publish'
24apply plugin : ' signing'
35
@@ -57,11 +59,27 @@ publishing {
5759 withXml {
5860 def dependenciesNode = asNode(). appendNode(' dependencies' )
5961
62+ def resolvedVersions = [:]
63+ project. configurations. releaseRuntimeClasspath. incoming. resolutionResult. allComponents. each { component ->
64+ def moduleVersion = component. moduleVersion
65+ if (moduleVersion != null ) {
66+ resolvedVersions[" $moduleVersion . group :$moduleVersion . name " . toString()] = moduleVersion. version
67+ }
68+ }
69+
6070 project. configurations. implementation. allDependencies. each {
71+ if (it. group == null || it. name == null ) return
72+
73+ def category = it. attributes. getAttribute(Category . CATEGORY_ATTRIBUTE )
74+ if (category != null && category. name in [Category . REGULAR_PLATFORM , Category . ENFORCED_PLATFORM ]) return
75+
76+ def version = it. version ?: resolvedVersions[" $it . group :$it . name " . toString()]
77+ if (version == null ) return
78+
6179 def dependencyNode = dependenciesNode. appendNode(' dependency' )
6280 dependencyNode. appendNode(' groupId' , it. group)
6381 dependencyNode. appendNode(' artifactId' , it. name)
64- dependencyNode. appendNode(' version' , it . version)
82+ dependencyNode. appendNode(' version' , version)
6583 }
6684 }
6785 }
You can’t perform that action at this time.
0 commit comments