Hey Guys. So… I have a question, I’ve been trying to solve this for hours and can’t seem to find a straight answer anywhere. I’m not used to using gradle or maven, but I got my project set up and all is well, except for the fact that auto-completion does not pop up for any of the gradle libraries/dependencies and it’s starting to become quite the bit frustrating. Has anyone else encountered this issue. I’ve tried re-importing the project, Invalidating The Cache, Some Groovy DSL script and nothing is working. If I add a library manually to the project I have the auto-completion for that but not for Gradle Libraries.
I’ve searched through the forums here as well, but I couldn’t find an answer either. Thanks in advance for any help.

Thanks for the reply.
Sure, So I think I sort of figured it out, The libraries are in my projectName_main module but not in my projectName module. I’m not sure why it’s done that, when I created the directory to be the root source I thought the libraries would still be in it’s scope.
This is What I am getting from all the Gradle Libraries
https://i.imgur.com/GqnRzTS.png
This is what I expect from all my libraries
https://i.imgur.com/zWou5GV.png
This is what I discovered
https://i.imgur.com/Ynuxcv0.png
I am not sure what I did wrong for the libraries to be sent to another module. I’ve seen you around and I’m guessing you have some decent knowledge of IntelliJ, any ideas? I think I can just copy the libraries over into the other module and then invalidate the cache, but I feel like I could have avoided doing something to not have to do this in the first place.
Regards,
cur
Sorry If I’m not being very clear, I haven’t slept in two days. And I’m busy running errands in the city.
So what I want I guess is for all the libraries to be picked up by the intellisense, so when I’m spreading out lines of code I can finish them quickly . In this case Gradle libraries are not appearing in the intellisense menu that pops up while I’m typing.
My build.gradle is accurate, everything works fine and all configurations are as should be , I did the sponge plugin tutorial word for word and actually I had to redo it because I had some trouble when pushing it from one of my computers to git. I dont use GitHub, I have a private gitlab repo on one of my servers. I think where I got lost is a gap between building the project and starting to code.
When I was writing code I realized that I couldn’t get intelliJ to create a package and it wouldn’t let me make class files in the src directory I had made for the source, so I marked the source folder I made as the “root source” so I could create packages and class files. And it seems that inside of this root is considered a different module because code inside of it can’t access the indexed intellisense data of things in the projectname_main module that Gradle creates.
I appreciate your help and I will take a look at those links when I get home and try to compare and see if I can find where I went wrong using the cook book.
I hope this helps explain my problem more clearly, I can be extremely vague or too specific sometimes.
PS. There might be some redundancies in what I wrote, very tired , sleep deprivation is worse than vodka.
Wait… so you can compile, and no errors pop up, but the auto complete function simply doesn’t work… how odd.
Yeah it’s pretty weird, but I think I got this figured out for now, gonna look at those templates. Also this is a fresh install of IntelliJ (Latest Version - Always Updating) on a fresh install of W10 on a brand new rig, I’m sure I just missed something somewhere, It should be using the main module anyways, also if it builds and compiles using the module that has the dependencies then most likely it wouldn’t have a reason to throw errors.
When I was writing code I realized that I couldn’t get intelliJ to create a package and it wouldn’t let me make class files in the src directory I had made for the source, so I marked the source folder I made as the “root source” so I could create packages and class files.
Big problem here: When you use Gradle with IntelliJ, never change your project structure in IntelliJ except by changing it in Gradle and refreshing the project. To reset the project structure in IntelliJ to that of Gradle, open the Gradle tool window and click Refresh.
The main problem is that your code isn’t in the place where Gradle (and, based on that, IntelliJ) is looking for it. By default, Gradle stores your code in src/main/java
, not simply src
. Move your code there, then refresh the Gradle project structure (see above).
A side note: Only Java code lives in src/main/java
. All non-Java files that you want to add to your project (such as mcmod.info
) go in src/main/resources
.
2 Likes
Thank you very much, this is the bit of information that I was missing.
http://farm4.static.flickr.com/3052/2446121813_677f50db59.jpg
1 Like