This message was deleted.
# general
s
This message was deleted.
t
This works OK with Gradle so I guess it’s an artefact of how Maven resolves dependencies, or your specific configuration. A BOM artifact should only have a POM file since it’s just a manifest. Are you on the latest version of Maven?
e
Copy code
╰─ ./mvnw --version                                        
Apache Maven 3.9.3 (21122926829f1ead511c958d89bd2f672198ae9f)
Maven home: /Users/edeandre/.m2/wrapper/dists/apache-maven-3.9.3-bin/326f10f4/apache-maven-3.9.3
Java version: 17.0.8, vendor: Eclipse Adoptium, runtime: /Users/edeandre/.sdkman/candidates/java/17.0.8-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "14.0", arch: "aarch64", family: "mac"
i agree that a BOM artifact should only have a POM file
when I look at the
wiremock-grpc-extension
pom (https://central.sonatype.com/artifact/org.wiremock/wiremock-grpc-extension) it clearly defines a jar dependency on grpc-bom
it does not import the grpc-bom as a pom import
Copy code
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!-- This module was also published with a richer model, Gradle metadata,  -->
  <!-- which should be used instead. Do not delete the following line which  -->
  <!-- is to indicate to Gradle or any Gradle module metadata file consumer  -->
  <!-- that they should prefer consuming it instead. -->
  <!-- do_not_remove: published-with-gradle-metadata -->
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.wiremock</groupId>
  <artifactId>wiremock-grpc-extension</artifactId>
  <version>0.2.0</version>
  <dependencies>
    <dependency>
      <groupId>org.wiremock</groupId>
      <artifactId>wiremock</artifactId>
      <version>3.2.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-bom</artifactId>
      <version>1.58.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-protobuf</artifactId>
      <version>1.58.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-stub</artifactId>
      <version>1.58.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-servlet-jakarta</artifactId>
      <version>1.58.0</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java-util</artifactId>
      <version>3.24.0</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>javax.annotation</groupId>
      <artifactId>javax.annotation-api</artifactId>
      <version>1.3.2</version>
      <scope>runtime</scope>
    </dependency>
  </dependencies>
  <description>Mock gRPC services with WireMock</description>
  <name>WireMock Extension for gRPC</name>
  <url>https://wiremock.org</url>
  <scm>
    <connection>https://github.com/wiremock/wiremock-grpc-extension.git</connection>
    <developerConnection>https://github.com/wiremock/wiremock-grpc-extension.git</developerConnection>
    <url>https://github.com/wiremock/wiremock-grpc-extension</url>
  </scm>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/license/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <developers>
    <developer>
      <id>tomakehurst</id>
      <name>Tom Akehurst</name>
    </developer>
  </developers>
</project>
instead, it should have
Copy code
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-bom</artifactId>
      <version>1.58.0</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>
I was able to work around this by doing this
Copy code
<dependency>
		  <groupId>org.wiremock</groupId>
		  <artifactId>wiremock-grpc-extension</artifactId>
		  <version>${wiremock-grpc.version}</version>
		  <scope>test</scope>
		  <exclusions>
			  <exclusion>
				  <groupId>io.grpc</groupId>
				  <artifactId>grpc-bom</artifactId>
			  </exclusion>
		  </exclusions>
	  </dependency>
i’ve excluded the grpc-bom, since its brought in already by other dependencies in my project
t
I guess we need to add some additional parameter/modifier to the gradle dependency to fix this at source, although I’m not sure what that is at the moment.
e
It’s because in the
build.gradle
file, the
grpc-bom
dependency is declared as
api "io.grpc:grpc-bom:$versions.grpc"
You could change the dependencies block to be this:
Copy code
api "org.wiremock:wiremock:$versions.wiremock"

  api platform("io.grpc:grpc-bom:$versions.grpc")
  api "io.grpc:grpc-protobuf"
  api "io.grpc:grpc-stub"

  implementation "io.grpc:grpc-servlet-jakarta"
  implementation "com.google.protobuf:protobuf-java-util:$versions.protobuf"

  implementation 'javax.annotation:javax.annotation-api:1.3.2'

  //  testImplementation project(":")
  testImplementation(platform('org.junit:junit-bom:5.10.0'))
  testImplementation "org.junit.jupiter:junit-jupiter"
  testImplementation "org.hamcrest:hamcrest-core:2.2"
  testImplementation "org.hamcrest:hamcrest-library:2.2"
  testImplementation 'org.awaitility:awaitility:4.2.0'

  testImplementation "io.grpc:grpc-okhttp"
And this would produce
Copy code
?xml version="1.0" encoding="UTF-8"?
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!-- This module was also published with a richer model, Gradle metadata,  -->
  <!-- which should be used instead. Do not delete the following line which  -->
  <!-- is to indicate to Gradle or any Gradle module metadata file consumer  -->
  <!-- that they should prefer consuming it instead. -->
  <!-- do_not_remove: published-with-gradle-metadata -->
  modelVersion4.0.0/modelVersion
  groupIdorg.wiremock/groupId
  artifactIdwiremock-grpc-extension/artifactId
  version0.1.0/version
  dependencyManagement
    dependencies
      dependency
        groupIdio.grpc/groupId
        artifactIdgrpc-bom/artifactId
        version1.58.0/version
        typepom/type
        scopeimport/scope
      /dependency
    /dependencies
  /dependencyManagement
  dependencies
    dependency
      groupIdorg.wiremock/groupId
      artifactIdwiremock/artifactId
      version3.2.0/version
      scopecompile/scope
    /dependency
    dependency
      groupIdio.grpc/groupId
      artifactIdgrpc-protobuf/artifactId
      scopecompile/scope
    /dependency
    dependency
      groupIdio.grpc/groupId
      artifactIdgrpc-stub/artifactId
      scopecompile/scope
    /dependency
    dependency
      groupIdio.grpc/groupId
      artifactIdgrpc-servlet-jakarta/artifactId
      scoperuntime/scope
    /dependency
    dependency
      groupIdcom.google.protobuf/groupId
      artifactIdprotobuf-java-util/artifactId
      version3.24.0/version
      scoperuntime/scope
    /dependency
    dependency
      groupIdjavax.annotation/groupId
      artifactIdjavax.annotation-api/artifactId
      version1.3.2/version
      scoperuntime/scope
    /dependency
  /dependencies
  descriptionMock gRPC services with WireMock/description
  nameWireMock Extension for gRPC/name
  urlhttps://wiremock.org/url
  scm
    connectionhttps://github.com/wiremock/wiremock-grpc-extension.git/connection
    developerConnectionhttps://github.com/wiremock/wiremock-grpc-extension.git/developerConnection
    urlhttps://github.com/wiremock/wiremock-grpc-extension/url
  /scm
  licenses
    license
      nameThe Apache Software License, Version 2.0/name
      urlhttp://www.apache.org/license/LICENSE-2.0.txt/url
      distributionrepo/distribution
    /license
  /licenses
  developers
    developer
      idtomakehurst/id
      nameTom Akehurst/name
    /developer
  /developers
/project
I’m happy to do a pull request if you’d like
(I did run
./gradlew clean check
to make sure tests all still pass