Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to compile generated code. #569

Open
martijnhoekstra opened this issue Aug 28, 2021 · 1 comment
Open

Fails to compile generated code. #569

martijnhoekstra opened this issue Aug 28, 2021 · 1 comment

Comments

@martijnhoekstra
Copy link

The xsd at https://gist.github.com/martijnhoekstra/a51fe75de6b84c8ea6790d30e316fc45 (which was generated with trang from https://www.unicode.org/reports/tr42/tr42-28.rnc) fails to compile with

path/to/generated/xmlprotocol.scala:178:36: type mismatch;
[error]  found   : List[scalaxb.DataRecord[Any]]
[error]  required: Seq[scalaxb.DataRecord[generated.RepertoireOption]]
[error]       unicode.generated.Repertoire(p1) })
@hhalex
Copy link

hhalex commented Oct 1, 2021

Hello,

I have a similar issue with this XSD file Sepa Direct Debit pacs.003.001.02

I setup a new project using the template gitter: sbt new eed3si9n/scalaxb.g8 and I put the linked XSD file in src/main/xsd.

I run sbt compile and the generated files won't compile:

❯ sbt compile
[info] welcome to sbt 1.5.0-M2 (Amazon.com Inc. Java 15.0.1)
[info] loading global plugins from /home/alexandre/.sbt/1.0/plugins
[info] loading settings for project sepa-xml-codec-build-build-build from metals.sbt ...
[info] loading project definition from /home/XXXXXXXXXXXX/side_projects/sepa-xml-codec/project/project/project
[info] loading settings for project sepa-xml-codec-build-build from metals.sbt ...
[info] loading project definition from /home/XXXXXXXXXXXX/side_projects/sepa-xml-codec/project/project
[success] Generated .bloop/sepa-xml-codec-build-build.json
[success] Total time: 1 s, completed 1 oct. 2021 à 12:11:41
[info] loading settings for project sepa-xml-codec-build from metals.sbt,plugins.sbt ...
[info] loading project definition from /home/XXXXXXXXXXXX/side_projects/sepa-xml-codec/project
[success] Generated .bloop/sepa-xml-codec-build.json
[info] compiling 1 Scala source to /home/XXXXXXXXXXXX/side_projects/sepa-xml-codec/project/target/scala-2.12/sbt-1.0/classes ...
[info] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.13. Compiling...
[info]   Compilation completed in 5.211s.
[success] Total time: 6 s, completed 1 oct. 2021 à 12:11:48
[info] loading settings for project root from build.sbt ...
[info] set current project to sepa-xml-codec (in build file:/home/XXXXXXXXXXXX/side_projects/sepa-xml-codec/)
[info] Executing in batch mode. For better performance use sbt's shell
generated /home/XXXXXXXXXXXX/side_projects/sepa-xml-codec/target/scala-2.13/src_managed/main/sbt-scalaxb/generated/EPC301-07_2019_V1.0_pacs.003.001.02.scala.
generated /home/XXXXXXXXXXXX/side_projects/sepa-xml-codec/target/scala-2.13/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala.
generated /home/XXXXXXXXXXXX/side_projects/sepa-xml-codec/target/scala-2.13/src_managed/main/sbt-scalaxb/scalaxb/scalaxb.scala.
[info] compiling 3 Scala sources to /home/XXXXXXXXXXXX/side_projects/sepa-xml-codec/target/scala-2.13/classes ...
https://repo1.maven.org/maven2/org/scala-sbt/compiler-bridge_2.13/1.5.0-M3/compiler-bridge_2.13-1.5.0-M3.pom
  100,0% [##########] 2,7 KiB (6,6 KiB / s)
[info] Non-compiled module 'compiler-bridge_2.13' for Scala 2.13.6. Compiling...
[info]   Compilation completed in 5.281s.
[error] /home/XXXXXXXXXXXX/side_projects/sepa-xml-codec/target/scala-2.13/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:690:46: type mismatch;
[error]  found   : scalaxb.DataRecord[String]
[error]  required: scalaxb.DataRecord[generated.DocumentType3Code]
[error]       generated.CreditorReferenceType1Choice(p1) })
[error]                                              ^
[error] /home/XXXXXXXXXXXX/side_projects/sepa-xml-codec/target/scala-2.13/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:706:81: type mismatch;
[error]  found   : scalaxb.DataRecord[String]
[error]  required: scalaxb.DataRecord[generated.DocumentType3Code]
[error]       generated.CreditorReferenceType1Choice_EPC301u4507_SDD_B2B_IB_2019_V1u460(p1) })
[error]                                                                                 ^
[error] two errors found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 9 s, completed 1 oct. 2021 à 12:11:59

Scala version: 2.13.6
Sbt: 1.5.0-M2

Thanks for the hard work 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants