AxonFramework / AxonFramework

Framework for Evolutionary Message-Driven Microservices on the JVM
https://axoniq.io/
Apache License 2.0
3.34k stars 795 forks source link

Various issues when importing Axon in Eclipse #2865

Open nils-christian opened 1 year ago

nils-christian commented 1 year ago

Hi,

This was originally part of #2855, but I think this deserves an own issue. The described issues occur when importing the current axon-4.8.x branch, but the basic problems should be viable for the main branch as well.

If I open the current axon-4.8.x branch in Eclipse, I am already greeted by two compile errors:

image

Not sure why. The project itself is recognized by Eclipse as JDK8 project.

This already makes it difficult if not impossible to develop anything.

Now I would try and perform a local "mvn install" with skipped tests, so that I can build the project as fast as possible and close the problematic modules (which works fine, as long as I don't want to develop within the modules with the compile errors).

If one does not have the modules already in the local maven repository, this fails:

image

Now I have only one chance - to build the project with enabled tests. This, by the way, forces me already to have a docker environment and everything. So I try a "mvn install" without skipping the tests. If one of the tests fails, I am out of luck. I guess I could make sure that surefire continues after a fail, but...well...

image

At least when using Eclipse, the hurdle to develop for the Axon framework is rather high. I know, I have provided PRs in the past, but to be honest, due to this issues this has become rather cumbersome.

We usually have a quick-install maven profile in our builds which allow to build the project very quickly without running the tests or additional checks.

Best regards

Nils

smcvb commented 1 year ago

Thanks for filing this with us, @nils-christian.

I'm afraid I can't get this resolves or looked at right away, but will try to soon. That would, likely, make it a change we introduce in Axon Framework 4.9.1. As such, I've set the milestone to "Release 4.9.1".

smcvb commented 11 months ago

So, I've spent some time on this yesterday and today, so I have some feedback on the subject.

If I open the current axon-4.8.x branch in Eclipse, I am already greeted by two compile errors: Not sure why. The project itself is recognized by Eclipse as JDK8 project.

After installing Eclipse on my laptop (I'm a Linux user btw), I opened the Axon Framework project to check whether I would get the same exception. The referred to compile errors do not pop up, however...

So, perhaps it's a version thing? Honestly, I haven't used Eclipse since university, so this may be a stupid suggestion. But, nonetheless, which version are you using, @nils-christian? Maybe I can reproduce it if I try to run the same.

Now I would try and perform a local "mvn install" with skipped tests, so that I can build the project as fast as possible and close the problematic modules (which works fine, as long as I don't want to develop within the modules with the compile errors).

Axon Framework's modules have test dependencies on one another for certain utilities. Especially with the split between Spring Boot 2 and Spring Boot 3, it saved us tons of duplication.

Granted, I would prefer these to be collected in a dedicated module. However, we're not there, so sharing is our best bet.

So, the build can skip the tests, but should still build the test code.

We usually have a quick-install maven profile in our builds which allow to build the project very quickly without running the tests or additional checks.

This made sense to me actually, so I added a quick-install profile (in this commit), which sets skipTests to true.

smcvb commented 11 months ago

To give some additional clarity on the above. I would still want to investigate why Axon Framework doesn't open up as intended in Eclipse. In the meantime, if you could share whether the profile (however simple) already helps a little, that would be great, @nils-christian :pray:

nils-christian commented 11 months ago

Hi @smcvb,

First of all: Thank you for taking the time to look into this issue.

So, I checked out Axon (revision 4deda0cd67cd9aa3e89dc85b39c6e6c42d0d7e1a) and installed a new Eclipse with the following version:

Eclipse IDE for Java Developers (includes Incubating components)
Version: 2023-12 (4.30.0)
Build id: 20231201-2043
OS: Windows 10, v.10.0, x86_64 / win32
Java vendor: Eclipse Adoptium
Java runtime version: 21.0.1+12-LTS
Java version: 21.0.1

I removed all Axon dependencies from my local Maven repository, imported the project into Eclipse and performed a full build via build automatically. The compiler shows four errors:

image

I do agree however, that the same issues to not appear in IntelliJ (or in a Maven build), so this seems to be an issue entirely with Eclipse's internal compiler (JDT). Taking a look at the bug list from JDT, it seems that there are indeed issues regarding generics, especially when raw/wildcard and actual generics are mixed. If I change the signature of EventBusSpanFactory.propagateContext from accepting EventMessage\<T> to EventMessage\<?>, the error is resolved. Very weird behaviour of JDT. I am not sure what should be done about this. It seems wrong (and not very feasible regarding the maintainability) to change the code in any way just to work around a bug of the JDT.

I also tested the quick install profile by running "mvn install --activate-profiles quick-install". A lot of tests are skipped in this run, but not the one in spring-boot-3-integrationtest. Those also fail if the system does not provide a running Docker environment.

I hope this helps.

Best regards

Nils

smcvb commented 11 months ago

Awesome feedback, @nils-christian: this is very helpful.

I'll make adjustments to the profile to ensure it does not pick up the spring-boot-3-integrationtest module. And, check whether I have missed skipping any other tests too.

Concerning the JDT of Eclipse, that's a bummer, actually. Do you, perchance, have the issue reference at hand for Eclipse? It would be nice to collect that info in this issue so that other readers can check it out.

nils-christian commented 11 months ago

Hi @smcvb,

It is a little bit tricky to point to a single issue. Just searching for generics and wilcards in the bug list (https://bugs.eclipse.org/bugs/buglist.cgi?quicksearch=generics%20wildcards) or the specific error message (https://bugs.eclipse.org/bugs/buglist.cgi?quicksearch=Cannot%20infer%20type%20arguments) reveals various issues. A lot of them are also a little bit older without any activity.

Best regards

Nils