缺少Maven插件Jetty

问题描述 投票:15回答:7

我在跟随这个qazxsw poi时遇到了麻烦

它说我应该跑

http://hrycan.com/2012/03/28/primefaces-lazy-loading-datatable-for-jsf2/

但我继续遇到这个错误。

mvn jetty:run

我在这里使用了Maven 3。

有什么想法吗?

加:

从链接中,它已经存在于pom.xml中

org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found
for prefix 'jetty' in the current project and in the plugin groups [org.apache.m
aven.plugins, org.codehaus.mojo] available from the repositories [local (C:\MyRepo), central (http://repo1.maven.org/maven2)]
        at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.r
maven-plugin maven-3
7个回答
8
投票

你有没有把插件添加到pom.xml?快速谷歌搜索发现:

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>7.5.1.v20110908</version>
    <dependencies>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.version}</version>
        </dependency>
    </dependencies>
</plugin>

在这里找到:<project> ... <build> ... <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jetty-maven-plugin</artifactId> </plugin> </plugins> </build> </project>


32
投票

http://mojo.codehaus.org/jetty-maven-plugin/usage.html)的说明将版本设置为$ {project.version},这是错误的!此外,较旧的文档将groupId设置为org.codehaus.mojo,应将其设置为org.eclipse.jetty。

我从jetty repo(http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html)添加了一个真实版本并更改了groupId。

http://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-maven-plugin/

4
投票

在记录的settings.xml中添加以下内容后检查它是否有效。

<plugin>
  <groupId>org.eclipse.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>9.0.5.v20130815</version>
</plugin>

另请注意,该插件有两个不同版本 - 较旧的maven-jetty-plugin和较新的jetty-maven-plugin。 <pluginGroups> <pluginGroup>org.mortbay.jetty</pluginGroup> </pluginGroups>


3
投票

确保从项目目录中执行命令'mvn jetty:run'。如果要列出当前目录,则应该看到pom.xml。

如果你不在你的项目中并运行'mvn jetty:run',将会出现错误“Missing Maven Plugin Jetty”

source

希望它会有所帮助


2
投票

我也有这个问题。我使用“Maven Build”运行配置从Eclipse中启动了 <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>8.1.12.v20130726</version> <configuration> <stopKey>todostop</stopKey> <stopPort>9999</stopPort> </configuration> </plugin>

问题是,在我的Maven Build运行配置中,“基本目录”(即mvn可执行文件使用的工作目录)设置不正确。将基目录设置为包含jetty:run的目录可以解决问题。


0
投票

很可能你的版本错了。尝试

pom.xml

0
投票

除了插件部分,您应该在pom.xml目录中以启动jetty命令。

© www.soinside.com 2019 - 2024. All rights reserved.