Search code examples
mavenspring-bootgradlecumulocity

Gradle not recognizing Cumulocity Microservice SDK package


I managed to deploy a standalone microservice instance into Cumulocity platform according to documentation. After deploying microservice to the platform, I am able to subscribe and make REST calls to the service, so everything works as expected. Cumulocity Microservice SDK is based on Maven, therefore I have correct pom.xml specified.

The problem that I encounter is that I also have Gradle enabled in the project and CI setup based on Gradle in Gitlab and although everything works as should in Maven, the Microservice SDK package is not recognized by Gradle and I can't find a way to make it work. For example specific Microservice annotations that come up with the SDK are not recognized:

error: cannot find symbol @MicroserviceApplication

My current Maven specification includes:

<plugin>
      <groupId>com.nsn.cumulocity.clients-java</groupId>
      <artifactId>microservice-package-maven-plugin</artifactId>
      <version>${c8y.version}</version>
      <configuration>
          ...
      </configuration>
      <executions>
          <execution>
              ...
          </execution>
      </executions>
  </plugin>

My current Gradle specification includes:

dependencies {
    compile 'com.nsn.cumulocity.clients-java:java-client:8.13.0'
}

I could rewrite CI specification to use only Maven but I was wondering, is there any way to make Gradle recognize Cumulocity Microservice SDK plugin from Maven?


Solution

  • java-clients is not what you need. Try 'com.nsn.cumulocity.clients-java:microservice-autoconfigure:8.13.0'. That's where the @MicroserviceApplication annotation should be.