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

Per project sdk configuration #683

Open
ctranxuan opened this issue Jan 10, 2019 · 2 comments

Comments

@ctranxuan
Copy link

commented Jan 10, 2019

Please tick one:

Please explain the Issue / Feature Request here:

Assume you have an environment managed with sdkman such as Java 11 by default, Maven 3.6.0 by default, etc.
But you have a project that requires Java 8 and Maven 3.5.3. It would be convenient if every-time you enter to the directory of the project, all your environment is setup with Java 8 and Maven 3.5.3 without having to settle it manually through multiple sdk command lines.

jenv.io has such nice feature (https://github.com/linux-china/jenv#jenvrc-support): it's addressed through a jenvrc file that contains the version of libraries we wish to customize. Then, you call a command jenv init that settles the right versions.

Proposed feature: being able to declare a sdkmanrc into a directory that would contain tools versions and a command sdk init that would set for the tools the versions declared in the file sdkmanrc

Example:
By default, we have java 11 and maven 3.6.0.
In the directory my-project, we have a sdkmanrc files that contains:

java=1.8.0_112
maven=3.5.3

Then doing:

cd my-project
sdk init

would setup the environment to java 1.8.0_112 and maven 3.5.3.

@marc0der

This comment has been minimized.

Copy link
Member

commented Jan 10, 2019

@marc0der marc0der changed the title Custom setup for a given directory (something like a sdkmanrc) Per project sdk configuration Jan 10, 2019

@marc0der

This comment has been minimized.

Copy link
Member

commented May 2, 2019

I would be keen on taking this a step further. How about we introduce a new top level env command. When you do an sdk env init, it will create an .sdkman file in the current directory with all the current versions set in that shell.

Say you opened a shell and then used sdk use to set a different version of java, this new version of java (along with any other candidate versions installed with sdkman already) will be written in this file. To recall the versions, a simple sdk env (or sdk env load) would use all of those in the current shell.

A proposal was also made by @EugenMayer that we add support for language specific descriptors like .java-version or .gradle-version etc. This should be simple to do, although the preferred method would still be to use an .sdkman file instead. I'm happy to support using both though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.