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

[Feature request] settings.xml #11

Closed
sblantipodi opened this issue Oct 12, 2020 · 1 comment
Closed

[Feature request] settings.xml #11

sblantipodi opened this issue Oct 12, 2020 · 1 comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects

Comments

@sblantipodi
Copy link
Contributor

Hi all,
this is a feature request, is it possible to implement the creation of the settings.xml for maven as in the
setup-java action described here:
https://docs.github.com/en/free-pro-team@latest/actions/guides/publishing-java-packages-with-maven

using the AdoptOpenJDK/install-jdk@v1 action

      - name: Set up AdoptOpenJDK 15
        uses: AdoptOpenJDK/install-jdk@v1
        with:
          version: '15'
          architecture: x64

Thanks for your support and for your great project.

@TheMrMilchmann
Copy link
Collaborator

Short answer

I'm sorry to disappoint this time around, but I consider build-tool specific features out of scope for this action. Consequently, I'm against adding such a feature. (Stick around for the long answer or jump to the end of this post for a solution.)

Long answer

"Why did you choose not to add feature X from setup-java?" is a question I have been asked multiple times. However, since I don't recall answering it publicly yet, I will try to do my best to outline my decision process here: Back when I originally forked setup-java it was mainly for two reasons: I wanted to use Hotspot-based JDK builds for testing, and, more importantly, I needed multiple JDKs for a single build step. Frankly, I was disappointed to see build-tool specific functionality added before support for multiple JDKs was even being worked on. (Unfortunately, actions/setup-java#44 still seems to be inactive.) I understand that this was done to make it as easy as possible to setup CI for Java projects using a single action but, in my opinion, this was a step in the wrong direction as I believe that actions should follow the single-responsibility principle as close as possible. Consider the following scenario from setup-java:
If you add support for a Maven specific feature, should you also consider adding support for Gradle specific features? Probably yes. But it doesn't stop there. The JVM supports more languages than just Java and some come with their own package management facilities and build tools. Now you could argue that the action is called setup-java and thus should only support build tools commonly used for Java. But does this mean that I shouldn't be using the action when working with e.g. Groovy, Scala, or Kotlin?

Notice, how it becomes increasingly difficult to describe the purpose and scope of such an action. Similarly, because of how actions are configured, more and more parameters that are irrelevant for a large chunk of users would have to be added. I strongly believe that the right decision would have been to provide a setup-jdk, and separate setup-{maven|gradle|your_build_tool_goes_here} actions. This has ultimately led me to deliberately narrow the scope for this fork to only focus on setting up the JDK(s). (Hence, the name "install-jdk".) All parameters have a clear meaning and are strictly related to how the JDK is set up.

The solution

For now, I can't recommend any specific tools (since I haven't used Maven to publish aynthing from Actions) but https://github.com/s4u/maven-settings-action looks promising.

The future

Going forward, the upcoming version 2.0.0 of setup-java will probably provide a way to select the JDK vendor and support AdoptOpenJDK binaries. Once this is released, the only niche install-jdk will cater too, is builds that need multiple JDKs at the same time and setup-java and install-jdk are not mutually exclusive. I'll have to think about this and test it but it is likely that in the future the recommendation will be to use setup-java to install your primary JDK (to JAVA_HOME) and for additional setup, and to use install-jdk to install additional any JDKs.

Such a setup could look like this:

- uses: actions/setup-java@v2
  with:
    java-version: 8
    java-distro: adoptopenjdk
- uses: AdoptOpenJDK/install-jdk@v1
  with:
    version: '9'
    targets: 'JDK_9'

(I'll keep this issue open for further discussion for a while in case anyone is interested.)

@TheMrMilchmann TheMrMilchmann added enhancement New feature or request wontfix This will not be worked on labels Oct 13, 2020
@karianna karianna added this to To do in install-jdk via automation Jan 7, 2021
@karianna karianna moved this from To do to Done in install-jdk Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
No open projects
install-jdk
  
Done
Development

No branches or pull requests

2 participants