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

./gradlew build is 'Compiling and testing with Java 21' although actions/setup-java@v4 is setting Java 17 #714

Open
2 of 5 tasks
GabeGiro opened this issue Dec 21, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@GabeGiro
Copy link

Description:
./gradlew build is 'Compiling and testing with Java 21' after actions/setup-java@v4 is setting Java 17.

I tried a lot of things:

Task version:
v3 and v4

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Repro steps:

Use this ci.yml in your Android project:

name: CI

on:
  pull_request:
    branches:
      - main
      - dev
  push:
    branches:
      - main
      - dev

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: Set up JDK 17
        uses: actions/setup-java@v4
        with:
          distribution: 'zulu'
          java-version: '17'

#      - name: Cache Gradle packages
#        uses: actions/cache@v4
#        with:
#          path: |
#            ~/.gradle/caches
#            ~/.gradle/wrapper/
#          key: ${{ runner.os }}-gradle-v1-${{ hashFiles('**/build.gradle', '**/build.gradle.kts', '**/settings.gradle', '**/settings.gradle.kts', '**/gradle.lockfile') }}
#          restore-keys: |
#            ${{ runner.os }}-gradle-v1-

      - name: Grant execute permission for Gradle Wrapper
        run: chmod +x ./gradlew

      - name: Build with Gradle
        run: ./gradlew build

      - name: Run Unit Tests
        run: ./gradlew test

      - name: Notify Success
        if: success()
        run: echo "Build and tests passed!"

      - name: Notify Failure
        if: failure()
        run: echo "Build or tests failed!"

Note: I commented out the cache for the purpose of making sure that I'm not reusing gradle files

Expected behavior:
Build with Gradle step should show:
Compiling and testing with Java 17

Actual behavior:
Build with Gradle step shows:
Compiling and testing with Java 21

@GabeGiro GabeGiro added bug Something isn't working needs triage labels Dec 21, 2024
@mahalakshmi-rekadi
Copy link

Hello @GabeGiro,
Thank you for reporting this issue. We will investigate it and get back to you as soon as we have some feedback.

@gowridurgad gowridurgad self-assigned this Dec 23, 2024
@gowridurgad
Copy link

Hi @GabeGiro, After replicating the issue using the provided workflow, we found that everything is working as expected. The Build with Gradle step is correctly compiling and testing with Java 17. For your reference, we’ve included link of the successful run. To assist us in further investigating, could you please share a link to the build or a public repository where the issue can be reproduced?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants