天天看點

maven:No plugin found for prefix 'jetty' in the current project and in the plugin groups

翻譯如下:

在目前的項目裡或插件組裡沒有以“jetty”開頭名字的插件。

怎麼辦?3種方案哪種都行。推薦第二種

1.在插件組裡添加jetty的插件

在maven的settings.xml裡添加以下配置

<!-- pluginGroups
   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
   |-->
  <pluginGroups>
    <!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup. -->
    <pluginGroup>org.mortbay.jetty</pluginGroup>
   
  </pluginGroups>
           

   這個就是全局的

2.在目前項目組裡添加jetty的插件。pom.xml裡

<plugins>
	     <plugin>
			  <groupId>org.eclipse.jetty</groupId>
			  <artifactId>jetty-maven-plugin</artifactId>
			  <version>9.4.9.v20180320</version>
			  <configuration>
			   
			    <webApp>
			      <contextPath>/jettydemo</contextPath>
			    </webApp>
			    <httpConnector>
			      <port>80</port>
			    </httpConnector>
			  </configuration>
		</plugin>
    </plugins>
           

這個是項目級别的

3.在指令裡使用

mvn org.mortbay.jetty:maven-jetty-plugin:run   
           

  這個是一次性的。

jetty是啟動了,但是如何關閉呢?簡單的是Ctrl+C