eclipse + maven + glassfish embedded

来源:互联网 发布:网络海外代购兼职 编辑:程序博客网 时间:2024/06/05 15:19
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">  <modelVersion>4.0.0</modelVersion>  <groupId>com.limiko.test</groupId>  <artifactId>myweb</artifactId>  <packaging>war</packaging>  <version>0.0.1</version>  <name>Maven Webapp</name>  <url>http://maven.apache.org</url>  <properties>  </properties>    <build>    <finalName>myweb</finalName>    <plugins>    <plugin>        <groupId>org.glassfish</groupId>        <artifactId>maven-embedded-glassfish-plugin</artifactId>        <version>3.2-SNAPSHOT</version>        <configuration>          <goalPrefix>embedded-glassfish</goalPrefix>          <app>${project.build.directory}/${build.finalName}.war</app>          <port>8080</port>           <contextRoot>${build.finalName}</contextRoot>           <autoDelete>true</autoDelete>       </configuration>     </plugin>    </plugins>  </build>    <pluginRepositories>      <pluginRepository>          <id>maven2-repository.dev.java.net</id>          <name>Java.net Repository for Maven</name>          <url>http://download.java.net/maven/glassfish/</url>      </pluginRepository>  </pluginRepositories><repositories>       <repository>          <id>maven2-repository.dev.java.net</id>          <name>Java.net Repository for Maven</name>          <url>http://download.java.net/maven/glassfish/</url>      </repository>  </repositories></project>

运行 maven package 打包

运行 maven embedded-glassfish:run 部署

浏览器输入 http:.//localhost:8080/myweb 即可看到页面


原创粉丝点击