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

Christophe Le Saec commented on AVRO-3805:
------------------------------------------

I mean, with a config like 
{code:xml}
            <plugin>
                <groupId>org.apache.avro</groupId>
                <artifactId>avro-maven-plugin</artifactId>
                <version>1.11.2</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>schema</goal>
                        </goals>
                        <configuration>
                                <imports>
                                        
<import>${project.build.directory}/generated-sources/openapi/DocumentInfo.avsc</import>
                            </imports>
                            
<sourceDirectory>${project.build.directory}</sourceDirectory>
                            
<outputDirectory>${project.build.directory}/generated-sources/openapi/src/gen/java/main</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
{code}
it should work ? (_may be you would have to put output directory as 
`openapi/src/main/java` to be more maven standart_)
(indeed, if you put all files in "import", it will lead to the same issue)



> Unable to generate AVRO classes with Java source generated from OpenAPI Yaml 
> file
> ---------------------------------------------------------------------------------
>
>                 Key: AVRO-3805
>                 URL: https://issues.apache.org/jira/browse/AVRO-3805
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.11.2
>            Reporter: Tom
>            Priority: Minor
>         Attachments: demo.zip
>
>
> I was unable to generate AVRO classes when using OpenAPI yaml file to 
> generate the source code for avro-maven-plugin
> [INFO] BUILD FAILURE
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  9.450 s
> [INFO] Finished at: 2023-07-19T14:16:26-04:00
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal 
> org.apache.avro:avro-maven-plugin:1.11.2:schema (default) on project demo: 
> Execution default of goal org.apache.avro:avro-maven-plugin:1.11.2:schema 
> failed: Undefined name: "model.DocumentInfo" -> 
> This occurs when an array is specified In the OpenAPI yaml file as a property 
> of an object, for example
> documents:
> type: array
> items:
> $ref: '#/components/schemas/DocumentInfo'
>  
> If that was commented out, then proper AVRO classes will be generated.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to