So i installed Leiningen and git on windows. But git bash does not seem to find the lein command because it is based on a .bat file. It works in the windows command line. Is there any way to get the lein command to work in git bash?
First, I added the lein.sh script into ~/bin folder. This folder should be added in the path by GitBash itself. If it's not in PATH, you can add lein.sh to any folder that is in there or simply add ~/bin to your PATH. Something like:
PATH=$PATH:~/bin
You can set the following alias on "~/.bashrc" in your home directory to it easier to call Leiningen:
alias lein='lein.bat'
It's working fine with Leiningen 2.6.1 and Git Bash 2.8.0.
If I go into git bash and type echo $PATH
I see what seems like the same thing as when I type echo %PATH%
from a dos console.
So I alter the Windows Path environment variable so it includes C:\programs\lein
, which is where lein.bat
is.
Back into git bash I type lein
and get command not found
. But if I type lein.bat
I can see it is trying to run the file, presumably as if it were a shell script:
Chris@CHRIS-XPS ~
$ lein.bat
/c/programs/lein/lein.bat: line 1: @echo: command not found
/c/programs/lein/lein.bat: line 3: setLocal: command not found
/c/programs/lein/lein.bat: line 7: syntax error near unexpected token `('
/c/programs/lein/lein.bat: line 7: `if "%LEIN_VERSION:~-9%" == "-SNAPSHOT" ('
So you will be able to get further by dropping in lein.sh
to replace lein.bat
. Good to start with your own lein.sh
that tries to only execute java -jar lein.jar -cp ...
(I made that up but it should be possible to piece the correct command together from viewing the batch file (or the shell script)). In fact if your Windows hosted lein.sh
can start any java program, it should also be able to start lein.
© 2022 - 2024 — McMap. All rights reserved.