multi-line PowerShell scripts
Hi,
I'm struggling to make a simple PS script to install some package under some conditions but i'm not able to get the syntax right for a multi-line execution. The only documentation found is here http://www.appveyor.com/docs/build-configuration, and it's of not much use :%
I've tried several things and nothing works, I always end up with a message like this one:
'XXX' is not recognized as an internal or external command.
Thanks,
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
Support Staff 1 Posted by Feodor Fitsner on Dec 23, 2014 @ 04:27 PM
How does you PS script look right now?
-Feodor
2 Posted by Abel Salgado Ro... on Dec 23, 2014 @ 04:47 PM
I'd like to install maven and cache the installation. To do that, I'd like to check if the installation folder already exiats during installation, but I cannot get the syntax right.
Here is what i'm trying to do:
install:
- ps:
- $MVNDIR = 'C:\bin\apache-maven-3.2.3\'
- if(!(Test-Path -Path $MVNDIR )){
- cinst maven
-}
- cmd: SET PATH=%JAVA_HOME%\bin;%PATH:C:\Ruby193\bin;=%
- cmd: java -version
# Note: env variables are not correctly updated by choco (setting it manually)
- cmd: SET PATH=C:\bin\apache-maven-3.2.3\bin;%PATH%
- cmd: mvn --version
build_script:
- mvn package
test_script:
- mvn test
cache:
- C:\bin\apache-maven-3.2.3\
Support Staff 3 Posted by Feodor Fitsner on Dec 23, 2014 @ 04:57 PM
I see. Try this:
4 Posted by Abel Salgado Ro... on Dec 23, 2014 @ 06:26 PM
It works now, thanks :)
Dunno why I had to add a line brake after the $MVNDIR line, but it's working nicely now.
Here is the file in case some else needs it
https://github.com/abelsromero/asciidoctor-maven-plugin/blob/master/appveyor.yml
Support Staff 5 Posted by Feodor Fitsner on Dec 23, 2014 @ 06:28 PM
Great, thanks for the update!
Ilya Finkelshteyn closed this discussion on Aug 25, 2018 @ 01:52 AM.