tag:help.appveyor.com,2012-11-13:/discussions/questions/817-multi-line-powershell-scriptsAppVeyor: Discussion 2018-08-25T01:52:59Ztag:help.appveyor.com,2012-11-13:Comment/356166982014-12-23T16:27:25Z2014-12-23T16:27:25Zmulti-line PowerShell scripts<div><p>How does you PS script look right now?</p>
<p>-Feodor</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/356166982014-12-23T16:47:46Z2014-12-23T16:47:46Zmulti-line PowerShell scripts<div><p>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.<br>
Here is what i'm trying to do:</p>
<p>install:<br>
- 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</p>
<h1><a name=
"note-env-variables-are-not-correctly-updated-by-choco-setting-it-manually-"
href=
"#note-env-variables-are-not-correctly-updated-by-choco-setting-it-manually-"
class="anchor" id=
"note-env-variables-are-not-correctly-updated-by-choco-setting-it-manually-">
</a>Note: env variables are not correctly updated by choco (setting
it manually)</h1>
<ul>
<li>cmd: SET PATH=C:\bin\apache-maven-3.2.3\bin;%PATH%</li>
<li>cmd: mvn --version build_script:<br></li>
<li>mvn package test_script:<br></li>
<li>mvn test cache:<br></li>
<li>C:\bin\apache-maven-3.2.3\</li>
</ul></div>Abel Salgado Romerotag:help.appveyor.com,2012-11-13:Comment/356166982014-12-23T16:57:52Z2014-12-23T16:57:52Zmulti-line PowerShell scripts<div><p>I see. Try this:</p>
<pre>
<code>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;=%
...</code>
</pre></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/356166982014-12-23T18:26:27Z2014-12-23T18:26:30Zmulti-line PowerShell scripts<div><p>It works now, thanks :)<br>
Dunno why I had to add a line brake after the $MVNDIR line, but
it's working nicely now.<br>
Here is the file in case some else needs it<br>
<a href=
"https://github.com/abelsromero/asciidoctor-maven-plugin/blob/master/appveyor.yml">
https://github.com/abelsromero/asciidoctor-maven-plugin/blob/master...</a></p></div>Abel Salgado Romerotag:help.appveyor.com,2012-11-13:Comment/356166982014-12-23T18:28:19Z2014-12-23T18:28:19Zmulti-line PowerShell scripts<div><p>Great, thanks for the update!</p></div>Feodor Fitsner