Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven error: element dependency can not have character children

I'm not sure what happened, but the POM for my project no longer works. Its complaining about the dependency element. Is it that the dependency no longer exists? What does this error mean? To be clear I haven't change the POM, it just does not work now.

The exact error message is cvc-complex-type.2.3: Element 'dependency' cannot have character (children), because this type's content type is element-only.

<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.medfusion</groupId>   <artifactId>Estatements-core</artifactId>   <version>14.6.0-SNAPSHOT</version>   <packaging>jar</packaging>    <name>Estatements-core</name>   <url>http://maven.apache.org</url>    <properties>     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>   </properties> <build>     <plugins>       <plugin>         <groupId>org.apache.maven.plugins</groupId>         <artifactId>maven-shade-plugin</artifactId>         <version>1.6</version>         <executions>           <execution>             <phase>package</phase>             <goals>               <goal>shade</goal>             </goals>             <configuration>               <transformers>                 <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">                   <mainClass>com.group.id.Launcher1</mainClass>                 </transformer>               </transformers>             </configuration>           </execution>         </executions>       </plugin>        <plugin>         <groupId>org.apache.maven.plugins</groupId>         <artifactId>maven-release-plugin</artifactId>         <version>2.3.2</version>       </plugin>     </plugins>   </build> <repositories>     <repository>         <id>nexus-qhg-dev</id>         <name>Medfusion repo</name>         <url>http://maven.qhg.local/nexus/content/groups/qhg-dev</url>     </repository> </repositories>  <dependencies>   <dependency>     <groupId>com.intuit.health</groupId>     <version>14.6.0-SNAPSHOT</version>      <artifactId>notification-reference</artifactId>       </dependency>    <dependency>       <groupId>junit</groupId>       <artifactId>junit</artifactId>       <version>3.8.1</version>       <scope>test</scope>   </dependency>   <dependency>     <groupId>com.intuit.health</groupId>     <version>ihg-depot-trunk-SNAPSHOT</version>     <artifactId>attachment-reference</artifactId>   </dependency>   <dependency>     <groupId>com.intuit.health</groupId>     <version>ihg-depot-trunk-SNAPSHOT</version>     <artifactId>eCommunication-core</artifactId>       </dependency>  </dependencies>  </project> 
like image 289
Rob Avatar asked Oct 22 '14 13:10

Rob


1 Answers

As mentioned in the comment by Powerlord, this error is due to incorrect parsing of the XML file, because there are strange and hidden characters in between a/some <dependency>...</dependency> tag(s). Those characters could come from a copy paste from the Web.

To solve the issue, remove all spaces and newline characters between <dependency>...</dependency> tags definitions and put them back into your editor.

like image 154
Jämes Avatar answered Oct 15 '22 12:10

Jämes