3.5.1 Service generator error when generating a data-service

Hello,

I am having an issue generating a data service using the 3.5.1 service generators. Using all default values, I am getting this

$ yo @leaf-platform/data-service
? Enter the top level project name - MUST use kebab case (e.g. my-test-service): test-service
? Enter the domain prefix for java packages: com.leidos.leaf.data
? Enter a yes/no value to determine whether this service's data store is selectable: Yes
? Enter the default selector option for the data store type that backs this service: mongo    
? Enter a yes/no value to determine whether this service's event manager is selectable: Yes
? Enter the default selector option for the event manager type used for this service: kafka
? Enter the Mongo hostname: mongodb.mongodb:27017
? Enter the Mongo production hostname: mongodb.mongodb:27017
? Enter the Mongo database password: l3afpl4tf0rm
? Enter the method for building the service's image: Jib        
? Enter the system used to support OpenTracing: None    
? Enter the cluster ingress to be used: Istio
? Enter a yes/no value to determine whether this service will use a delegate virtual service: No
? Enter an image repository URI from which to build a production profile (e.g. ECR URI where the image will be stored): <REPLACE_WITH_IMAGE_REPOSITORY_URI>
? Enter a yes/no value to determine whether the service has a dev container env included: No
? Enter a boolean value to determine whether this app uses a government-approved Docker image: Yes
? Enter the URI of the government approved image to be used: docker-group.leidos-leaf.com/ironbank/redhat/openjdk/openjdk11:1.11
? Enter a yes/no value to determine whether this service is discoverable by the LEAF Service Registry: Yes
Creating service at C:\Users\bostwickj\development\tmp/test-service
   create src\main\java\com\leidos\leaf\data\TestServiceApplication.java
   create src\test\java\com\leidos\leaf\data\TestServiceApplicationTest.java
   create src\main\java\com\leidos\leaf\data\DataServiceDecorator.java
   create src\main\java\com\leidos\leaf\data\DataServiceSelector.java
   create src\test\java\com\leidos\leaf\data\DataServiceSelectorTest.java
   create src\main\resources\test_service\lookuplists\TestServiceApplicationLookupList.json
   create src\main\resources\test_service\metadatatemplates\TestServiceApplicationMetadataTemplate.json
   create src\main\resources\test_service\beanmetadata\ExampleBean.json
   create src\main\resources\META-INF\services\javax.el.ExpressionFactory
   create src\main\resources\log4j2.xml
   create settings.gradle
   create build.gradle
   create .gitignore
   create skaffold.yaml
   create README.md
   create values\values.yaml
   create values\values-debug.yaml
   create values\values-prod.yaml
   create src\main\java\com\leidos\leaf\data\rest\WebServer.java
   create src\main\java\com\leidos\leaf\data\rest\LeafOpenApiScanner.java
   create src\main\java\com\leidos\leaf\data\rest\RestApplication.java
   create src\main\resources\openapi-configuration.yaml
   create src\main\java\com\leidos\leaf\data\rest\ResteasyWadlResourceImpl.java
   create src\main\java\com\leidos\leaf\data\config\IRestConfig.java
   create src\main\java\com\leidos\leaf\data\config\IServiceConfig.java
   create src\main\java\com\leidos\leaf\data\config\ITrustStoreConfig.java
   create src\main\java\com\leidos\leaf\data\EventServiceSelector.java
   create src\test\java\com\leidos\leaf\data\EventServiceSelectorTest.java
   create config.txt

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\bostwickj\development\tmp\test-service\build.gradle' line: 76

* What went wrong:
A problem occurred evaluating root project 'test-service'.
> Could not find method runtime() for arguments [org.jboss.resteasy:resteasy-jackson2-provider:4.6.1.Final] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: Command failed: gradle wrapper --gradle-version 6.9

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\bostwickj\development\tmp\test-service\build.gradle' line: 76

* What went wrong:
A problem occurred evaluating root project 'test-service'.
> Could not find method runtime() for arguments [org.jboss.resteasy:resteasy-jackson2-provider:4.6.1.Final] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

    at checkExecSyncError (node:child_process:828:11)
    at execSync (node:child_process:899:15)
    at module.exports.install (C:\Users\bostwickj\AppData\Local\Yarn\Data\global\node_modules\@leaf-platform\base-generator\generators\base\index.js:233:13)
    at Object.<anonymous> (C:\Users\bostwickj\AppData\Local\Yarn\Data\global\node_modules\yeoman-generator\lib\index.js:991:25)
    at C:\Users\bostwickj\AppData\Local\Yarn\Data\global\node_modules\run-async\index.js:49:25
    at new Promise (<anonymous>)
    at C:\Users\bostwickj\AppData\Local\Yarn\Data\global\node_modules\run-async\index.js:26:19
    at runLoop.add.once.once (C:\Users\bostwickj\AppData\Local\Yarn\Data\global\node_modules\yeoman-generator\lib\index.js:992:11)
    at Immediate.<anonymous> (C:\Users\bostwickj\AppData\Roaming\npm\node_modules\yo\node_modules\grouped-queue\lib\subqueue.js:48:34)
Emitted 'error' event on  instance at:
    at Immediate.<anonymous> (C:\Users\bostwickj\AppData\Local\Yarn\Data\global\node_modules\yeoman-generator\lib\index.js:1022:20)
    at processImmediate (node:internal/timers:466:21) {
  status: 1,
  signal: null,
  output: [
    null,
    Buffer(330) [Uint8Array] [
       10,  68, 101, 112, 114, 101,  99,  97, 116, 101, 100,  32,
       71, 114,  97, 100, 108, 101,  32, 102, 101,  97, 116, 117,
      114, 101, 115,  32, 119, 101, 114, 101,  32, 117, 115, 101,
      100,  32, 105, 110,  32, 116, 104, 105, 115,  32,  98, 117,
      105, 108, 100,  44,  32, 109,  97, 107, 105, 110, 103,  32,
      105, 116,  32, 105, 110,  99, 111, 109, 112,  97, 116, 105,
       98, 108, 101,  32, 119, 105, 116, 104,  32,  71, 114,  97,
      100, 108, 101,  32,  56,  46,  48,  46,  10,  10,  89, 111,
      117,  32,  99,  97,
      ... 230 more items
    ],
    Buffer(662) [Uint8Array] [
       13,  10,  70,  65,  73,  76,  85,  82,  69,  58,  32,  66,
      117, 105, 108, 100,  32, 102,  97, 105, 108, 101, 100,  32,
      119, 105, 116, 104,  32,  97, 110,  32, 101, 120,  99, 101,
      112, 116, 105, 111, 110,  46,  13,  10,  13,  10,  42,  32,
       87, 104, 101, 114, 101,  58,  13,  10,  66, 117, 105, 108,
      100,  32, 102, 105, 108, 101,  32,  39,  67,  58,  92,  85,
      115, 101, 114, 115,  92,  98, 111, 115, 116, 119, 105,  99,
      107, 106,  92, 100, 101, 118, 101, 108, 111, 112, 109, 101,
      110, 116,  92, 116,
      ... 562 more items
    ]
  ],
  pid: 15232,
  stdout: Buffer(330) [Uint8Array] [
     10,  68, 101, 112, 114, 101,  99,  97, 116, 101, 100,  32,
     71, 114,  97, 100, 108, 101,  32, 102, 101,  97, 116, 117,
    114, 101, 115,  32, 119, 101, 114, 101,  32, 117, 115, 101,
    100,  32, 105, 110,  32, 116, 104, 105, 115,  32,  98, 117,
    105, 108, 100,  44,  32, 109,  97, 107, 105, 110, 103,  32,
    105, 116,  32, 105, 110,  99, 111, 109, 112,  97, 116, 105,
     98, 108, 101,  32, 119, 105, 116, 104,  32,  71, 114,  97,
    100, 108, 101,  32,  56,  46,  48,  46,  10,  10,  89, 111,
    117,  32,  99,  97,
    ... 230 more items
  ],
  stderr: Buffer(662) [Uint8Array] [
     13,  10,  70,  65,  73,  76,  85,  82,  69,  58,  32,  66,
    117, 105, 108, 100,  32, 102,  97, 105, 108, 101, 100,  32,
    119, 105, 116, 104,  32,  97, 110,  32, 101, 120,  99, 101,
    112, 116, 105, 111, 110,  46,  13,  10,  13,  10,  42,  32,
     87, 104, 101, 114, 101,  58,  13,  10,  66, 117, 105, 108,
    100,  32, 102, 105, 108, 101,  32,  39,  67,  58,  92,  85,
    115, 101, 114, 115,  92,  98, 111, 115, 116, 119, 105,  99,
    107, 106,  92, 100, 101, 118, 101, 108, 111, 112, 109, 101,
    110, 116,  92, 116,
    ... 562 more items
  ]
}

I have tried removing the generators and re-adding them

$ yarn global remove @leaf-platform/service-generators
yarn global v1.22.18
[1/2] Removing module @leaf-platform/service-generators...
[2/2] Regenerating lockfile and installing missing dependencies...
success Uninstalled packages.
Done in 3.90s.

Although, this warning seems concerning to me when adding them back

$ yarn global add @leaf-platform/service-generators@3.5.1
yarn global v1.22.18
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
warning "@leaf-platform/service-generators@3.5.1" has no binaries
Done in 2.73s.

Any advice? I am on Windows

Hey Jacob,
I would experience this issue on my PC where I would get Error: Command failed: gradle wrapper --gradle-version 6.9 when generating any service. I would then just cd into the newly generated service and run that same command
gradle wrapper --gradle-version 6.9 and it would subsequently generate the gradle folder and all needed files.

1 Like

Ok, so I gave that a try

$ cd test-service/

bostwickj@6TH9CF3 MINGW64 ~/development/tmp/test-service
$ gradle wrapper --gradle-version 6.9


←[2A←[1m<←[0;1m-------------> 0% CONFIGURING [60ms]←[m←[37D←[1B←[1m> root project←[m←[14D←[1B←[2A←[1m<←[0;1m-------------> 0% CONFIGURING [152ms]←[m←[38D←[1B←[1m> root project > Resolve dependencies of :classpath←[m←[51D←[1B←[2A←[1m<←[0;1m-------------> 0% CONFIGURING [246ms]←[m←[38D←[1B←[1m> root project > Resolve files of :classpath←[m←[0K←[44D←[1B←[2A←[0K
←[31mFAILURE: ←[39m←[31mBuild failed with an exception.←[39m←[0K

* Where:
Build file 'C:\Users\bostwickj\development\tmp\test-service\build.gradle' line: 76

* What went wrong:
A problem occurred evaluating root project 'test-service'.
←[33m> ←[39mCould not find method runtime() for arguments [org.jboss.resteasy:resteasy-jackson2-provider:4.6.1.Final] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
←[33m> ←[39mRun with ←[1m--stacktrace←[m option to get the stack trace.
←[33m> ←[39mRun with ←[1m--info←[m or ←[1m--debug←[m option to get more log output.
←[33m> ←[39mRun with ←[1m--scan←[m to get full insights.

* Get more help at ←[1mhttps://help.gradle.org←[m

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5/userguide/command_line_interface.html#sec:command_line_warnings

←[31;1mBUILD FAILED←[0;39m in 1s

But to no avail. It is referring to this dependency in my build.gradle

runtime "org.jboss.resteasy:resteasy-jackson2-provider:${versions.restEasy}"

Hey, Jacob.

As of Gradle 7.0 , the runtime() method was removed. To resolve this, go to the build.gradle file of the generated service and change any calls to runtime() in the dependency block to runtimeOnly(). After that, try the gradle wrapper command again.

dependencies {
    ...

    // replace this
    runtime "org.jboss.resteasy:resteasy-jackson2-provider:${versions.restEasy}"

    // with this
    runtimeOnly "org.jboss.resteasy:resteasy-jackson2-provider:${versions.restEasy}"

    ...
}

Alternatively (and likely less advisable), install an older version of Gradle where runtime() was still supported.

I hope this is helpful.

2 Likes

Thanks @hayden.curtis, that was it.

1 Like