运行mvn wildfly-swarm时,是否有可能打开带有localhost:8080 / index.html标签的浏览器:运行?
我很感激你的回答!
答案 0 :(得分:1)
您可以结合使用groovy和java.awt.Desktop类(自Java 1.6开始)来打开您希望的任何URL:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>execute</goal>
</goals>
</execution>
</executions>
<configuration>
<scripts>
<script>
<![CDATA[
import java.awt.Desktop
import java.net.URI
Desktop.getDesktop().browse(new URI("http://www.example.com"))
]]>
</script>
</scripts>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<!-- any version of Groovy \>= 1.5.0 should work here -->
<version>2.4.7</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
(这是在OSX上测试过的,但是因为正在使用java Desktop类,所以应该是跨平台的)