Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQ] Java client: Upgrade to gradle 7.2, remove deprecated 'maven' plugin #10517

Closed
sebastien-rosset opened this issue Oct 3, 2021 · 0 comments · Fixed by #10538
Closed

Comments

@sebastien-rosset
Copy link
Contributor

sebastien-rosset commented Oct 3, 2021

Is your feature request related to a problem? Please describe.

The gradle templates for the Java client are using gradle 6.7.1 which was released on Nov 16, 2020. The generated build.gradle uses the maven plugin which has been deprecated.
Can we change to the maven-publish plugin and upgrade to gradle 7.2?

The following templates would be impacted:

  1. https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/gradle-wrapper.jar
  2. https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache#L87
  3. https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/gradle.properties.mustache

Here is the output of gradle:

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings

# ./gradlew --warning-mode all
> Configure project :
The maven plugin has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the maven-publish plugin instead. Consult the upgrading guide for further information: https://docs.gradle.org/6.7.1/userguide/upgrading_version_5.html#legacy_publication_system_is_deprecated_and_replaced_with_the_publish_plugins
        at build_aqveneaidw399nnycjnuu168c.run(/home/serosset/goroot/src/bitbucket-eng-sjc1.cisco.com/an/ui-an-apidocs/.build/sdk/intersight_java/build.gradle:80)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)


Describe the solution you'd like

  1. Use maven-publish plugin instead of maven. It has been deprecated and was removed in gradle 7.0.
    1. deprecated maven plugin: http://sorcersoft.org/project/site/gradle/userguide/maven_plugin.html
    2. maven-publish plugin: https://docs.gradle.org/current/userguide/publishing_maven.html
    3. See https://docs.gradle.org/current/userguide/upgrading_version_5.html for maven plugin deprecation notice.
  2. Upgrade gradle to 7.2.
    1. In gradle 7.2, verification is enabled by default: https://docs.gradle.org/current/userguide/dependency_verification.html
  3. Generated gradlew file should have permission +x (currently it is 644).
  4. Remove jcenter() method. It has been deprecated and will be removed in gradle 8.0.
  5. Use the mainClass property instead of JavaExec.main property. It has been deprecated and will be removed in gradle 8.0.

Describe alternatives you've considered

The purpose of the gradlew wrapper is to help provide repeatable builds. To make it work, all generated gradlew scripts should have permission 755.
If the build environment has gradle version >= 7.x, the OpenAPI Java jersey2 build fails because it uses deprecated maven plugin.

The gradlew script doesn’t rely on a local Gradle installation. It goes and fetches a Gradle installation from the internet the first time it runs on your local machine, and caches it.

https://tomgregory.com/gradle-vs-gradlew-difference/

Additional context

The RepositoryHandler.jcenter() method has been deprecated. This is scheduled to be removed in Gradle 8.0. JFrog announced JCenter's sunset in February 2021. Use mavenCentral() instead. Consult the upgrading guide for further information: https://docs.gradle.org/7.2/userguide/upgrading_version_6.html#jcenter_deprecation
        at build_aqveneaidw399nnycjnuu168c$_run_closure1$_closure2.doCall(/home/serosset/goroot/src/bitbucket-eng-sjc1.cisco.com/an/ui-an-apidocs/.build/sdk/intersight_java/build.gradle:11)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
The JavaExec.main property has been deprecated. This is scheduled to be removed in Gradle 8.0. Please use the mainClass property instead. See https://docs.gradle.org/7.2/dsl/org.gradle.api.tasks.JavaExec.html#org.gradle.api.tasks.JavaExec:main for more details.
        at build_aqveneaidw399nnycjnuu168c$_run_closure7.doCall(/home/serosset/goroot/src/bitbucket-eng-sjc1.cisco.com/an/ui-an-apidocs/.build/sdk/intersight_java/build.gradle:100)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

Notes:

  1. In gradle 7.2, dependency verification is promoted to a stable feature.
@sebastien-rosset sebastien-rosset changed the title [REQ] Upgrade Java templates to gradle 7.x [REQ] Upgrade Java templates to gradle 7.x, remove 'maven' plugin Oct 3, 2021
@sebastien-rosset sebastien-rosset changed the title [REQ] Upgrade Java templates to gradle 7.x, remove 'maven' plugin [REQ] Java client: Upgrade to gradle 7.2, remove deprecated 'maven' plugin Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant