[ 
https://issues.apache.org/jira/browse/AVRO-971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Victor Chau updated AVRO-971:
-----------------------------

    Description: 
Currently, it looks like the only option to importing another schema in IDL is 
to place the file being imported in the same directory as that of the importing 
avdl.  In a setup where there are avdl's that are spread among several maven 
projects that are owned by different teams, this is logistically difficult to 
manage.

When using the avro-maven-plugin, I would like to be able to just create a 
dependency from my project on another jar that contains the avdl I am want to 
import and have Avro be smart enough to look for it in the classpath of the 
project containing the avdl when compiling my avdl.

Attached is a working patch that will:
  1. Change the IDLProtocolMojo class to lookup the current project's classpath 
and create a new ClassLoader.
  2. Give the Idl compiler class the ClassLoader before parsing the avdl.
  3. If the Idl class encounters an import that it cannot resolve to the local 
directory while parsing, it will try to use the ClassLoader to load up the file 
being imported.

The patch spans the Avro 1.6.1 tag of the Java avro, avro-compiler, and 
avro-maven-plugin projects.

  was:
Currently, it looks like the only option to importing another schema in IDL is 
to place the file being imported in the same directory as that of the importing 
avdl.  In a setup where there are avdl's that are spread among several maven 
projects that are owned by different teams, this is logistically difficult to 
manage.

When using the avro-maven-plugin, I would like to be able to just create a 
dependency from my project on another jar that contains the avdl I am want to 
import and have Avro be smart enough to look for it in the classpath of the 
project containing the avdl when compiling my avdl.

Attached is a working patch that will:
  1. Change the IDLProtocolMojo class to lookup the current project's classpath 
and create a new ClassLoader.
  2. Give the Idl compiler class the ClassLoader before parsing the avdl.
  3. If the Idl class encounters an import that it cannot resolve to the local 
directory while parsing, it will try to use the ClassLoader to load up the file 
being imported.

The patch spans the Java avro, avro-compiler, and avro-maven-plugin projects.

    
> IDL Import from project classpath
> ---------------------------------
>
>                 Key: AVRO-971
>                 URL: https://issues.apache.org/jira/browse/AVRO-971
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.6.1
>         Environment: Maven java projects
>            Reporter: Victor Chau
>            Priority: Minor
>              Labels: patch
>         Attachments: ImportFromClassPath.patch
>
>
> Currently, it looks like the only option to importing another schema in IDL 
> is to place the file being imported in the same directory as that of the 
> importing avdl.  In a setup where there are avdl's that are spread among 
> several maven projects that are owned by different teams, this is 
> logistically difficult to manage.
> When using the avro-maven-plugin, I would like to be able to just create a 
> dependency from my project on another jar that contains the avdl I am want to 
> import and have Avro be smart enough to look for it in the classpath of the 
> project containing the avdl when compiling my avdl.
> Attached is a working patch that will:
>   1. Change the IDLProtocolMojo class to lookup the current project's 
> classpath and create a new ClassLoader.
>   2. Give the Idl compiler class the ClassLoader before parsing the avdl.
>   3. If the Idl class encounters an import that it cannot resolve to the 
> local directory while parsing, it will try to use the ClassLoader to load up 
> the file being imported.
> The patch spans the Avro 1.6.1 tag of the Java avro, avro-compiler, and 
> avro-maven-plugin projects.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to