capture maven wagon:exist output

531 views Asked by At

is there a way to capture the output of the maven wagon:exist goal?
if i configure:

    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>wagon-maven-plugin</artifactId>
      <version>1.0-beta-5</version>
      <executions>
        <execution>
          <id>check</id>
          <phase>validate</phase>
          <goals>
            <goal>exist</goal>
          </goals>
          <configuration>
            <serverId>tst.check</serverId>
            <url>https://tst.check/${url.part}</url>
          </configuration>
        </execution>
      </executions>
    </plugin>

then run the build with a existing url:

c:\dev\tst.package>mvn validate -Durl.part=valid
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building tst.package 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- wagon-maven-plugin:1.0-beta-5:exist (check) @ tst.package ---
[INFO]  exists.

and if i run the build with an invalid url:

c:\dev\tst.package>mvn validate -Durl.part=invalid
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building tst.package 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- wagon-maven-plugin:1.0-beta-5:exist (check) @ tst.package ---
[INFO]  does not exists.

i want to capture the output because i have to process different further steps if the url is valid or not. i am using the wagon plugin because the maven-antrun-plugin don't consider the configured user & password for this server in the settings.xml file.

1

There are 1 answers

0
user944849 On

The source code for the mojo does exactly what you've already shown: log a message if the resource exists or doesn't. I don't see a way to capture the output of the wagon:exist goal.