Comments (10)
Has anyone found any workarounds other than editing the mapper to force an update?
from mapstruct-idea.
It seems you are actually right:
- if I change the mapper, the generated implementation (
SourceTargetMapperImpl
) is updated - if I change source and target classes, the mapper is NOT updated
- delegating to gradle, the implementation is updated either way (but since IDEA 2017.2 gradle and IDEA output directories are different, it probably makes sense to use gradle-idea plugin as well so to be able to configure source sets correctly)
from mapstruct-idea.
@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 Source
or Target
only then SourceTargetMapper
won't be compiled. Maybe we need to raise an issue with Jetbrains.
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
from mapstruct-idea.
@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?
from mapstruct-idea.
Did you have a chance to look at this?
from mapstruct-idea.
Any news on this topic? This keeps happening
from mapstruct-idea.
@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.
from mapstruct-idea.
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.
from mapstruct-idea.
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.
from mapstruct-idea.
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.
from mapstruct-idea.
Related Issues (20)
- java.lang.ClassCastException: Object of type Address can't be cast to CompositeTracker HOT 1
- Support the '-Amapstruct.unmappedTargetPolicy' config of maven-compiler-plugin HOT 1
- Rework `@InheritConfiguration` and support auto-inheritance
- Fix build with ideaVersion `LATEST-EAP-SNAPSHOT` HOT 3
- Fix workaround for getting the mockJDK annotations.jar in the gradle build HOT 1
- Code completion doesn't work with lombok @SuperBuilder annotation HOT 3
- Unmapped target properties warning is missing if source is a Java record HOT 5
- Auto completion for InheritConfiguration#name, InheritInverseConfiguration#name HOT 1
- Disable unmapped target property warnings when implicitly mapping from a map HOT 2
- Completion for properties don't work (both target and source) HOT 2
- Array and Map paramter ignored as source-parameter if used as only source
- Java expression HOT 1
- Report Non-existing target properties as errors HOT 1
- WrongUsageOfMappersFactoryInspection ignores if componentModel is defined in MapperConfig HOT 1
- IDE Support of `BeanMapping#ignoredTargets`
- Code Completion didn't work well. HOT 12
- Wrong usage of mappers factory should be able to remove static initializer
- code wraps automatically, does not recognize keywords HOT 1
- Incompatible with idea 2024.1 RC HOT 4
- Plugin reports "Can't find related attribute" warning when using `source="."` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapstruct-idea.