[
https://issues.apache.org/jira/browse/AVRO-2942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Fernando Blanch Calvete updated AVRO-2942:
------------------------------------------
Description:
* avro-maven-plugin v1.10.0
* apache avro v1.10.0
* maven 3.5.4
We have encountered problems with some file structures and how the avro plugin
manages the inclusion and exclusion of files in the processing and generation
of java classes.
When we specify the order of the files or directories import for the plugin, we
see mainly two problems that we detail below.
For the following avro definition structure:
{code:java}
├── imports
│ └── event
│ ├── event1
│ │ ├── v5
│ │ │ └── imports
│ │ │ └── entities
│ │ │ └── PrivacyImport.avsc
│ │ └── v6
│ │ └── imports
│ │ └── entities
│ │ └── PrivacyImport.avsc
│ └── event2
│ └── v1
│ └── entities
│ └── PrivacyImport.avsc
└── sources
└── event
└── event1
├── v5
│ └── User.avsc
└── v6
└── User.avsc
{code}
*1.* If by necessity of the project we must explicitly specify first in the
order of import a file (PrivacyImport.avsc), and then different directories
containing a file with the same name, even if their content is different, the
plugin excludes them from processing.
{code:java}
<avro.imports.resources>
${project.basedir}/src/main/resources/demo/imports/event/event2/v1/entities/PrivacyImport.avsc,${project.basedir}/src/main/resources/demo/imports/event/event1/v5/imports,${project.basedir}/src/main/resources/demo/imports/event/event1/v6/imports
</avro.imports.resources>
{code}
{color:#de350b}Result: Failed to execute goal
org.apache.avro:avro-maven-plugin:1.10.0:schema (avro-events) on project
demo-event: Execution avro-events of goal
org.apache.avro:avro-maven-plugin:1.10.0:schema failed: Undefined name:
"test.v5.PrivacyImport"{color}
*2.* If for necessity of the project we must explicitly specify first in the
order a directory (imports/event/event2/v1/entities), and then different
directories contain a directory with the same name, the plugin excludes these
directories (entities/**) and all their content from processing.
{code:java}
<avro.imports.resources>
${project.basedir}/src/main/resources/demo/imports/event/event2/v1/entities,${project.basedir}/src/main/resources/demo/imports/event/event1/v5/imports,${project.basedir}/src/main/resources/demo/imports/event/event1/v6/imports
</avro.imports.resources>
{code}
{color:#de350b}Result: Failed to execute goal
org.apache.avro:avro-maven-plugin:1.10.0:schema (avro-events) on project
demo-event: Execution avro-events of goal
org.apache.avro:avro-maven-plugin:1.10.0:schema failed: Undefined name:
"test.v5.PrivacyImport"{color}
>From what we have seen, these unexpected behaviors occur because in the
>configuration of the exclusion of files and directories in the
>"*getIncludedFiles()*" method of the *AbstractAvroMojo.java* class, only the
>filename is obtained. For example, if the import settings is:
{code:java}
<avro.imports.resources>
${project.basedir}/src/main/resources/demo/imports/event/event2/v1/entities/PrivacyImport.avsc,${project.basedir}/src/main/resources/demo/imports/event/event1/v5/imports,${project.basedir}/src/main/resources/demo/imports/event/event1/v6/imports
</avro.imports.resources>
{code}
this list of excludes is \{"**/PrivacyImport.avsc", "imports/**, imports/**"},
so as explained above in case 1, the files with the name "PrivacyImport.avsc"
in the directories "demo/imports/event/event1/v5/imports/entitites" and
"demo/imports/event/event1/v6/imports/entitites" will be excluded.
Do you see it convenient to consider that in the exclusions the absolute name
of the file or directory (with the path) is added instead of just the name?
Attached to the issue is a demo application that reproduces the problems
explained.
was:
* avro-maven-plugin v1.10.0
* apache avro v1.10.0
* maven 3.5.4
We have encountered problems with some file structures and how the avro plugin
manages the inclusion and exclusion of files in the processing and generation
of java classes.
When we specify the order of the files or directories import for the plugin, we
see mainly two problems that we detail below.
For the following avro definition structure:
{code:java}
├── imports
│ └── event
│ ├── event1
│ │ ├── v5
│ │ │ └── imports
│ │ │ └── entities
│ │ │ └── PrivacyImport.avsc
│ │ └── v6
│ │ └── imports
│ │ └── entities
│ │ └── PrivacyImport.avsc
│ └── event2
│ └── v1
│ └── entities
│ └── PrivacyImport.avsc
└── sources
└── event
└── event1
├── v5
│ └── User.avsc
└── v6
└── User.avsc
{code}
*1.* If by necessity of the project we must explicitly specify first in the
order of import a file (PrivacyImport.avsc), and then different directories
containing a file with the same name, even if their content is different, the
plugin excludes them from processing.
{code:java}
<avro.imports.resources>
${project.basedir}/src/main/resources/demo/imports/event/event2/v1/entities/PrivacyImport.avsc,${project.basedir}/src/main/resources/demo/imports/event/event1/v5/imports,${project.basedir}/src/main/resources/demo/imports/event/event1/v6/imports
</avro.imports.resources>
{code}
{color:#de350b}Result: Failed to execute goal
org.apache.avro:avro-maven-plugin:1.10.0:schema (avro-events) on project
demo-event: Execution avro-events of goal
org.apache.avro:avro-maven-plugin:1.10.0:schema failed: Undefined name:
"test.v5.PrivacyImport"{color}
*2.* If for necessity of the project we must explicitly specify first in the
order a directory (imports/event/event2/v1/entities), and then different
directories contain a directory with the same name, the plugin excludes these
directories (entities/**) and all their content from processing.
{code:java}
<avro.imports.resources>
${project.basedir}/src/main/resources/demo/imports/event/event2/v1/entities,${project.basedir}/src/main/resources/demo/imports/event/event1/v5/imports,${project.basedir}/src/main/resources/demo/imports/event/event1/v6/imports
</avro.imports.resources>
{code}
{color:#de350b}Result: Failed to execute goal
org.apache.avro:avro-maven-plugin:1.10.0:schema (avro-events) on project
demo-event: Execution avro-events of goal
org.apache.avro:avro-maven-plugin:1.10.0:schema failed: Undefined name:
"test.v5.PrivacyImport"{color}
>From what we have seen, these unexpected behaviors occur because in the
>configuration of the exclusion of files and directories in the
>"*getIncludedFiles()*" method of the *AbstractAvroMojo.java* class, only the
>filename is obtained. For example, if the import settings is:
{code:java}
<avro.imports.resources>
${project.basedir}/src/main/resources/demo/imports/event/event2/v1/entities/PrivacyImport.avsc,${project.basedir}/src/main/resources/demo/imports/event/event1/v5/imports,${project.basedir}/src/main/resources/demo/imports/event/event1/v6/imports
</avro.imports.resources>
{code}
this list of excludes is *{"**/PrivacyImport.avsc", "imports/**, imports/**"}*,
so as explained above in case *1*, the files with the name "PrivacyImport.avsc"
in the directories "demo/imports/event/event1/v5/imports/entitites" and
"demo/imports/event/event1/v6/imports/entitites" will be excluded.
Do you see it convenient to consider that in the exclusions the absolute name
of the file or directory (with the path) is added instead of just the name?
Attached to the issue is a demo application that reproduces the problems
explained.
> avro-maven-plugin unexpected behaviors with import files
> --------------------------------------------------------
>
> Key: AVRO-2942
> URL: https://issues.apache.org/jira/browse/AVRO-2942
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.8.2, 1.10.0, 1.9.2
> Reporter: Fernando Blanch Calvete
> Priority: Major
> Labels: avro-maven-plugin
> Attachments: demo-event.zip
>
>
> * avro-maven-plugin v1.10.0
> * apache avro v1.10.0
> * maven 3.5.4
> We have encountered problems with some file structures and how the avro
> plugin manages the inclusion and exclusion of files in the processing and
> generation of java classes.
> When we specify the order of the files or directories import for the plugin,
> we see mainly two problems that we detail below.
> For the following avro definition structure:
> {code:java}
> ├── imports
> │ └── event
> │ ├── event1
> │ │ ├── v5
> │ │ │ └── imports
> │ │ │ └── entities
> │ │ │ └── PrivacyImport.avsc
> │ │ └── v6
> │ │ └── imports
> │ │ └── entities
> │ │ └── PrivacyImport.avsc
> │ └── event2
> │ └── v1
> │ └── entities
> │ └── PrivacyImport.avsc
> └── sources
> └── event
> └── event1
> ├── v5
> │ └── User.avsc
> └── v6
> └── User.avsc
> {code}
> *1.* If by necessity of the project we must explicitly specify first in the
> order of import a file (PrivacyImport.avsc), and then different directories
> containing a file with the same name, even if their content is different, the
> plugin excludes them from processing.
> {code:java}
> <avro.imports.resources>
>
> ${project.basedir}/src/main/resources/demo/imports/event/event2/v1/entities/PrivacyImport.avsc,${project.basedir}/src/main/resources/demo/imports/event/event1/v5/imports,${project.basedir}/src/main/resources/demo/imports/event/event1/v6/imports
> </avro.imports.resources>
> {code}
> {color:#de350b}Result: Failed to execute goal
> org.apache.avro:avro-maven-plugin:1.10.0:schema (avro-events) on project
> demo-event: Execution avro-events of goal
> org.apache.avro:avro-maven-plugin:1.10.0:schema failed: Undefined name:
> "test.v5.PrivacyImport"{color}
> *2.* If for necessity of the project we must explicitly specify first in the
> order a directory (imports/event/event2/v1/entities), and then different
> directories contain a directory with the same name, the plugin excludes these
> directories (entities/**) and all their content from processing.
> {code:java}
> <avro.imports.resources>
>
> ${project.basedir}/src/main/resources/demo/imports/event/event2/v1/entities,${project.basedir}/src/main/resources/demo/imports/event/event1/v5/imports,${project.basedir}/src/main/resources/demo/imports/event/event1/v6/imports
> </avro.imports.resources>
> {code}
> {color:#de350b}Result: Failed to execute goal
> org.apache.avro:avro-maven-plugin:1.10.0:schema (avro-events) on project
> demo-event: Execution avro-events of goal
> org.apache.avro:avro-maven-plugin:1.10.0:schema failed: Undefined name:
> "test.v5.PrivacyImport"{color}
> From what we have seen, these unexpected behaviors occur because in the
> configuration of the exclusion of files and directories in the
> "*getIncludedFiles()*" method of the *AbstractAvroMojo.java* class, only the
> filename is obtained. For example, if the import settings is:
> {code:java}
> <avro.imports.resources>
>
> ${project.basedir}/src/main/resources/demo/imports/event/event2/v1/entities/PrivacyImport.avsc,${project.basedir}/src/main/resources/demo/imports/event/event1/v5/imports,${project.basedir}/src/main/resources/demo/imports/event/event1/v6/imports
> </avro.imports.resources>
> {code}
> this list of excludes is \{"**/PrivacyImport.avsc", "imports/**,
> imports/**"}, so as explained above in case 1, the files with the name
> "PrivacyImport.avsc" in the directories
> "demo/imports/event/event1/v5/imports/entitites" and
> "demo/imports/event/event1/v6/imports/entitites" will be excluded.
> Do you see it convenient to consider that in the exclusions the absolute name
> of the file or directory (with the path) is added instead of just the name?
> Attached to the issue is a demo application that reproduces the problems
> explained.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)