No plugin found for prefix 'jetty' in the current project and in the plugin groups [org.apache.mave

这是个人项目:
这里写图片描述html

运行的时候错误:web

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.903s
[INFO] Finished at: Thu Aug 13 11:33:22 CST 2015
[INFO] Final Memory: 7M/121M
[INFO] ------------------------------------------------------------------------
[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 (C:\Users\liu
gen.xu\.m2\repository), QunarNexus (http://nexus.corp.qunar.com:8081/nexus/content/groups/public), central (http://repo1.maven.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException
E:\QunarEclipse\Koala\com.qunar.koloa>

这里写图片描述

使用cmd命令行执行的时候也是有错误的:
这里写图片描述apache

在网上也有不少的解决方式,大体相同,例如这个:
http://www.360doc.com/content/14/0106/17/1332348_343100544.shtml服务器

可是试了不少解决的方式,都不能够。eclipse

最终的解决方法是:maven

咱们使用Maven管理项目,而对于一个web项目而言,jetty的引用应该是在该web下边的POM中,例如个人项目是利用maven管理,其中
这里写图片描述
这个是web项目的主目录,在他的pom下边我引用了jetty服务器的插件:svg

<build>
        <plugins>
            <!-- 配置加入jetty服务器,开发时咱们通常使用jetty服务器 -->
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <configuration>
                    <!-- 设置扫描target/classes内部文件变化时间间隔 -->
                    <!--<scanIntervalSeconds>10</scanIntervalSeconds> -->
                    <webApp>
                        <contextPath>/</contextPath>
                    </webApp>
                </configuration>
            </plugin>
        </plugins>
    </build>

那么问题来了,咱们直接使用mvn clean install命令来运行该项目,找到的默认的是总的(个人是com.qunar.koloa这个)可是显而易见,我在总的这个pom中并无引用jetty的插件,因此会出错,ui

正确的方式是,咱们须要进入这个项目的目录,打开IDEA的终端(Alt+F12),而后使用命令进行运行:
这里写图片描述spa

而后运行:mvn clean install命令进行编译,最后运行:mvn jetty:run来运行该项目,就能够成功的运行。插件

问题的关键就是,咱们并无找到该项目运行所须要的起点,找到项目的起点,cd进去,运行就能够了


另外对于使用eclipse的朋友,没有Alt+F12打开MVN的终端,那咱们能够使用cmd的方式来运行,

首先:找到本身项目的主目录,
这里写图片描述

别再犯错误了,咱们还应该进入com.qunar.koloa-web 目录(由于这里配置了咱们使用jetty的插件),进去以后,在地址栏中输入:cmd,回车能够直接在cmd中定位搭配该文件的位置
这里写图片描述

这里写图片描述
而后在接着运行mvn jetty:run命令

OK到此结束!但愿对你们有帮助!