-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Converter implementation is not refreshed in IDEA #13
Comments
@ThanksForAllTheFish I don't think that this is linked to the IntelliJ plugin. In any case, can you check that the generated class contains the new mapping? It might be possible that IntelliJ does not invoke the processor when you change some of the other classes. Have you tried delegating the build to gradle? |
It seems you are actually right:
|
Did you have a chance to look at this? |
@ThanksForAllTheFish I have actually had a look into this. Unfortunately, I am not entirely sure if we as a plugin can do something about this. The reason why you are seeing that behaviour is due to the way that compilation works in IDEA. IDEA Only compiles the classes that have been changed since the last build, and when you change I as well am not that well knowledgeable of the internals of IDEA and if someone has an idea or is willing to help out with this I am more than happy to tag along. I've asked on twitter, let's see if we get some more info |
Any news on this topic? This keeps happening |
@lvalladares the status from my previous comment has not changed. I don't know the internals of IDEA that well in order to know what we can do about this. |
Manually recompiling the Mapper interface will regenerate the mapper implementation too. But this is also not the expected way to do it. There is the possibility to listen on file changes and handle them, i used that in a plugin. But that would be low level on the file system api and not the best way for this use case. The change on the java class reflected in the psi tree would be the point i would start to look at. Maybe there is something in the api that can track the link between the annotated mapper interfaces (any used bean type in it) and the beans that are changed in structure. |
I agree with all you said @mkrumpholz. I've tried looking into this, and I would want to avoid listening on any changes. In my opinion this is the job of the IDE. It should track from where a file was generated and then update recompile the mapper. This is what Eclipse and Gradle does for their incremental compilation. |
IDEA keeps track of the changed files, the thing to search and implement may be a trigger to add dependent files to the changelist. I can't provide the code for this as i didn't implement such case yet. Maybe the docs are good enough now to find some more hints on how to implement this? The custom language plugin may be a good starting point as such plugins will go deeper into the wohle apis of IDEA. |
Has anyone found any workarounds other than editing the mapper to force an update? |
Using https://github.com/mapstruct/mapstruct-examples/tree/master/mapstruct-lombok as a reference, I tried to add a field to both
Source
andTarget
and then modified the test to cover the new field.However this leads to the test to fail, being
t.getField()
stillnull
.Another relevant change I did (which I am not sure about) is to add
mapstruct-processor
to thecompile
configuration inbuild.gradle
, ie:compile "org.mapstruct:mapstruct-jdk8:${mapstructVersion}", "org.mapstruct:mapstruct-processor:${mapstructVersion}", "org.projectlombok:lombok:${lombokVersion}"
as per http://mapstruct.org/documentation/ide-support/Also removing a field from both objects leads to an error, this time a
java.lang.NoSuchMethodError
.Versions used:
The text was updated successfully, but these errors were encountered: