Replace compile with api

Trying to prepare for gradle 7.0, I have tried to replace my “compile” dependencies with “api” dependencies. When I do this, however, I get
Could not find method api() for arguments ...

Has anybody any idea what can go wrong here?

The statements are:

compile project('')
compile 'org.jdrupes.httpcodec:httpcodec:[2.0.3,3)'
  • Michael

Use implementation instead of api. If you need the latter (i.e. for exposing some dependencies as part of your public facing API), you need to apply the Java Library plugin.