我正在使用Maven 3构建一个Web应用程序,并通过qazxsw poi运行它。现在我想从系统浏览器中的maven build打开web-app。
我在os windows上解决了我的问题,这是目前我唯一的构建系统。在Jetty服务器启动并托管我的web-app之后,构建通过antrun进行启动:
mvn jetty:run-war
我编写了一个Maven插件,可以在每个平台/ JDK上打开浏览器,作为我的<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>Run URL in system browser.</id>
<phase>install</phase>
<configuration>
<target>
<exec executable="start" vmlauncher="false">
<arg line="http://localhost:8080/rap?startup=entrypoint"/>
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
工作的一部分。它可用于显示项目中的任何静态页面。以下示例打开浏览器,其中包含bck2brwsr VM文件的内容:
pom.xml
我知道打开静态页面并不完美,但它可以包含适当的重定向,对吧?此外,如果有兴趣,可以轻松改进插件以打开任何URL。 <plugin>
<groupId>org.apidesign.bck2brwsr</groupId>
<artifactId>bck2brwsr-maven-plugin</artifactId>
<version>0.22</version>
<executions>
<execution>
<id>show-a-file</id>
<phase>verify</phase>
<goals>
<goal>show</goal>
</goals>
<configuration>
<directory>${basedir}</directory>
<startpage>pom.xml</startpage>
</configuration>
</execution>
</executions>
</plugin>
欢迎。
build
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webApp>
<contextPath>/shinchan</contextPath>
</webApp>
</configuration>
</plugin>
<!-- more plugin tags if any -->
<plugins>
mvn clean install jetty:run
URL访问mvn命令。PS:
有关更多详细信息,请在此处阅读Jetty wiki:http://localhost:8080/shinchan
你可能想考虑http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin,但我认为这是一种矫枉过正。