Maven - 在当前项目和插件组中找不到前缀'tomcat7'的插件 [英] Maven - No plugin found for prefix 'tomcat7' in the current project and in the plugin groups

查看:1804
本文介绍了Maven - 在当前项目和插件组中找不到前缀'tomcat7'的插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Maven项目。这是结构:

I've created a Maven project. This is the structure:

-parent
    -core
    -web

但是当我尝试使用命令部署 mvn tomcat7:deploy ,我收到以下错误:

but when I try to deploy with the command mvn tomcat7:deploy, I get the following error:

No plugin found for prefix 'tomcat7' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo]

我把这个配置放在pom.xml(web项目)中:

I put this configuration in the pom.xml (of the web project):

<build>
    <finalName>MavenWeb</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.0</version>
        </plugin>
    </plugins>
</build>


推荐答案

可以使用'FQN'调用插件目标: groupId:artifactId:version:goal 或(如果适用)较短的命令(可用的许多变体)。
仅使用插件的短名称(在 tomcat7:deploy 中,tomcat7是短名称,deploy为目标/ mojo)适用于:

Plugins goals can be called using their 'FQN': groupId:artifactId:version:goal or, if applicable, shorter commands (many variants available). Using only the short name of a plugin (in your tomcat7:deploy, tomcat7 is the short name, deploy being the goal/mojo) is applicable if:

1)插件的groupId包含在Maven的已知插件组中。 org.apache.maven.plugins 默认位于列表中。

1) the groupId of the plugin is contained in the known plugin groups of Maven. org.apache.maven.plugins being in the list by default.

OR

你正在调用Maven命令的项目的pom.xml声明插件

the pom.xml of the project you're invoking the Maven command on declares the plugin

2)artifactId是 [short-name] -maven -plugin maven- [short-name] -plugin maven- [short-name] -plugin 为Maven项目提供的插件'保留' 。

2) the artifactId is [short-name]-maven-plugin or maven-[short-name]-plugin (maven-[short-name]-plugin being 'reserved' for plugins provided by Maven project.

这解释了为什么 mvn编译器:compile 可以在任何项目上开箱即用,但不能 tomcat7:deploy

That explains why mvn compiler:compile can work out of the box on any project, but not tomcat7:deploy

在你的情况下,第二个条件是真的,所以你只需要在你正在启动命令的项目上声明插件,或者将其添加到您的用户 settings.xml 文件:

In your case, the second condition is true, so you just have to declare the plugin on the project you're launching the command on, or add this to your user settings.xml file:

<pluginGroups>
  <pluginGroup>org.apache.tomcat.maven</pluginGroup>
</pluginGroups>

< a href =http://maven.apache.org/guides/introduction/introduction-to-plugin-prefix -mapping.htmlrel =noreferrer>请点击此处了解更多信息

这篇关于Maven - 在当前项目和插件组中找不到前缀'tomcat7'的插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆