Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse shows errors in pom.xml file: cvc-datatype-valid.1.2.1: '${MYVAR}' is not a valid value for 'boolean'

I have a Maven project that builds fine on the command line. I want to edit the project files in Eclipse Luna 4.4.1, but when I load the project, it reports the following errors in my pom.xml file:

cvc-datatype-valid.1.2.1: '${MYVAR}' is not a valid value for 'boolean'

cvc-type.3.1.3: The value of '${MYVAR}' of element 'enabled' is not valid.

This problem looks similar to Validating Maven pom.xml when boolean is a property, which doesn't have any answers yet. While I can compile via Maven on the command line, it is annoying that Eclipse constantly reports these as errors. Is there any way to get rid of these errors without disabling the validation of the rest of the pom.xml file?

According to http://maven.apache.org/pom.html#Properties I'm referencing the MYVAR property correctly.

Here are the relevant contents of my pom.xml file:

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <artifactId>myproject</artifactId>
  <groupId>org.mydomain</groupId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <properties>
    <spring-version>3.0.2.RELEASE</spring-version>
    <MYVAR>false</MYVAR>
  </properties>
  <repositories>
    <repository>
      <id>internal_repo</id>
      <name>my internal repository for offline use</name>
      <url>file://${INT_REPO_HOME}/java/maven_repo</url>
      <layout>default</layout>
    </repository>
    <repository>
      <id>central</id>
      <url>http://repo1.maven.org/maven2</url>
      <releases>
        <enabled>${MYVAR}</enabled>
      </releases>
      <snapshots>
        <enabled>${MYVAR}</enabled>
      </snapshots>
    </repository>
  </repositories>
</project>
like image 420
Gillfish Avatar asked Mar 17 '23 09:03

Gillfish


1 Answers

Eclipse is validating the XSD of the POM which says that this XML element is of type boolean.

Valid values for boolean are true/false so when it sees ${MYVAR} it raises a validation error... because the plugin of Eclipse doesn't do the variable translation from "${MYVAR}" to "false".

However if you do a mvn install it works with no problem, which means that the pom is correct.

Conclusion, this is an Elipse plugin issue so you can only ignore it.

like image 158
Carlos Verdes Avatar answered Apr 07 '23 13:04

Carlos Verdes