错误描述
cvc-complex-type.2.4.a: Invalid content was found starting with element ‘plugins’. One of ‘{“http://
maven.apache.org/POM/4.0.0”:parent, “http://maven.apache.org/POM/4.0.0“:name, “http://
maven.apache.org/POM/4.0.0”:description, “http://maven.apache.org/POM/4.0.0“:url, “http://
maven.apache.org/POM/4.0.0”:prerequisites, “http://maven.apache.org/POM/
4.0.0”:issueManagement, “http://maven.apache.org/POM/4.0.0“:ciManagement, “http://
maven.apache.org/POM/4.0.0”:inceptionYear, “http://maven.apache.org/POM/4.0.0“:mailingLists,
“http://maven.apache.org/POM/4.0.0“:developers, “http://maven.apache.org/POM/4.0.0“:contributors,
“http://maven.apache.org/POM/4.0.0“:licenses, “http://maven.apache.org/POM/4.0.0“:scm, “http://
maven.apache.org/POM/4.0.0”:organization, “http://maven.apache.org/POM/4.0.0“:profiles, “http://
maven.apache.org/POM/4.0.0”:modules, “http://maven.apache.org/POM/4.0.0“:repositories, “http://
maven.apache.org/POM/4.0.0”:pluginRepositories, “http://maven.apache.org/POM/4.0.0“:reports,
“http://maven.apache.org/POM/4.0.0“:reporting, “http://maven.apache.org/POM/
4.0.0”:dependencyManagement, “http://maven.apache.org/POM/4.0.0“:distributionManagement,
“http://maven.apache.org/POM/4.0.0“:properties}’ is expected.
错误信息
错误的pom.xml配置
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fengyun.webpro</groupId>
<artifactId>webpro</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>1.0-beta-2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
</dependency>
</dependencies>
<build>
<defaultGoal>clean compile</defaultGoal>
</build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<container>
<containerId>tomcat6x</containerId>
<home>D:\Program Files\apache-tomcat-6.0.18</home>
</container>
<configuration>
<type>standalone</type>
<home>${project.build.directory}/tomcat6x</home>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</project>
解决办法
plugins节点配置错误了,如下格式才对
<build>
<plugins>
<plugins>
</plugin>
</plugins>
</build>
调整配置,问题解决
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fengyun.webpro</groupId>
<artifactId>webpro</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>1.0-beta-2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
</dependency>
</dependencies>
<build>
<defaultGoal>clean compile</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<container>
<containerId>tomcat6x</containerId>
<home>D:\Program Files\apache-tomcat-6.0.18</home>
</container>
<configuration>
<type>standalone</type>
<home>${project.build.directory}/tomcat6x</home>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
</project>