Gradle Repo Directory referenced in Project

Hello,

I used the Maven mechanism in IntelliJ Idea and the support is very convinient. I can download the JARs from Maven Central and IDEA puts the downloaded Library directly in into the Modules Library path, so I can compile my Java Source.

Now, I would like to use Gadle. Grald comes with its own repository and stores the downloaded JAR files  within the cache folder. Now I can run the gradle build but IDEA don't add the JARS automatically to the mdoule library folder. So I have to manually add all downloaded JARS files to the library project settings, so I can do my java source code creation.
I created a PATH Library which points to the Gradle root repository like this:

GRADLE_REPO = /Users/tadeusz/.gradle/caches/modules-2/files-2.1/*

So in this folder it contains all subdirectories which contains the source, java-doc and binary JAR files that have been downloaded by Gradle as defined deindependencies in my build.gradle file.

So I don't wanto to add manually all the jars files I defined as dependencies in my build.gradle file when I build my module. I would like to have the same comfort like with the maven integration.

Does anyone have already experience or a solution how I may use the Path library in order to archive this or another solution?

Kind regards.
Tadeusz

9 comments
Comment actions Permalink

All the dependencies listed in Gradle build file will be added to IntelliJ IDEA Module Dependencies automatically when you Import a Gradle project.

You don't need to configure any jars manually when working with a Gradle based project in IntelliJ IDEA.

0
Comment actions Permalink

Hello,

Thank you very much. How does it work when I created a gradle module by myself? I created the gradle module but what do I have to do get the downloaded JARs files added to my Module when I run the build.gradle file the first time?

Kind regards.
Tadeusz

0
Comment actions Permalink

Import build.gradle in IDEA, edit the file, specify the dependencies you need, then Refresh in Gradle Tool window.
See https://www.jetbrains.com/idea/help/working-with-gradle-projects.html for details.

0
Comment actions Permalink

Hello,

What you descirbed worked perfectly for an imported gradle porject from github. However for my created gradle module I don't know how to open the Gradle Tool Window.
IDEA does offer me the Grald Tool Window using the option described here: https://www.jetbrains.com/idea/help/manipulating-the-tool-windows.html#d1187816e113

I'm confused because in Eclipse I can just open any view and any perspective by using a the menu. In IDEA I don't get provided all available Tool windows or at least I don't know how to open them and the help doesn't provide any information on this or I can't find it.

Could you please help me (I'm also quite new to IDEA) and tell me what I have to do when I don't see or get offered to open the Gradle Tool Window?

Kind regards.
Tadeusz

0
Comment actions Permalink

Hello,

I figured it out myself that I can only create Gradle projects with a build.gradle file. I was trying to do so only within a module. So I created a gradle project and now everything works as expected.
For transisition of older proejcts I can imagine  that only using bulid.gradle for one module, for example the root project is build with maven, would be very helpful for itertively adding gradle supprot to each module.

Can I open a feature request for this?

Kind regards.
Tadeusz

0
Comment actions Permalink

It's not common to mix different build systems in the same project, but request can be submitted at http://youtrack.jetbrains.com/issues/IDEA .

0
Comment actions Permalink

Hello,

Thank you very much. I'll consider it.

Kind regards.
Tadeusz

0
Comment actions Permalink

Hello Tadeusz,

hope you don't mind if I "kidnap" your thread, but I'm experiencing similar problems as the one you described and I'm kind of stuck ... probably because I'm new to IDEA and Gradle.
Thus I wanted to ask if you might can give me additional hints how you got things working.

My setup:
I have a project (workspace) A that "produces" a JAR file. This JAR file is uploaded to my own Artifactory server (maven repository) using Gradle.
In another project B I want to use this JAR file - again by using Gradle. So I added the necessary dependencies in the build.gradle file of project B and can also see that the JAR file is successfully downloaded from my own maven repository and gets stored in the Gradle cache (/Users/Sebastian/.gradle/caches/modules-2/files-2.1/).

Still IDEA does not show this JAR file in the 'External Libraries', where all the other JARs that I get from Maven Central (log4j, ...) are automatically shown.

Could you please elaborate a bit on how you got this solved for you?

Thank you very much in advance,
Sebastian

0
Comment actions Permalink

Hello Sebastian,

For myself the solution wa adding a build.gralde at the project level itself. Afterwards in my module I added another build.gradle file as well. By doing so I can see the Window Tool Gradle.
After I did that all dependencies were reolved correctly and the corresponding jar were added automatically to my Project external libraries.

However I din't try to download a self-created jar file from my own Maven repository and get it added to another module.

So I didn't need to solve your setup. I hope somebody else can answer your question.

Kind regards.
Tadeusz

0

Please sign in to leave a comment.