web-dev-qa-db-ja.com

Maven:要素 'plugin'で始まる無効なコンテンツが見つかりました

私はpom.xmlをplaginsで更新してエラーが発生しました:

 cvc-complex-type.2.4.a: Invalid content was found starting with element 'plugin'. One of      '{"http://maven.Apache.org/POM/
 4.0.0":parent, "http://maven.Apache.org/POM/4.0.0":description, "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":build, "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}' 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</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>test</name>
<url>http://maven.Apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <scope>test</scope>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>Oracle</groupId>
        <artifactId>ojdbc16</artifactId>
        <version>11.2.0.1.0</version>
        <type>jar</type>
    </dependency>
</dependencies>
<plugin>
   <groupId>org.Apache.cxf</groupId>
   <artifactId>cxf-Java2ws-plugin</artifactId>
   <version>2.5.1</version>
   <dependencies>
      <dependency>
         <groupId>org.Apache.cxf</groupId>
         <artifactId>cxf-rt-frontend-jaxws</artifactId>
         <version>2.5.1</version>
      </dependency>
      <dependency>
         <groupId>com.company.app</groupId>
         <artifactId>services</artifactId>
         <version>0.0.1-SNAPSHOT</version>
      </dependency>
   </dependencies>
   <executions>
      <execution>
         <id>generate-sources</id>
         <phase>generate-sources</phase>
         <configuration>
            <className>com.company.app.services.WebServiceBean</className>
            <genWsdl>true</genWsdl>
         </configuration>
         <goals>
            <goal>Java2ws</goal>
         </goals>
      </execution>
   </executions>
</plugin>
<plugin>
   <groupId>org.Apache.cxf</groupId>
   <artifactId>cxf-codegen-plugin</artifactId>
   <version>2.5.1</version>
   <executions>
      <execution>
         <id>process-sources</id>
         <phase>generate-sources</phase>
         <configuration>
            <wsdlOptions>
               <wsdlOption>
                  <wsdl>${project.build.directory}/generated/wsdl/WebServiceBean.wsdl</wsdl>
                  <extraargs>
                     <extraarg>-p</extraarg>
                     <extraarg>com.company.app.services.client.model</extraarg>
                  </extraargs>
               </wsdlOption>
            </wsdlOptions>
         </configuration>
         <goals>
            <goal>wsdl2Java</goal>
         </goals>
      </execution>
   </executions>
</plugin>
</project>

これを解決するには?

17
khris

Pomファイルに次の部分を追加する必要があります。

<build>
  <plugins>
      <plugin>
       ...
      </plugin>
  </plugins>
</build>
36
khmarbaise

<plugins> </plugins>の間にコードを追加する必要があります

    <build>
      <plugins>
          <plugin>
              <!-- Add here -->
          </plugin>
      </plugins>
    </build>

複数のプラグインがある場合は、<plugin>の下に別の<plugins>タグを追加します。

4
Rishabh Agarwal