Skip to content

Commit 9c7fb88

Browse files
authored
Change Maven artifactIds to avoid possible collisions with other libs (#8589)
* Improve Maven artifacts naming to avoid possible collisions with other libs Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
1 parent 1a206fc commit 9c7fb88

File tree

42 files changed

+99
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+99
-62
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Changelog
22
## Unreleased
33
### Breaking Changes
4+
- Changes in Maven coordinates of Besu artifacts to avoid possible collisions with other libraries when packaging plugins [#8589](https://github.com/hyperledger/besu/pull/8589)
5+
46
### Upcoming Breaking Changes
57
### Additions and Improvements
68
#### Fusaka Devnet

acceptance-tests/dsl/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
apply plugin: 'java-library'
2+
3+
jar {
4+
archiveBaseName = calculateArtifactId(project)
5+
manifest {
6+
attributes(
7+
'Specification-Title': archiveBaseName,
8+
'Specification-Version': project.version,
9+
'Implementation-Title': archiveBaseName,
10+
'Implementation-Version': calculateVersion(),
11+
'Commit-Hash': getGitCommitDetails(40).hash
12+
)
13+
}
14+
}
15+
116
dependencies {
217
implementation project(':besu')
318
implementation project(':config')

besu/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
apply plugin: 'java-library'
1717

1818
jar {
19-
archiveBaseName = 'besu'
19+
archiveBaseName = calculateArtifactId(project)
2020
manifest {
2121
attributes(
2222
'Specification-Title': archiveBaseName,

build.gradle

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ task checkMavenCoordinateCollisions {
460460
if (coordinate.toString().startsWith("org") && coordinates.containsKey(coordinate)) {
461461
throw new GradleException("Duplicate maven coordinates detected, ${coordinate} is used by " +
462462
"both ${coordinates[coordinate]} and ${it.path}.\n" +
463-
"Please add a `publishing` script block to one or both subprojects.")
463+
"Prefer automatic artifactId creation or if not possible disambiguate manually.")
464464
}
465465
coordinates[coordinate] = it.path
466466
}
@@ -491,7 +491,7 @@ subprojects {
491491
dependencies { testImplementation sourceSets.testSupport.output }
492492

493493
task testSupportJar(type: Jar) {
494-
archiveBaseName = "${project.name}-support-test"
494+
archiveBaseName = calculateArtifactId(project) + '-support-test'
495495
archiveClassifier = 'test-support'
496496
from sourceSets.testSupport.output
497497
}
@@ -545,6 +545,7 @@ subprojects {
545545
publications {
546546
mavenJava(MavenPublication) {
547547
groupId "org.hyperledger.besu.internal"
548+
artifactId calculateArtifactId(project)
548549
version "${project.version}"
549550
if (sourceSetIsPopulated("main")) {
550551
from components.java
@@ -1014,6 +1015,15 @@ def calculateVersion() {
10141015
}
10151016
}
10161017

1018+
def calculateArtifactId(configuringProject) {
1019+
def currentProject = configuringProject
1020+
def projectNames = [currentProject.name]
1021+
while((currentProject = currentProject.getParent()) != null) {
1022+
projectNames << currentProject.name
1023+
}
1024+
return projectNames.reverse().join('-')
1025+
}
1026+
10171027
def getGitCommitDetails(length = 8) {
10181028
try {
10191029
def gitFolder = "$projectDir/.git/"

config/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
apply plugin: 'java-library'
1717

1818
jar {
19-
archiveBaseName = 'besu-config'
19+
archiveBaseName = calculateArtifactId(project)
2020
manifest {
2121
attributes(
2222
'Specification-Title': archiveBaseName,

consensus/clique/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
plugins { id 'java' }
1717

1818
jar {
19-
archiveBaseName = 'besu-clique'
19+
archiveBaseName = calculateArtifactId(project)
2020
manifest {
2121
attributes(
2222
'Specification-Title': archiveBaseName,

consensus/common/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
apply plugin: 'java-library'
1717

1818
jar {
19-
archiveBaseName = 'besu-consensus-common'
19+
archiveBaseName = calculateArtifactId(project)
2020
manifest {
2121
attributes(
2222
'Specification-Title': archiveBaseName,
@@ -68,7 +68,7 @@ dependencies {
6868

6969
configurations { testArtifacts }
7070
task testJar (type: Jar) {
71-
archiveBaseName = "${project.name}-test"
71+
archiveBaseName = calculateArtifactId(project) + '-test'
7272
from sourceSets.test.output
7373
}
7474

consensus/ibft/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
apply plugin: 'java-library'
1717

1818
jar {
19-
archiveBaseName = 'besu-ibft'
19+
archiveBaseName = calculateArtifactId(project)
2020
manifest {
2121
attributes(
2222
'Specification-Title': archiveBaseName,

consensus/ibftlegacy/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apply plugin: 'java-library'
22

33
jar {
4-
archiveBaseName = 'besu-ibftlegacy'
4+
archiveBaseName = calculateArtifactId(project)
55
manifest {
66
attributes(
77
'Specification-Title': archiveBaseName,

consensus/merge/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
apply plugin: 'java-library'
1717

1818
jar {
19-
archiveBaseName = 'besu-merge'
19+
archiveBaseName = calculateArtifactId(project)
2020
manifest {
2121
attributes(
2222
'Specification-Title': archiveBaseName,

0 commit comments

Comments
 (0)