Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error reading settings.xml: Expected root element 'settings' but found 'servers' (position: START_TAG seen <servers>

Tags:

maven

I downloaded an existing Maven project into eclipse.

When I ran mvn install using the pom.xml file it failed showing the following error:

 mvn install
 Error reading settings.xml: Expected root element 'settings' but found 'servers' 
 (position: START_TAG seen  <servers>... @1:10)
 Line:   1
 Column: 10

I am using Maven 2.2.1 . and got settings.xml file under the M2 Home

like image 483
user974802 Avatar asked Oct 10 '11 12:10

user974802


1 Answers

I got this error in intellij (so the warning is not IDE specific) having imported a project using the POM at spring-data-neo4j-examples/cineasts/pom.xml on github

My settings.xml file contained the following

  <server>
        <id>LocalTomcat</id>
        <username>tomcat</username>
        <password>tomcat</password>
  </server>

Looking at http://maven.apache.org/settings.html I found the following settings template which contains the appropriate namespaces.

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository/>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>
  <pluginGroups/>
  <servers/>
  <mirrors/>
  <proxies/>
  <profiles/>
  <activeProfiles/>
</settings>

I dropped in the original <server> settings into the element.

The warning no longer occurred upon running mvn compile

like image 95
Rob Kielty Avatar answered Nov 15 '22 08:11

Rob Kielty