0

I'm trying to bind an address in the PowerShell script so my testers can run wiremocks and it automatically points to the correct environment when they run it.

echo "Running WireMock"

$WiremockFileName = "wiremock-standalone-2.1.12.jar"
$Port = 8050
$Address = "my.integration.address"

if (-not(Test-Path "./$WiremockFileName")) {
    echo "Going to download wiremock";
    Invoke-WebRequest "http://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-standalone/2.1.12/$WiremockFileName" -OutFile $WiremockFileName
    echo "Finished"
}

echo "Looking for JRE"
$JAVA = ""

if ($JAVA -eq "") {
    # In case a specific version of Java is in the path already
    $JavaExe = Get-Command "java" -ErrorAction SilentlyContinue
    if ($JavaExe) {
        $JAVA = JavaExe.Definition
    }
}

if ($JAVA -eq "") {
    # This seems to work on RBI machines
    $jre7Path = "C:\Program Files (x86)\Java\jre7\bin\java.exe"
    $testJre7 = Test-Path $jre7Path -ErrorAction SilentlyContinue
    if ($testJre7) {
        $JAVA = $jre7Path
    }
}

if ($JAVA -eq "") {
    # Nope - I give up
    echo "I give up! I can't find JAVA anywhere"
    echo "Put it in your path and stop giving me a hard time or send a pull request"

    exit 1
    # echo "Press any key to continue"
    # $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
}

& $JAVA -jar $WiremockFileName --bind-address $Address --https-port $Port --verbose
exit $LASTEXITCODE

I'm trying to get this part working:

& $JAVA -jar $WiremockFileName --bind-address $Address --https-port $Port --verbose

but --bind-address $Address seems to not work.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
AngularM
  • 15,982
  • 28
  • 94
  • 169

1 Answers1

0

beside the address binding...in line 20 I'm pretty sure it should be

$JAVA = $JavaExe.Definition

instead of

$JAVA = JavaExe.Definition

Maximilian Etti
  • 230
  • 1
  • 9