Last active
January 22, 2025 13:32
-
-
Save wreulicke/7f483b294b1a5ab0c3b5ceef81a04ccb to your computer and use it in GitHub Desktop.
gradleでライブラリ作ってる時にpom.xmlからbomを外す方法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
publishing { | |
publications { | |
create<MavenPublication>("library") { // この行適当にコピペしてきたのでミスってたらごめん | |
from(components.java) | |
// delete BOM from pom.xml to avoid conflicts | |
pom { | |
withXml { | |
def pomNode = asNode() | |
if (pomNode.dependencyManagement.size() > 0) { | |
pomNode.remove(pomNode.dependencyManagement) | |
} | |
} | |
} | |
// add resolved versions to dependencies | |
versionMapping { | |
usage("java-api") { | |
fromResolutionResult() | |
} | |
usage("java-runtime") { | |
fromResolutionResult() | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment