Why does my gradle download sources by default? - gradle

I converted my maven project to gradle with gradle init. Now every time I import the same project into my IDE, gradle downloads the same dependencies from the scratch, and what's worse is it also downloads the sources, I have no idea where that was configured, I am using IntelliJ, but I didn't configure anything related to gradle. How can I let gradle cache the same dependencies and not download sources?

You can disable downloading sources in your Gradle config file when using 'idea' plugin. See: http://gradle.org/docs/current/dsl/org.gradle.plugins.ide.idea.model.IdeaModule.html (search for 'downloadSources').

Related

Gradle dependencies pom files locations on local file system

I understand that Gradle stores project dependencies cache in ~/.gradle/caches/modules-2 for the actual jar files. However, does Gradle also store .pom anywhere locally? Also, if I previously downloaded same dependencies through Maven (stored in ~/.m2/repositories) would Gradle reuse them automatically? In Maven, pomfiles are downloaded along side jars.
If POMs are not downloaded as part of gradle build, what's the best way to programmatically get the POMs for package metadata?
Gradle seems to use a local cache and not a repository, unless depending on mavenLoacal().
You could use the API which mavenCentral() provides:
https://central.sonatype.org/search/rest-api-guide

Can't get org.jetbrains.intellij plugin in Gradle build

I'm trying to include "org.jetbrains.intellij" plugin to my project for using JetBrains annotation #NotNull in JUnit tests while testing project with Gradle. But Gradle try to download this plugin from cache-redirector.jetbrains.com.
Company, where I try to do that, uses inner Artifactory for keeping dependencies. And I've already set my settings.gradle.kts pluginManagement for using Artifactory. Other plugins successfully downloaded and installed except JetBrains one.
What and where should I modify to force Gradle download plugin from company's Artifactory, not from cache-redirector.jetbrains.com?

Where to find the builded artifactories using gradle

I'm coming from the Maven world, and I want to know where to find the local builded packages using gradle.
In maven these packages are published in the m2 repository. Is there something similar in gradle ?
Gradle does not publish any artifacts in Maven-compatible repositories by default. In order to do that you'll need to use maven-publish plugin.
However, build results are actually cached in $GRADLE_USER_HOME directory which is ~/.gradle by default: ~/.gradle/caches, ~.gradle/caches/modules-2/files-2.1.

Maven/Gradle support in IntelliJ Plugin

I'm writing a plugin using IntelliJ SDK via the gradle-intellij-plugin.
I was able to add the dependencies so far, but now that I'm trying to add Maven/Gradle dependencies they are not seen.
I also added the jars of the IntelliJ plugins into the SDK classpath
Any idea of the reason? How can I introduce support for these Maven/Gradle thingy?
The approach that you are shown is for those that are not using the gradle plugin to build new plugins.
According to the plugin README and to the IDE structure, these two are bundled plugins and must be imported using the folder name inside the plugins folder in the IntelliJ installation.
Just add
intellij {
version = 'IntelliJVersion'
pluginName = 'MyPluginName'
plugins 'Maven', 'gradle'
}
in the build.gradle.
Pay attention to the case.

Compiling with gradle idea

Hi) when I compile the project are with gradle idea, I should get jar file...?
maybe in the folder dist...
The problem is that I get only two files start.sh and start.cmd
gradle idea doesn't compile the project. It creates project files (*.iws, *.ipr, *l.iml) for IDEA (the IDE from JetBrains). Likewise, there is gradle eclipse to create project files for the Eclipse IDE.
To create a Jar, you can do gradle jar or gradle build (assuming you have the java plugin applied). gradle tasks shows which tasks are available for a given project.
start.sh and start.cmd sound like they are coming from the application plugin. Are you using the application plugin?
The above poster is right that gradle idea simply creates the IntelliJ files that define your modules, src locations, etc. It does NOT compile the project.
Adding apply plugin: 'java' to your build.gradle will allow you to run gradle jar to generate a jar file.

Resources