Unrecognised tag: 'pluginManagement'

打算使用maven的tomcat插件来自动部署项目,但是遇到了问题,先记下解决问题过程以避免犯错。
情况描述:

  1. 找到官方的配置模块地址:https://tomcat.apache.org/maven-plugin-2.2/
  2. 错误示范:直接到project标签下开始配置,如图:
<project>
    <pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.apache.tomcat.maven</groupId>
                        <artifactId>tomcat7-maven-plugin</artifactId>
                        <version>2.2</version>
                        <configuration>
                            <!--Deploy to server-->
                            <url>http://localhost:8080/manager/text</url>
                            <server>tomcat7</server>
                            <username>admin</username>
                            <password>admin</password>
                            <path>/${build.finalName}</path>
                            <port>8080</port>
                        </configuration>
                    </plugin>
                </plugins>
        </pluginManagement>
</project>

3、找解决办法:
第一种:您必须使用build标签包围plugins标签,如下所示:

<build>
    <plugins>
     <plugin>
      ...
     </plugin>
    </plugins>
  </build>

第二种:或者使用build和pluginManagement标签

<build>
    <pluginManagement>
      <plugins> 
       <plugin>
        ...
       </plugin>
      </plugins>
    </pluginManagement>
  </build>

转自:unrecognized tag in pom xml

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值