Could not find method enableFeaturePreview()

(Marios Pruski) #1


we are evaluating a Gradle 4.4 -> 4.10.2 update for our project. The build was then showing a warning about using deprecated features:

As part of making the publishing plugins stable, the 'deferred configurable' behavior of the 'publishing {}' block has been deprecated. In Gradle 5.0 the 'enableFeaturePreview('STABLE_PUBLISHING')' flag will be removed and the new behavior will become the default. Please add 'enableFeaturePreview('STABLE_PUBLISHING')' to your settings file and do a test run by publishing to a local repository. If all artifacts are published as expected, there is nothing else to do. If the published artifacts change unexpectedly, please see the migration guide for more details:
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

We have then modified our top-level settings.gradle to enable this feature:

include 'documentation'
include 'service-a'
include 'mobile-app'
include 'service-b'

but any subsequent build is aborted with the following exception:
FAILURE: Build failed with an exception.

* Where:
Settings file '/home/user/myProject/settings.gradle' line: 1

* What went wrong:
A problem occurred evaluating settings 'myProject'.
> Could not find method enableFeaturePreview() for arguments [STABLE_PUBLISHING] on settings 'myProject' of type org.gradle.initialization.DefaultSettings.

How can we solve this?

(Marios Pruski) #2

We have found an explanation for this issue. It appears that the technology we are using (NativeScript) is using an older version of a gradle wrapper (4.4) which then unfortunately uses the settings.gradle that was not meant for him (and with which he isn’t compatible).