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

Expose actions/setup-java cache parameter #30

Closed
scordio opened this issue Jun 14, 2022 · 4 comments
Closed

Expose actions/setup-java cache parameter #30

scordio opened this issue Jun 14, 2022 · 4 comments

Comments

@scordio
Copy link
Contributor

scordio commented Jun 14, 2022

I would like to use this action as a replacement for some actions/setup-java usages we have but then we would lack the cache settings we have today.

Would it be possible to expose the cache parameter for the underlying actions/setup-java?

The workaround would be to have an explicit actions/cache configuration, but using only oracle-actions/setup-java would be more elegant.

@sormuras
Copy link
Member

Hej Stefano,

there's a better way that enables you to make use of all inputs supported by the underlying actions/setup-java action:

By default, the oracle-actions/setup-java action delegates the actual installation to actions/setup-java using its default input value. In order to use customized inputs for actions/setup-java step in your workflow run, you may suppress the automatic delegation (install: false) and call the installation action with your custom input values.

Copied from: https://github.com/oracle-actions/setup-java/wiki/Customize-setup-java-inputs where a usage example is given.

@scordio
Copy link
Contributor Author

scordio commented Jun 14, 2022

Hi Christian, thanks for the fast feedback!

Right, something like:

steps:
  - name: 'Download Java Development Kit'
    id: download
    uses: oracle-actions/setup-java@v1
    with:
      website: ...
      release: ...
      version: ...
      install: false # Suppress automatic delegation to `actions/setup-java`
  - name: 'Install Java Development Kit'
    uses: actions/setup-java@v2
    with:
      distribution: jdkfile
      jdkFile: ${{ steps.download.outputs.archive }}
      java-version: ${{ steps.download.outputs.version }}
      cache: 'maven'
  - name: ...

or the alternative I had in mind (with the Maven example config from actions/cache):

steps:
  - name: 'Set up Java Development Kit'
    uses: oracle-actions/setup-java@v1
    with:
      website: ...
      release: ...
      version: ...
  - name: 'Cache local Maven repository'
    uses: actions/cache@v3
    with:
      path: ~/.m2/repository
      key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
      restore-keys: |
        ${{ runner.os }}-maven-
  - name: ...

but I was actually looking for something like:

steps:
  - name: 'Set up Java Development Kit'
    uses: oracle-actions/setup-java@v1
    with:
      website: ...
      release: ...
      version: ...
      cache: 'maven'
  - name: ...

which would be closer to the current one:

steps:
  - name: 'Set up Java Development Kit'
    uses: actions/setup-java@v3
    with:
      distribution: 'zulu'
      java-version: ...
      cache: 'maven'
  - name: ...

Mostly a cosmetic request rather than a functional one 🙂

A concrete use case is the cross-version workflow in AssertJ.

@sormuras
Copy link
Member

sormuras commented Aug 5, 2022

IMHO, setting up Java and build tool(s) in a single action like actions/setup-java does is not good design in the first place. There should be dedicated actions that install and configure build tools, including preferences, caching and other settings for each tool.

We also want the configuration surface of this action as minimal as possible: mainly to keep maintenance cost manageable but also to react more flexible to future changes of the underlying actions/setup-java feature set.

In the light of that, I'll close this feature request as not planned.

@sormuras sormuras closed this as not planned Won't fix, can't repro, duplicate, stale Aug 5, 2022
@scordio
Copy link
Contributor Author

scordio commented Aug 5, 2022

Feedback very much appreciated 🙂 thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants