是否可以在eclipse运行时环境中定义jetty服务器?

时间:2012-07-27 15:32:45

标签: java eclipse rest jetty

我使用eclipse WTP创建了一个REST WS应用程序。到目前为止,我使用Tomcat 7来部署我的应用程序。我可以将Tomcat定义为服务器运行时环境。现在我想使用jetty来部署该应用程序,我下载了jetty 8并且我已经eclipse Indigo ..试图像我为Tomcat所做的那样定义jetty但它没有用,因为可用的适配器是用于jetty6而当我尝试使用此适配器运行我的应用程序,我收到一条消息 the server does not suport version 3.0 of J2EE Web module specification

如何从eclipse在jetty上运行我的应用程序?

1 个答案:

答案 0 :(得分:2)

jetty 6只支持jsp / servlets 2.5 规范,所以你需要使用jetty8和servlets / jsp 3.0支持

使用maven添加像这样的码头8

<dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-server</artifactId>
        <version>${jetty.revision}</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-webapp</artifactId>
        <version>${jetty.revision}</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-servlet</artifactId>
        <version>${jetty.revision}</version>
    </dependency>

其中jetty版本就是这个版本 8.1.5.v20120716