Thursday, October 5, 2017

Normalizing SDKMAN Across Development Computers

Why do we need this?

sdkman is a great tool for a single-source management of software development kits for multiple frameworks. Providing a consistent location for SDKs is a priority when projects are being shared across multiple development computers, either by just copying the folders or using repositories like Subversion and Git.

The location of SDK dependencies is kept in the project files defined by the development tools, like Eclipse and IntelliJ Idea. If the project is shared or checked in or out of a repository, the last person to check it in will commit their own personal settings. Then the next person to check it out has to change the settings to match their computer, and those are what get checked back in.

What are the options?

One solution I have seen used is to not save the project settings in the repository, but that is really a mistake. If that is what happens, then how does everyone involved manage changing dependencies? Manually in their own copy of the project?

If the SDKs and other dependencies are managed in the user's home directory, then IDEs like IntelliJ will use relative paths that map to the home directory of whatever user is working on the project. Sdkman is an excellent solution for this, because the program and the repositories are normally managed per user in the .sdkman folder in the user's home directory.

Normalizing SDKMAN on Microsoft Windows Computers

For Microsoft Windows the SDKMAN site will direct you to Github to install the posh-gvm PowerShell module: https://github.com/flofreud/posh-gvm.

The problem is that on Apple MacOS and Linux computers SDKMAN places the sdks in the ~/.sdkman/candidates folder. The posh-gvm module in Microsoft Windows places the SDKs in the ~/.posh_gvm folder. So, the locations are different, not consistent across the operating systems, and cause problems checking out projects!

It took longer to explain why than it will take you to fix this:

  • As an administrator execute cmd.exe on your computer.
  • Create a .sdkman folder in your home directory.
  • cd into the .sdkman folder.
  • Execute the command mklink /d candidates ..\posh_gvm

This creates the folder that the project is referencing, and points it to the folder where posh-gvm is actually installing the SDKs.

No comments:

Post a Comment