title: Eclipse: can't find javax.xml.datatype.XMLGregorianCalendar - Java 11
body: <p>I have migrated a project from java 1.8 to java 11. In the process I have had to install a newer version of eclipse to pick up the java 11 jdk.  </p>
  
  <pre><code>Eclipse IDE for Enterprise Java Developers.
  Version: 2018-12 (4.10.0)
  Build id: 20181214-0600
  </code></pre>
  
  <p>The application is a maven project and compiles successfully from the command line, however eclipse complains it can't resolve <strong>javax.xml.datatype.XMLGregorianCalendar</strong>.  </p>
  
  <p>I have updated the maven project from eclipse using right click on project Maven -> Update Project. </p>
  
  <p>I can see from the project maven dependencies jaxp-api-1.4.2.jar is included and that the class javax.xml.datatype.XMLGregorianCalendar exists.</p>
  
  <p>How do I fix the issue with Eclipse complaining the class javax.xml.datatype.XMLGregorianCalendar can't be resolved?</p>
  
  <p>Class with unresolved javax.xml.datatype.XMLGregorianCalendar:</p>
  
  <pre><code>//
  // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 
  // See &lt;a href="http://java.sun.com/xml/jaxb"&gt;http://java.sun.com/xml/jaxb&lt;/a&gt; 
  // Any modifications to this file will be lost upon recompilation of the source schema. 
  // Generated on: 2018.08.17 at 01:14:19 PM BST 
  //
  
  
  package com.qlsdistribution.fps.production.contentagent;
  
  import javax.xml.bind.annotation.XmlAccessType;
  import javax.xml.bind.annotation.XmlAccessorType;
  import javax.xml.bind.annotation.XmlElement;
  import javax.xml.bind.annotation.XmlRootElement;
  import javax.xml.bind.annotation.XmlSchemaType;
  import javax.xml.bind.annotation.XmlType;
  import javax.xml.datatype.XMLGregorianCalendar;
  
  
  
  /**
   * &lt;p&gt;Java class for anonymous complex type.
   * 
   * &lt;p&gt;The following schema fragment specifies the expected content contained within this class.
   * 
   * &lt;pre&gt;
   * &amp;lt;complexType&amp;gt;
   *   &amp;lt;complexContent&amp;gt;
   *     &amp;lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&amp;gt;
   *       &amp;lt;sequence&amp;gt;
   *         &amp;lt;element name="From" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/&amp;gt;
   *         &amp;lt;element name="To" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/&amp;gt;
   *       &amp;lt;/sequence&amp;gt;
   *     &amp;lt;/restriction&amp;gt;
   *   &amp;lt;/complexContent&amp;gt;
   * &amp;lt;/complexType&amp;gt;
   * &lt;/pre&gt;
   * 
   * 
   */
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "", propOrder = {
      "from",
      "to"
  })
  @XmlRootElement(name = "JobAPI_GetArchivedJobs")
  public class JobAPIGetArchivedJobs {
  
      @XmlElement(name = "From")
      @XmlSchemaType(name = "dateTime")
      protected XMLGregorianCalendar from;
      @XmlElement(name = "To")
      @XmlSchemaType(name = "dateTime")
      protected XMLGregorianCalendar to;
  
      /**
       * Gets the value of the from property.
       * 
       * @return
       *     possible object is
       *     {@link XMLGregorianCalendar }
       *     
       */
      public XMLGregorianCalendar getFrom() {
          return from;
      }
  
      /**
       * Sets the value of the from property.
       * 
       * @param value
       *     allowed object is
       *     {@link XMLGregorianCalendar }
       *     
       */
      public void setFrom(XMLGregorianCalendar value) {
          this.from = value;
      }
  
      /**
       * Gets the value of the to property.
       * 
       * @return
       *     possible object is
       *     {@link XMLGregorianCalendar }
       *     
       */
      public XMLGregorianCalendar getTo() {
          return to;
      }
  
      /**
       * Sets the value of the to property.
       * 
       * @param value
       *     allowed object is
       *     {@link XMLGregorianCalendar }
       *     
       */
      public void setTo(XMLGregorianCalendar value) {
          this.to = value;
      }
  
  }
  </code></pre>
  
  <p>Stripped down version of pom.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.qlsdistribution.fps&lt;/groupId&gt;
      &lt;artifactId&gt;fpsproduction&lt;/artifactId&gt;
      &lt;version&gt;1.0.53&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;fps-production&lt;/name&gt;
      &lt;description&gt;FocalPoint Sever Production Tool&lt;/description&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.1.3.RELEASE&lt;/version&gt;
          &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.11&lt;/java.version&gt;
          &lt;maven.build.timestamp.format&gt;yyyy-MM-dd HH:mm&lt;/maven.build.timestamp.format&gt;
          &lt;build.unknown&gt;UNKNOWN&lt;/build.unknown&gt;
          &lt;build.number&gt;${build.unknown}&lt;/build.number&gt;
          &lt;build.revision&gt;${build.unknown}&lt;/build.revision&gt;
          &lt;build.time&gt;${maven.build.timestamp}&lt;/build.time&gt;
  
      &lt;/properties&gt;
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;jcenter&lt;/id&gt;
              &lt;url&gt;https://jcenter.bintray.com/&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web-services&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;!-- javax.validation  --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.inject&lt;/groupId&gt;
              &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;
              &lt;version&gt;1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
              &lt;artifactId&gt;javax.ws.rs-api&lt;/artifactId&gt;
              &lt;version&gt;2.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/javax.xml/jaxp-api --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.xml&lt;/groupId&gt;
              &lt;artifactId&gt;jaxp-api&lt;/artifactId&gt;
              &lt;version&gt;1.4.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/javax.annotation/jsr250-api --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.annotation&lt;/groupId&gt;
              &lt;artifactId&gt;jsr250-api&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
              &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jaxb&lt;/groupId&gt;
              &lt;artifactId&gt;jaxb-runtime&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.annotation&lt;/groupId&gt;
              &lt;artifactId&gt;javax.annotation-api&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;release&gt;11&lt;/release&gt;
                  &lt;/configuration&gt;
                  &lt;dependencies&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;org.ow2.asm&lt;/groupId&gt;
                          &lt;artifactId&gt;asm&lt;/artifactId&gt;
                          &lt;version&gt;6.2&lt;/version&gt; 
                      &lt;/dependency&gt;
                  &lt;/dependencies&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;addDefaultSpecificationEntries&gt;true&lt;/addDefaultSpecificationEntries&gt;
                          &lt;/manifest&gt;
                          &lt;manifestEntries&gt;
                              &lt;Implementation-Version&gt;${project.version}-${build.number}(${build.time})&lt;/Implementation-Version&gt;
                              &lt;Implementation-Build&gt;${build.number}&lt;/Implementation-Build&gt;
                              &lt;Implementation-SCM-Revision&gt;${build.revision}&lt;/Implementation-SCM-Revision&gt;
                              &lt;Build-Time&gt;${build.time}&lt;/Build-Time&gt;
                          &lt;/manifestEntries&gt;
                      &lt;/archive&gt;
                      &lt;release&gt;11&lt;/release&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;release&gt;11&lt;/release&gt;  
                  &lt;/configuration&gt;
                  &lt;dependencies&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                          &lt;artifactId&gt;springloaded&lt;/artifactId&gt;
                          &lt;version&gt;1.2.8.RELEASE&lt;/version&gt;
                      &lt;/dependency&gt;
                  &lt;/dependencies&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;descriptors&gt;
                          &lt;descriptor&gt;src/assembly/bundle.xml&lt;/descriptor&gt;
                      &lt;/descriptors&gt;
                      &lt;release&gt;11&lt;/release&gt;
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;make-assembly&lt;/id&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;single&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;release&gt;11&lt;/release&gt;  
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;copy-resources&lt;/id&gt;
                          &lt;phase&gt;prepare-package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;copy-resources&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;outputDirectory&gt;
                                  ${project.build.outputDirectory}/static/docs
                              &lt;/outputDirectory&gt;
                              &lt;resources&gt;
                                  &lt;resource&gt;
                                      &lt;directory&gt;
                                          ${project.build.directory}/generated-docs
                                      &lt;/directory&gt;
                                  &lt;/resource&gt;
                              &lt;/resources&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
  
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
      &lt;profiles&gt;
  
          &lt;!-- Dev Tools --&gt;
          &lt;profile&gt;
              &lt;!-- Need to specify normal profile as well when using this one --&gt;
              &lt;id&gt;devtools&lt;/id&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
                      &lt;optional&gt;true&lt;/optional&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
          &lt;/profile&gt;
          &lt;profile&gt;
              &lt;id&gt;dev&lt;/id&gt;
              &lt;activation&gt;
                  &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
              &lt;/activation&gt;
              &lt;properties&gt;
                  &lt;filter&gt;dev&lt;/filter&gt;
              &lt;/properties&gt;
          &lt;/profile&gt;
  
      &lt;/profiles&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/DRtum.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DRtum.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/yrhcz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yrhcz.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/Wong6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Wong6.png" alt="enter image description here"></a></p>