有没有办法捕获 maven wagon:exist 目标的输出?
如果我配置:
<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>
然后使用现有 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.
如果我使用无效的 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.
我想捕获输出,因为如果 url 有效与否,我必须处理不同的进一步步骤。我正在使用 wagon 插件,因为 maven-antrun-plugin 不考虑在 settings.xml 文件中为此服务器配置的用户和密码。