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

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?

Related

Gradle private repository for dependencies

I am using Gradle for my project and yesterday I faced issues while building project since https://plugins.gradle.org was not working. So is there any way to clone dependencies & plugins to AWS S3/Artifactory/Nexus during the build process and if I face an outage issue for public repos like Maven or Gradle I should be able to serve project dependencies & plugin via AWS S3/Artifactory/Nexus
If you are in a maven project you can just go the the .xml file and add it as a dependencie which you'll find in the maven repository :https://mvnrepository.com/

How to reference local Gradle project from Maven build as dependency?

I have several Gradle library projects and main Ant spring web-app project (historically). I'd like to replace Ant with Maven for main project while keeping existing Gradle projects nature.
Is it possible to refer local Gradle projects from pom.xml as local dependencies of Maven project?
Search readily gives me the opposite - "how to refer maven projects from gradle builds", but not my case.
Gradle always builds locally build/libs (or distributions); the only easy way to share the build dependencies between completely different projects is 'as maven repository dependencies'
in your case the options are
Work Local Builds only
add the maven plugin to the gradle builds - do local install
and refer them in the maven build locally.
Build Anywhere
Your Gradle builds publish artefacts to your local nexus
and you refer them properly in your dependencies
--
Gradle by default does not have 'maven install'; it can be added using the maven plugin see - https://docs.gradle.org/current/userguide/maven_plugin.html#header.

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.

Use a snaphot version of the gradle dependency plugin (... in order to test gradle-3.0Mx)

I stumbled over compatibility issues related to the dependency plugin and gradle-3.0M1. Quickly, people told me this might be fixed in the trunk version of the plugin, but not in the latest release version 0.5.7.
Now I wanted to verify this but didn't find an easy way to use the snapshot version of the plugin. In the end, I
downloaded the plugin source by cloning the git repo
rebuilt the plugin
copied the jar file into a folder
made this folder available as flatDir within my build script
Is there a better way to do this? Is there a public mvn repo for the snapshots?
Publish the plugin to your local maven repo (.m2) using either the older maven plugin or the newer maven-publish plugin.
In the project where you want to use/test the plugin you just build, add mavenLocal() as a repository in the buildscript section of build.gradle.

Why does my gradle download sources by default?

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').

Resources