当码头服务器启动时,如何使码头打开Chrome浏览器?

时间:2019-11-07 11:36:53

标签: jetty embedded-jetty maven-jetty-plugin

我想在码头服务器启动时打开我的Chrome浏览器。为此,我在个人资料的插件中添加了ant插件(在这里我也有可以正常工作的码头插件):

<profiles>
        <profile>
            <id>DEV</id> <!-- to be used for building GUI for local Tomcat -->
            <build>
                <plugins>
          <plugin>
                        <groupId>org.eclipse.jetty</groupId>
                        <artifactId>jetty-maven-plugin</artifactId>
                        <version>9.4.22.v20191022</version>
                        <configuration>
                            <scanIntervalSeconds>2</scanIntervalSeconds>
                            <webAppConfig>
                                <contextPath>/dev</contextPath>
                            </webAppConfig>
                            <configuration>
                                <webApp>${basedir}\target</webApp>
                            </configuration>
                            <connectors>
                                <connector
                                    implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                                    <port>8080</port>
                                    <maxIdleTime>60000</maxIdleTime>
                                </connector>
                            </connectors>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>com.oracle</groupId>
                                <artifactId>ojdbc8</artifactId>
                                <version>${ojdbc8.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <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/dev/"/>
            </exec>
          </target>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

我像这样启动服务器:mvn jetty:run-war -P dev。浏览器无法启动。当我手动尝试网址http://localhost:8080/dev/时,它可以工作。任何想法如何自动启动浏览器?

0 个答案:

没有答案