title: How to change default directory for generating Java from XSD (JAXB)
body: <p>I have a manve project, and I'm using the JAXB2 plugin to generate java class from XSD schema. By default, the classes are generated in the target folder, but I need to generate it in the src/main/java folder.</p>
  
  <p>I tried adding the line attribute generateDirectory. The classes are generated where I want, but I can't import them on other places</p>
  
  <p>Here is my  pom.xml:</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;org.jvnet.jaxb2.maven2&lt;/groupId&gt;
              &lt;artifactId&gt;maven-jaxb2-plugin&lt;/artifactId&gt;
              &lt;version&gt;0.13.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;schemaDirectory&gt;src/main/resources/schemas&lt;/schemaDirectory&gt;
                  &lt;generateDirectory&gt;src/main/java/com/evol/foo/generated-bar-sources&lt;/generateDirectory&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;generate&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>And my java class using the generated files:</p>
  
  <pre><code>package com.evol.foo.service;
  import com.evol.foo.generated-bar-sources; //error: cannot resolve symbol generated
  
  @Component
  public class XMLParserService {
  
    //ComplexType cannot be found
    public ComplexType parseErrorFile(String filePath) throws JAXBException {
      File file = new File(filePath);
      JAXBContext jaxbContext = JAXBContext.newInstance(ComplexType.class);
  
      Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
      ComplexType errFile = (ComplexType) 
      jaxbUnmarshaller.unmarshal(file);
      return errFile;
    }
  </code></pre>
  
  <p>I'm using Intellij Comunity and Java 8.
  What am I doing wrong?</p>