Chocolatey install maven doesn't set the PATH it seems

alexlehm's Avatar

alexlehm

23 Jun, 2016 11:09 PM

I am using maven which is installed by chocolatey, which works if I set the PATH variable in the project environment, but it isn't in the PATH by default.
However the choco install log says at the end:

PATH environment variable does not have C:\tools\apache-maven-3.3.3\bin in it. Adding...

So I think it is added but probably the current script does not pick up the change, is there a possibility to pick up the new PATH?

  1. Support Staff 1 Posted by Feodor Fitsner on 24 Jun, 2016 02:31 AM

    Feodor Fitsner's Avatar

    The problem is that child process (choco) cannot affect environment variables of parent process (AppVeyor build agent) in a such way, so you have to set PATH outside in your "main" build script.

  2. 2 Posted by alexlehm on 24 Jun, 2016 09:53 PM

    alexlehm's Avatar

    Thanks, I set the path in the Environment, so it works now

  3. 3 Posted by alexlehm on 25 Jun, 2016 09:58 AM

    alexlehm's Avatar

    I poked around a bit in the files from chocolatey and it looks like the RefreshEnv script can reload the envs set by chocolatey, so that when running

    choco upgrade maven
    C:\ProgramData\chocolatey\bin\RefreshEnv
    

    in the install script, the mvn command is found (I assume this will work for any chocolatey package with Appveyor)

    The advantage with this approach is that you do not put an assumption about the maven version into the build script so it will work when the package is updated

  4. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:06 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac