web-dev-qa-db-fra.com

Maven: Un contenu non valide a été trouvé en commençant par l'élément 'plugin'

J'ai mis à jour mon pom.xml avec des plagins et j'ai une erreur:

 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.

C'est un fichier 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>

Comment résoudre ceci?

13
khris

Vous devez ajouter la partie suivante dans votre fichier pom:

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

Vous devez ajouter votre code entre,

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

Si vous avez plusieurs plugins, vous ajouterez une autre balise <plugin> sous <plugins>.

2
Rishabh Agarwal