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

Contextmapper generator crash when generating plantuml for contextmap with an imported bounded context file. #364

Open
rerunner opened this issue Nov 25, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@rerunner
Copy link

rerunner commented Nov 25, 2024

Describe the bug
The contextmapper cli crashes when asked to generate plantuml files for a contextmap which includes an import of another CML file. That other CML file contains the bounded contexts implementing the domains.

To Reproduce
Steps to reproduce the behavior:

  1. As a simple test to isolate the problem I reproduced this issue using the CML "example" code shown on the ContextMapper website in https://contextmapper.org/docs/imports/. It uses two files, a ContextMap.cml and a BoundedContexts.cml file.
  2. Run the command "cm generate -g plantuml -i ContextMap.cml -o src-gen"

Expected behavior
No crash and plantuml files for the aggregate and entities as well.

Screenshots / Exceptions
Context Mapper CLI v6.12.0
Exception in thread "main" java.lang.IllegalArgumentException: resolve against non-hierarchical or relative base
at org.eclipse.emf.common.util.URI$Hierarchical.resolve(URI.java:3548)
at org.eclipse.emf.common.util.URI.resolve(URI.java:5580)
at org.contextmapper.dsl.cml.CMLImportResolver.resolveImportedResources(CMLImportResolver.java:42)
at org.contextmapper.dsl.cml.CMLModelDomainAndSubdomainResolver.initAllDeclaredSubdomainsIncludingImportedOnes(CMLModelDomainAndSubdomainResolver.java:87)
at org.contextmapper.dsl.cml.CMLModelDomainAndSubdomainResolver.(CMLModelDomainAndSubdomainResolver.java:38)
at org.contextmapper.dsl.generator.PlantUMLGenerator.generateFromContextMappingModel(PlantUMLGenerator.java:61)
at org.contextmapper.dsl.generator.AbstractContextMappingModelGenerator.doGenerate(AbstractContextMappingModelGenerator.java:54)
at org.contextmapper.dsl.standalone.StandaloneContextMapper.callGenerator(StandaloneContextMapper.java:61)
at org.contextmapper.cli.commands.GenerateCommand.run(GenerateCommand.java:55)
at org.contextmapper.cli.ContextMapperCLI.run(ContextMapperCLI.java:59)
at org.contextmapper.cli.ContextMapperCLI.main(ContextMapperCLI.java:44)

Input files to reproduce
See attached.
BoundedContexts.cml.txt
ContextMap.cml.txt

IDE and Plugin (please complete the following information):

  • Context Mapper CLI v6.12.0
  • Visual studio Context Mapper v6.12.0

Additional context
The visual studio plugin does not crash, however it only produces one plantuml file for the contextmap and does not produce any plantuml output for the aggregate/entities. Hence, it seems to fail parsing the imported file.

@rerunner rerunner changed the title Contextmapper CLI crash when generating plantuml for contextmap with an imported bounded context file. Contextmapper generator crash when generating plantuml for contextmap with an imported bounded context file. Nov 28, 2024
@stefan-ka stefan-ka added the bug Something isn't working label Dec 19, 2024
@stefan-ka
Copy link
Member

Thanks for reporting it @rerunner! We will try to reproduce and investigate...

Best regards,
Stefan

@astmuc
Copy link

astmuc commented Dec 19, 2024

@stefan-ka

The crash can be fixed with
line 55 in GenerateCommand
CMLResource cmlResource = cmAPI.loadCML( URI.createFileURI( new File(inputPath).getAbsolutePath() ).toString() );

I have a branch prepared which

  • changes the global scope provider (reason for plantuml diagram showing only "null" as name)
  • changes the reference validation for domain objects in workbench context. Import files will validate now, if the context-map exists in the same project.

I started the branch for the last topic and discovered that this issue is connected. Problem is, my branch started on a merge of pull request #366 and touches not only this issue.

@rerunner
Copy link
Author

I'm currently enjoying holidays without computer besides my phone, I can try what @astmuc mentioned, but only in 2 weeks from now. Have a good change of the year!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants