ContextMapper / context-map-discovery

A Reverse Engineering Library to Generate CML Context Maps from Existing Source
Apache License 2.0
14 stars 6 forks source link

Unable to run the sample project with the given steps #13

Open ravindrasubedi opened 2 years ago

ravindrasubedi commented 2 years ago

I have followed the steps to run the given example. However I am getting below error :

15:03:03.939 [main] WARN org.reflections.Reflections - given scan urls are empty. set urls in the configuration Exception in thread "main" java.lang.IllegalArgumentException: The Context Map must at least contain one Bounded Context to be serialized! at org.contextmapper.discovery.ContextMapSerializer.serializeContextMap(ContextMapSerializer.java:42) at com.tcs.isn.LakesideMutualContextMapDiscoverer.main(LakesideMutualContextMapDiscoverer.java:48)

stefan-ka commented 2 years ago

Hi @ravindrasubedi

Have you removed the spring-boot-maven-plugin plugin from the POM's before you installed the backends to your local maven repository as described in the note in step 2?

I know this is an ugly workaround. But the reflections library does not find the classes for Spring Boot JARs automatically because of the BOOT-INF folder.

Also maybe try it with the new release 1.4.0 (I updated the reflections library). However, the workaround above is still needed.

Best regards, Stefan

ravindrasubedi commented 2 years ago

Hi @stefan-ka

Yes, I had already tried removing 'spring-boot-maven-plugin' from the pom.xml files. No luck even after upgrading to 1.4.0.

Regards, Ravindra

stefan-ka commented 2 years ago

Interesting. I reproduced the steps and it works for me. Which Java version are you using @ravindrasubedi?

ravindrasubedi commented 2 years ago

@stefan-ka I am using JDK 1.8

stefan-ka commented 2 years ago

@ravindrasubedi Okay, I'm on Java 11 now. Does it have to be Java 8? :)

j-ruch commented 1 month ago

Dear @stefan-ka

I would like to follow up on this open issue. I'm currently working on LakesideMutual and wanted to try out the discovery function of your Context Mapper. I followed the detailed steps in your README but the discovery function is failing, but with a different error message than @ravindrasubedi experienced.

My system:

My Procedure: I cloned the LakesideMutual project and this context-mapper-discovery project. I tried to build it with gradle but it did not build correctly on my machine, I received the following issue:

image

Now I'm by no means an expert in gradle, I tried to resolve the following issue by adding an additional repository to your gradle build file according to the official gradle central websites: https://docs.gradle.org/current/userguide/declaring_repositories.html https://plugins.gradle.org/plugin/org.ajoberstar.grgit/3.1.1

The resulting code snippet from the gradle file is:

repositories { maven { url = uri("https://plugins.gradle.org/m2/") } }

Now the issue kept coming up, that is why I turned to an extra maven project. I attach you both files such that you can see what I have configured. You will have to rename them to .java and .xml on your machine.

The resulting Java class: ExampleContextMapDiscoverer.txt

The resulting pom file: pom.txt

I removed the Spring Boot Maven Plugin from each backend project and build them all with mvn clean install and then executed the ExampleContextMapDiscoverer main class above. The stacktrace which I receive when running this setup is in this file: stacktrace.txt

The stacktrace mentions that multiple slf4j bindings were found, I have removed to URLs because they contain paths from my personal machine. The question arises, might these bindings be the problem? The actual error seems to come from a google library. Is it possible that this library was added later on in the project and might mess with the reflections mechanism?

In case you need further details feel free to contact me. Thanks a lot and kind regards Jan

stefan-ka commented 1 month ago

Hi @j-ruch

Should be fixed now ;) Could you check whether it works for you as well? The problem were just some outdated dependencies in the Gradle build; we haven't touched the project for a while.

Best regards, Stefan

j-ruch commented 1 month ago

Hi @stefan-ka thanks a lot for the quick support! I still have some problems, but maybe these occur due to my setup or missing knowhow with gradle...

I performed the following actions:

  1. Pull the latest changes
  2. Build the main context-map-discovery project with OpenJDK 20 and Gradle 8.10 --> Success
  3. Build the inner LakesideMutual Example project with OpenJDK 11 and Gradle 5.2.1 --> Failure

The file 'gradle-wrapper.properties' in the inner LakesideMutual Example project contains the following line:

distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip

IntelliJ automatically installed the correct, pre-defined JDK via built-in Amazon Corretto JDK. The build worked out fine. But I received the following error while executing the main class 'LakesideMutualContextMapDiscoverer'

image

I assumed that there might be a problem with the built-in JDK 11 and switched to OpenJDK 20 back again. I had to update Gradle to 8.10. I saw that you changed the ''gradle-wrapper.properties in the outer project. Thus I changed it to the latest gradle release in the inner 'gradle-wrapper.properties':

distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip

This update led to a new issue (see stacktrace attachement):

stacktrace.txt

I had to update the 'gradle.build' file to use a new specification for the JDK and remove the force attribute for the mime pull dependency. (see file attachement with the new build file, change the file ending to .gradle again)

build.txt

Then the build worked with a JDK20 and Gradle 8.10. But when starting the main class 'LakesideMutualContextMapDiscoverer' I received the following exception:

exception.txt

stefan-ka commented 1 month ago

Hi @j-ruch

Sorry, I totally forgot about the LakesideMutual example. I updated Gradle now and for me, at least with Java 11, it seams to work again. The main() still fails with some formatting exceptions but at least it produces a CML-file. Sorry, thats what I can do today... There are still issues to be solved for newer Java versions and with the CML formatting. But maybe you can also generate a CML file now?

Best regards, Stefan

j-ruch commented 1 month ago

Hi @stefan-ka It worked just like you explained, I also receive the CML files and an issue in the console. I guess you could close this issue...

It would be great if you would find the time to fix the setup entirely somewhen. In case you need any further help, you can send me a message to verify it on my end. Thanks again for the great support, big thumbs up 👍