title: Using Avro schema from different package
body: <p>We use Avro as our serialization engine in a big Java project.</p>
  
  <p>We use maven plug-in for auto-generating classes from the Avro schemas (we only use avsc, no IDL).
  All works nice until we come to cross-packages references.</p>
  
  <p>The plug-in has the option to import schema files using the import tag, which works fine within the package, but when we try to reference a schema outside the package it does not fine it.</p>
  
  <p>This is the plug-in setting:</p>
  
  <pre><code>&lt;build&gt;
  &lt;plugins&gt;
    &lt;plugin&gt;
      &lt;groupId&gt;org.apache.avro&lt;/groupId&gt;
      &lt;artifactId&gt;avro-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;1.7.7&lt;/version&gt;
      &lt;configuration&gt;
        &lt;stringType&gt;String&lt;/stringType&gt;
      &lt;/configuration&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;phase&gt;generate-sources&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;schema&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
              &lt;sourceDirectory&gt;${project.basedir}/src/main/resources/&lt;/sourceDirectory&gt;
              &lt;outputDirectory&gt;${project.basedir}/src/main/java/&lt;/outputDirectory&gt;
              &lt;fieldVisibility&gt;PRIVATE&lt;/fieldVisibility&gt;
                &lt;imports&gt;
                  &lt;import&gt;${project.parent.basedir}/SomeOtherPackagePath/schema1.avsc&lt;/import&gt;
                  &lt;import&gt;${project.basedir}/src/main/resources/schema2.avsc&lt;/import&gt;
                &lt;/imports&gt;
              &lt;/configuration&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p><strong>schema2.avsc</strong> contains a record called <strong>schema2</strong>, and is imported correctly, and all other schemas referencing schema2 are valid.</p>
  
  <p><strong>schema1.avsc</strong> contains a record called <strong>schema1</strong>, and is in another package, so schemas in this packages referencing to it fail when building the maven:</p>
  
  <p>[ERROR] Failed to execute goal org.apache.avro:avro-maven-plugin:1.7.7:schema (default) on 
  project matching-common: Execution default of goal org.apache.avro:avro-maven-plugin:1.7.7:schema failed: "Schema1" is not a defined name. The type of the "schema1" field must be a defined name or a {"type": ...} expression.</p>
  
  <p>Are we missing something?</p>
  
  <p>Is there any way to use schemas from other packages at all?</p>