How to use a custom Bintray repo (correctly) to depend on gradle?

This is the question "I am doing it right."

A brief history: I built the gradle plugin (in a standalone gradle / groovy project). I am using it in another java project. The client project referred to it through something like:

buildScript { flatDir { dirs '../my-gradle-plugin/build/libs' } classpath name: 'gradle-my-plugin' } 

Therefore, I do not need a relative link to the plug-in project (nor do I make the plug-in part of the client). I thought I'd see if I could put it in BinTray and call it a β€œreal” plugin.

Thus, after setting up BinTray and after much trial and error, I got it to work, but I don’t think I fixed it. Here is what I did:

  • Made by maven repo: MyStuff
  • Made package: gradle -my-plugin
  • Made in version: 0.1
  • uploaded the file for this version, but indicated the target path, for example, "org / fhw / gradle -my-plugin / 0.1"

My buildScript block is as follows:

 buildScript { repositories { maven { url 'http://dl.bintray.com/my-bintray-id/MyStuff } } dependencies { classpath 'org.fhw:gradle-my-plugin:0.1' } } 

So I'm interested, this is the hack I made with a target on BinTray. W / O, the correct path was not set for downloaded files / jars (for version).

So is this the right process for BinTray and gradle dependencies?

+6
source share
1 answer

What you did is all right, although using the official Bintray plugin can make your life a lot easier. It improves every day, adds features and does more and more work for you (for example, it can lazily create a package and version for you if they do not exist).

Another thing to consider includes your package in jcenter . One of the benefits of this inclusion will be a free account at oss.jfrog.org for your development process . This is a free Artifactory account ( like a nexus, but much better ).

Also note that you can include your plugin in the Gradle plugin portal. Once you do, your plugin will be reduced to

 plugins { id "org.fhw.gradle-my-plugin" version "0.1" } 

Here are the instructions for turning on .

PS As for the group identifier that hides the β€œlink” - Bintray is not limited to the layout of Maven artifacts, you can expand the files in any layout that you need, so you need to specify the path when downloading files through the user interface. Saying that when Bintray encounters a pom file among the downloaded files, it automatically sets the path. The path is also optional when using maven or maven-publish with the Bintray plugin - it computes the path from artifacts when it clears that these are Maven files.

+5
source

Source: https://habr.com/ru/post/974955/


All Articles