Newest gradle is run despite using wrapper

My gradle.yaml:

# This workflow will build a Java project with Gradle
# For more information see:

name: Java CI with Gradle

    branches: [ xxx ]
    branches: [ xxx ]


    runs-on: ubuntu-latest

    - uses: actions/checkout@v2
    - uses: gradle/wrapper-validation-action@v1
    - name: Set up JDK 1.8
      uses: actions/setup-java@v1
        java-version: 1.8
    - name: Build with Gradle
      run: gradle wrapper --gradle-version=4.6 --distribution-type=all

yet build fails due to gradle scripts incompability with newest gradle:

Run gradle wrapper --gradle-version=4.6 --distribution-type=all

Welcome to Gradle 6.5.1!

Here are the highlights of this release:
 - Experimental file-system watching
 - Improved version ordering
 - New samples

For more details see

Starting a Gradle Daemon (subsequent builds will be faster)
Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.
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.
* Where:
Build file '/home/runner/work/xxx/xxx/xxx/build.gradle' line: 18

* What went wrong:
A problem occurred evaluating project ':desktop'.
> Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.

I am new to whole gradle thing, so perhaps I am doing something wrong?

Hi @jacek-bulatek,

Glad to see you in Github Forum ticket!

When you perform the wrapper task using gradlew, it will still execute with current version (Gradle 6.5.1 ). The arguments only change the values that are written to . The gradle-wrapper.jar file is still the one copied from the 6.5.1 distribution. The next build run using gradlew will download the new version distribution and use the new version(version 4.6).

I copied your code and confirmed it on my workflow:


Please refer to this link here for more details.

Your error should be due to the deprecated classesDir property, please use getClassesDirs() instead.

Please refer to below link for more details:


Creating and using gradlew helped.