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

Intellij support #520

Closed
mdeinum opened this issue Mar 27, 2015 · 12 comments
Closed

Intellij support #520

mdeinum opened this issue Mar 27, 2015 · 12 comments

Comments

@mdeinum
Copy link

mdeinum commented Mar 27, 2015

Would be nice if there would also be IntelliJ IDEA support.

JetBrains issue is IDEA-138364 add some votes then it might be picked up.

@agudian
Copy link
Member

agudian commented Mar 27, 2015

Great, thanks for opening up that issue in the JetBrains tracker. I've placed my vote. 👍

We already have an Eclipse plugin in the works (with code-completion for source/target, more features to come).

In case JetBrains doesn't create such a plugin, maybe you'd like to bootstrap one yourself here with us?

@krishna81m
Copy link

We see an issue with Tomcat plugin, it packages all generated resources correctly in right package in WAR but when doing a local debug, these generated sources are not available. This is only with IntelliJ. Is anybody aware of this issue?

The obvious hack is to add the generated sources class to the plugin classpath.

@thekalinga
Copy link

After migrating to the latest versions of lombok & mapstruct, intellij throws duplicate class error.

Here are the steps to reproduce the error.

  1. Run ./gradlew clean compileJava from terminal
  2. Debug spring boot application from Intellij

You would get a duplicate class error.

This is because intellij is creating its own version of generated source under build/classes/main/generated, but the gradle plugin (from terminal) is generating the same source under build/generated/ & registering this path as a source in intellij.

This is causing Intellij to find another class with the same name under the same package when it tries to compile, so it bailing out saying there is a duplicate class.

Temp work around for this problem is to do a ./gradlew clean & dont run gradle compileJava task from terminal.

Now if you try to debug, intellij will continue to generate the source in its default location & since we dint run compileJava from terminal, it finds only one source in its source paths.

@filiphr
Copy link
Member

filiphr commented Mar 14, 2017

@thekalinga this looks like a problem with your IntelliJ setup (or a bug in IntelliJ). Check your settings under Build, Execution, Deployment -> Compiler -> AnnotationProcessors

For me with Maven and the IntelliJ 2017.1 EAP (171.3780.15) it works.

@thekalinga
Copy link

I'm using IntelliJ IDEA 2016.3.5, not EAP. Not sure if this the culprit/there is an issue with gradle builds.

@filiphr
Copy link
Member

filiphr commented Aug 9, 2017

I have started working on a plugin for IntelliJ. mapstruct-idea is the name of the repository that you can watch and create issues for.

The plugin is not yet published as it is WIP. Currently there is only support for autocompletion for componentModel and rudimentary auto-completion and go to declaration for source and target. Feel free to open issues there with suggestion about what you want to see in the plugin.

@gimoh
Copy link

gimoh commented Aug 14, 2017

@filiphr what should the settings under Build, Execution, Deployment -> Compiler -> AnnotationProcessors be? I've enabled annotation processing in there, but it didn't seem to make a difference

do you also need to have builds delegated to Gradle in Build, Execution, Deployment -> Gradle -> Runner? (that seems to work for me although it's a bit slower)

@filiphr
Copy link
Member

filiphr commented Aug 14, 2017

@gimoh I don't understand what you mean. If you are talking about IntelliJ invoking the annotation processing with Gradle, then yes you need to delegate the build to Gradle in order to do that.

We are planning to update the website to put some more information about IntelliJ and Gradle integration. Have a look at mapstruct/mapstruct.org#63

@gimoh
Copy link

gimoh commented Aug 16, 2017

@filiphr OK, I get it now, I thought that if you enable annotation processing in IntelliJ (Build, Execution, Deployment -> Compiler -> AnnotationProcessors) you don't need to delegate to Gradle

If you are delegating to Gradle, does annotation processing still need to be enabled in IntelliJ?

@filiphr
Copy link
Member

filiphr commented Aug 16, 2017

@gimoh if you are delegating to Gradle, the enabling of annotation processing in IntelliJ does nothing as IntelliJ will use Gradle to compile your code.

Enabling annotation processing in IntelliJ can theoretically work if you don't use the apt plugin, and you define the dependency in such way that IntelliJ can pick it up and see the processor.

@filiphr
Copy link
Member

filiphr commented Sep 19, 2017

I am happy finally close this issue 😄.

We have released our plugin the the Jetbrains repository. Here is a link to our announcement and here is the link to the plugin.

Give it a go and feel free to give us feedback and suggestions into its own repository at mapstruct-idea

@filiphr filiphr closed this as completed Sep 19, 2017
@lex-em
Copy link

lex-em commented Sep 25, 2017

it is awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants