Maven 集成 jetty

pom.xml

<properties>
    <jetty.version>9.3.0.M1</jetty.version>
    <server.port>80</server.port>
    <server.context>/my_context</server.context>
</properties>
<build>
    <plugins>
        <plugin>
	    <groupId>org.eclipse.jetty</groupId>
	    <artifactId>jetty-maven-plugin</artifactId>
	    <version>${jetty.version}</version>
	    <configuration>
	        <httpConnector>
		<!-- 设置端口 -->
		    <port>${server.port}</port>
		</httpConnector>
		<webAppConfig>
		    <contextPath>${server.context}</contextPath>
		</webAppConfig>
	    </configuration>
	</plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
    	<groupId>org.eclipse.jetty</groupId>
    	<artifactId>jetty-server</artifactId>
    	<version>${jetty.version}</version>
    </dependency>
    <dependency>
    	<groupId>org.eclipse.jetty</groupId>
    	<artifactId>jetty-webapp</artifactId>
    	<version>${jetty.version}</version>
    </dependency>
    <dependency>
    	<groupId>org.eclipse.jetty</groupId>
    	<artifactId>jetty-util</artifactId>
    	<version>${jetty.version}</version>
    </dependency>
    <dependency>
    	<groupId>org.eclipse.jetty</groupId>
    	<artifactId>jetty-jmx</artifactId>
    	<version>${jetty.version}</version>
    </dependency>
    <dependency>
    	<groupId>org.eclipse.jetty</groupId>
    	<artifactId>jetty-io</artifactId>
    	<version>${jetty.version}</version>
    </dependency>
    <dependency>
    	<groupId>org.eclipse.jetty</groupId>
    	<artifactId>jetty-servlet</artifactId>
    	<version>${jetty.version}</version>
    </dependency>
    <dependency>
    	<groupId>org.eclipse.jetty</groupId>
    	<artifactId>jetty-security</artifactId>
    	<version>${jetty.version}</version>
    </dependency>
    <dependency>
    	<groupId>org.eclipse.jetty</groupId>
    	<artifactId>jetty-http</artifactId>
    	<version>${jetty.version}</version>
    </dependency>
    <dependency>
    	<groupId>org.eclipse.jetty</groupId>
    	<artifactId>jetty-xml</artifactId>
    	<version>${jetty.version}</version>
    </dependency>
    <dependency>
    	<groupId>org.eclipse.jetty.orbit</groupId>
    	<artifactId>javax.servlet</artifactId>
    	<version>3.0.0.v201112011016</version>
    	<scope>provided</scope>
    </dependency>
    <dependency>
    	<groupId>javax.servlet</groupId>
    	<artifactId>servlet-api</artifactId>
    	<version>3.0-alpha-1</version>
    </dependency>
</dependencies>

dependencies中,按需加入

执行命令: mvn jetty:run

启动成功后浏览器访问 : http://localhost/my_context

时间: 2024-12-11 22:43:56

Maven 集成 jetty的相关文章

maven集成jetty插件热部署

一.org.eclipse.jetty插件启动 1.maven依赖 <dependency>    <groupId>org.eclipse.jetty</groupId>    <artifactId>jetty-webapp</artifactId>    <version>9.4.5.v20170502</version> </dependency> 2.plugin <plugin>  &l

Maven集成jetty插件

本机环境 JDK 7 Maven 3.2 Jetty 8.1.9 Eclipse Luna pom.xml 配置 在你的 pom.xml 文件里加入 jetty 插件的描写叙述信息(查看Jetty很多其它的版本号信息): [...] <build> <plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</art

eclipse集成jetty开发web项目(不采用maven方式)

以前开发过程部署项目都是采用tomcat,偶然发现jetty,所以试了下,挺方便的,直切主题. 1.下载jetty,楼主使用的jetty8,地址http://download.eclipse.org/jetty/ 2.下载完成后,解压缩,cd到jetty路径下,运行命令: java -jar start.jar 3.默认端口号8080,访问http://localhost:8080,出现jetty welcome界面 到此,说明jetty已经安装成功! 关于eclipse集成jetty开发web

Jetty开发指导:Maven和Jetty

使用Maven Apache Maven是一种软件项目管理和综合工具.基于项目对象模型(POM)的概念,Maven能从核心信息管理一个项目的构建.报告和文档. 他是用于构建一个web应用项目的理想工具,这些项目能用jetty-maven-plugin轻松的运行web应用,从而节省开发时间.你也能用Maven构建.测试和运行一个嵌入Jetty的项目. 首先我们将看一个很简单嵌入Jetty的HelloWorld Java应用,然后看一个简单的webapp怎么使用jetty-maven-plugin加

maven的jetty插件提示No Transaction manager found导致启动慢的解决方法

本文出处:http://blog.csdn.net/chaijunkun/article/details/37923905,转载请注明.由于本人不定期会整理相关博文,会对相应内容作出完善.因此强烈建议在原始出处查看此文.在使用maven开发web项目极大地方便了jar包的依赖,在测试时也可以集成Servlet容器,从启动速度和量级上看,Jetty无疑是不二选择,然而从8.x开始,如果你的web项目中不包含数据库访问(或者说没有事务管理器)的话,在其启动时会提示找不到事务管理器,输出信息如下: o

Eclipse+Maven(webapp)+Jetty+JReBel的配置方法

maven配置 省略 jrebel配置 jrebel毋须繁琐的配置,把jrebel-5.6.3-crack.zip解压放在磁盘文件夹就可以.(笔者路径为:D:\coding-life\IDE\jrebel\jrebel-5.6.3-crack)该路径兴许须要引用到 Eclipse配置 打开菜单Run > Debug configurations... 找到Maven Build.新建一个Maven命令配置.如图: 新建的相关面板配置例如以下(名称可自己定义,我这里取名为insurance-jet

Maven使用Jetty运行Web项目出错

问题现象: 在Maven中使用Jetty运行web项目有时会抛出如下异常:java.lang.ArrayIndexOutOfBoundsException: 48188 问题原因: 默认Jetty会解析程序中的注解信息,需要取消对注解信息. 解决方法: 在web.xml中web-app标签中添加属性metadata-complete="true". Maven使用Jetty运行Web项目出错,码迷,mamicode.com

maven中jetty插件配置

maven中jetty插件的配置,可用于项目在内置jetty服务器中的部署. <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <configuration> <contextPath>/Demo1</contextPath> <connectors> <conne

javafx maven集成遇到的问题解决

javafx maven集成采用javafx-maven-plugin, 主要分为几个目标: jfx:jar jfx:web jfx:native jfx:fix-classpath jfx:generate-key-store jfx:run 但是在 mvn clean jfx:run 时遇到了问题: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException 解决方法: