You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Anuj Ojha (JIRA)" <ji...@apache.org> on 2017/10/27 20:49:00 UTC

[jira] [Comment Edited] (AVRO-971) IDL Import from project classpath

    [ https://issues.apache.org/jira/browse/AVRO-971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16222785#comment-16222785 ] 

Anuj Ojha edited comment on AVRO-971 at 10/27/17 8:48 PM:
----------------------------------------------------------

[~cutting] [~Victor3y] Can you guys explain how to use this. I can see in the commit you are importing avdl, avsc and avpr into avdl which is existing in same project. 
I want to be able to import a avdl from different(third party) maven project which I am getting in as dependency to my avro maven project. Is doing that possible?
I tried the same approach shown in the example and it does not work. 


was (Author: anujojha):
[~cutting] [~Victor3y] Can you guys explain how to use this. I can see in the commit you are importing avdl, avsc and avpr into avdl which is existing in same project. 
I want to be able to import a avdl from different(third party) maven project which I am getting in as dependency to my avro maven project. Is doing that possible?

> 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
>            Assignee: Victor Chau
>            Priority: Minor
>              Labels: patch
>             Fix For: 1.6.2
>
>         Attachments: AVRO-971.patch, AVRO-971.patch, ImportFromClassPath.patch, ImportFromClassPath_v2.patch, ImportFromClassPath_v3.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 was sent by Atlassian JIRA
(v6.4.14#64029)

Re: [jira] [Comment Edited] (AVRO-971) IDL Import from project classpath

Posted by Doug Cutting <cu...@gmail.com>.
Taking this to the mailing list.

On Fri, Oct 27, 2017 at 1:49 PM, Anuj Ojha (JIRA) <ji...@apache.org> wrote:

>
>     [ https://issues.apache.org/jira/browse/AVRO-971?page=com.
> atlassian.jira.plugin.system.issuetabpanels:comment-
> tabpanel&focusedCommentId=16222785#comment-16222785 ]
>
> Anuj Ojha edited comment on AVRO-971 at 10/27/17 8:48 PM:
> ----------------------------------------------------------
>
> [~cutting] [~Victor3y] Can you guys explain how to use this. I can see in
> the commit you are importing avdl, avsc and avpr into avdl which is
> existing in same project.
> I want to be able to import a avdl from different(third party) maven
> project which I am getting in as dependency to my avro maven project. Is
> doing that possible?
> I tried the same approach shown in the example and it does not work.
>

Is the avdl file included in the jar file of the third party project?  If
it is, then you should be able to import it.

If you cannot, please provide a complete example of what you try and how it
fails.

Thanks,

Doug