maven jetty - org.mortbay.jetty vs org.eclipse.jetty

hba*_*hba 26 jetty maven

我正在尝试使用jetty来使用maven来托管一个简单的helloworld servlet.我很困惑.

我按照这些说明操作,但是当我发出时mvn jetty:run,我收到以下错误:

[ERROR] No plugin found for prefix 'jetty' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/abc/.m2/repository), central (http://repo.maven.apache.org/maven2)]
Run Code Online (Sandbox Code Playgroud)

更令人困惑的是,当我在网上搜索一些例子时,有些人指的是org.mortbay.jetty,有些人指的是org.eclipse.jetty.我认为Eclipse版本是最新版本,不是吗?

是否有任何文档描述了maven repo上托管的每个依赖项的含义?以及如何使用它们?

修改版本号后9.0.0.v20130308,我得到一个不同的错误:

Unable to load the mojo 'run' in the plugin 'org.eclipse.jetty:jetty-maven-plugin:9.0.0.v20130308' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/eclipse/jetty/maven/plugin/JettyRunMojo : Unsupported major.minor version 51.0
Run Code Online (Sandbox Code Playgroud)

这是我更新的pom:

<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.neon.research</groupId>
        <artifactId>jetty</artifactId>
        <packaging>war</packaging>
        <version>1.0-SNAPSHOT</version>
        <name>jetty Maven Webapp</name>
        <url>http://maven.apache.org</url>
        <properties>
                <jetty.version></jetty.version>
        </properties>
        <dependencies>
                <dependency>
                        <groupId>org.eclipse.jetty.orbit</groupId>
                        <artifactId>javax.servlet</artifactId>
                        <version>3.0.0.v201112011016</version>
                        <scope>provided</scope>
                </dependency>
        </dependencies>

        <build>
                <plugins>
                        <plugin>
                                <groupId>org.eclipse.jetty</groupId>
                                <artifactId>jetty-maven-plugin</artifactId>
                                <version>9.0.0.v20130308</version>
                        </plugin>
                        <plugin>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <configuration>
                                        <source>1.6</source>
                                        <target>jsr14</target>
                                </configuration>
                                <executions>
                                        <execution>
                                                <id>test-compile</id>
                                                <phase>process-test-sources</phase>
                                                <goals>
                                                        <goal>testCompile</goal>
                                                </goals>
                                                <configuration>
                                                        <source>1.6</source>
                                                        <target>1.6</target>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>
                </plugins>
        </build>
</project>
Run Code Online (Sandbox Code Playgroud)

and*_*dyb 23

Jetty已经走了很多 - 看历史.Eclipse是最新的主页,截至2009年.Maven工件已经重命名,因此您的搜索正在查找旧版Jetty和maven插件的文档.

最新的(v9)jetty-maven-plugin文档将依赖关系列为:

<plugin>
  <groupId>org.eclipse.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>9.0.0.v20130308</version> <!-- latest at time of writing -->
</plugin>
Run Code Online (Sandbox Code Playgroud)

其他库如jetty-continuationjetty-jsp只是Jetty项目的子模块.有关Jetty 7和8 的旧维基上存在一些文档,但我还没有看到任何针对v9更新的内容.模块化设计是Jetty开发人员将他们的代码组织成明确定义的模块,这些模块都是为开发人员单独提供的,他们可能只想使用Jetty的一小部分.

  • 您现在的版本与Java不匹配.Jetty 9需要Java 1.7 (3认同)