Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 19854

Upgrading build.gradle to the Gradle 7.0+ format

$
0
0

Hello,
I am running Gradle 6.0.1 for a Java 8 project. I want to upgrade it to the Gradle 7.0+ format to get rid of the deprecation notifications. The format I use for dependency declaration is the one provided by the mvnrepository site, namely:

compile group: ‘com.google.guava’, name: ‘guava’, version: ‘28.1-jre’

I also have the following for some local .jar files:

compile fileTree(dir: ‘lib’, include: ‘*.jar’)

All guides on upgrading said I should simply replace compile with implementation (or api) and it will just work. But it’s not as simple.

With implementation the MVN dependencies aren’t transitive, so projects that depend on the project with the above configuration don’t get them. With api instead, I get:

Could not find method api() for arguments [{group=com.google.guava, name=guava, version=28.1-jre}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

And none of them work for the fileTree command.

What’s the proper way to do this in both cases? Thanks!


Viewing all articles
Browse latest Browse all 19854

Trending Articles