I have two maven projects that use the avro-maven-plugin for code generation. The issue I am facing is that one of these project has an avro object that uses a reference to another avro object from the second maven project. Though I include the jar produced from the second project as a maven dependency I am unable to find a way to generate the code for the second project.
In essence consider the case that my second project has an avro definition like the one below
{
"namespace": "my.second.project.avro",
"name": "listNode",
"type": "record",
"fields":[
{
"name":"eventList",
"type":{
"type": "array",
"items": "my.first.project.AvroDefinition.avsc"
}
}
]
}
In this definition it refers to AvroDefinition.avsc which is included in one of the dependencies jar, but I cannot find any way to extract AvroDefinition.avsc and use it for code generation in the second project. Btw avro-maven-plugin has been setup as below:
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
<goal>protocol</goal>
<goal>idl-protocol</goal>
</goals>
<configuration>
<imports>
<import>${project.basedir}/src/main/avro/include/</import>
</imports>
<sourceDirectory>${project.basedir}/src/main/avro/</sourceDirectory>
<outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
<stringType>String</stringType>
</configuration>
</execution>
</executions>
</plugin>
and the error I get is the following:
Execution default of goal org.apache.avro:avro-maven-plugin:1.9.1:schema failed:
Undefined name: "my.first.project.AvroDefinition.avsc"
Anyway, I hoped that I could resort using maven remote resources plugin, but I couldn't make it work, so my question is how is this possible? How I can I import an avro definition from a dependant jar to generate my code ?