7

I have a maven java project that I would like to use IntelliJ for development on. One of my favorite navigation features of IntelliJ is the 'go to > implementation' feature that appears when you right click on a method or function.

My problem is that this feature is not working for me; when I choose it nothing happens, no error, it just sits right where it is. It also isn't suggesting functions and methods as I type, so it's as if IntelliJ is failing to recognize dependencies and relationships among the various classes in my project.

I know the code is fine because it compiles and runs, has anyone else experienced this? I made sure to open the project as a maven project using the pom.xml file but that made no difference.

mtk
  • 13,221
  • 16
  • 72
  • 112
Ben
  • 139
  • 1
  • 2
  • 3

7 Answers7

14

Right click on the root folder of your project (Application code folder) and

select -> Mark Directory as -> Sources root

Akhilraj N S
  • 9,049
  • 5
  • 36
  • 42
3

It seems that the index is wrong.You need to force reindex the project files. Just try: File -> Invalidate caches... Then restart your IntelliJ

lihongxu
  • 754
  • 5
  • 14
  • Thanks, but Ishnark's comment on my original post solved the problem for me :-) – Ben Jun 07 '17 at 19:59
3

I had the same issue with idea and i did:

  • "Mark Directory As > Sources Root" not worked.
  • "Invalidating cache and restart not worked"
  • "Deleting .idea and .iml files not worked"

Finally right click on pom.xml and select "add as maven project" worked for me.

2

This is way too broad of a inquiry!

There's a few things that could be wrong but compiling and running has nothing to do with it. Compilers such as maven can generate sources or modify behaviors of compilation units and can be considered non-deterministic programming which because of its very essence, can't be analyzed.

You're referring to a Contextual IntelliSense operation; in the context you're in currently, dependencies etc may not be properly configured. You can't know what you don't know; similarly, Intellij can't either. Make sure all libraries are listed properly within the Project/Global -> Libraries section in order to have them properly function.

Alternatively, your cache could have become corrupted. Try File -> Invalidate Caches / Restart...

Lastly you could simply have the option disabled somehow. There's various settings which will disable the option. For example, Power Save Mode may be enabled. For the rest I suppose it'd be best to refer you to the help documentation.

sh1ftchg
  • 21
  • 1
  • Actually Ishnark's first comment on my above post was exactly the solution I needed... – Ben Jun 07 '17 at 19:58
  • 1
    "Alternatively, your cache could have become corrupted. Try File -> Invalidate Caches / Restart..." - solved my issue – Sanchi Girotra Jun 30 '20 at 12:07
0

Ishnark's comment on my question provided the solution I needed, reposting here so that it can be upvoted and hopefully help others. All I needed to do was right click on the source root of the projecet and select "Mark Directory As > Sources Root". More details here:

solution

Ben
  • 139
  • 1
  • 2
  • 3
0

In my case the problem was the next: for some reasons *.py files were registered as a text files, not python ones. After I changed it, code completion started to work again.

To change file type go Preferences -> Editor -> File types -> add *.py into Python again.

comment from: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360005050480-Cannot-find-declaration-to-go-to-solved-

Galley
  • 493
  • 6
  • 9
-1

GO TO File>New>Project From Existing Source then choose you're project

let maven build you're project again.

saba
  • 332
  • 2
  • 14