We have configured the required configuration properties to get our project published to Bintray. However, the plugin allows for more configuration. We can see the configuration properties in the following table:
In the following example build file, we will use some of these configuration properties:
// Define Bintray plugin. buildscript { repositories { jcenter() } dependencies { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0' } } // Apply plugin to project. apply plugin: 'com.jfrog.bintray' apply plugin: 'maven-publish' apply plugin: 'java' version = '1.0.2.RELEASE' group = 'book.gradle' repositories { jcenter() } dependencies { compile 'org.springframework:spring-context:4.1.4.RELEASE' } publishing { publications { sample(MavenPublication) { from components.java } } } bintray { user = bintrayUsername key = bintrayApiKey publications = ['sample'] publish = true pkg { repo = 'book-sample' name = 'full-sample' desc = 'Sample package for Gradle book.' websiteUrl = 'https://github.com/mrhaki/gradle-dep-book/' issueTrackerUrl = 'https://github.com/mrhaki/gradle-dep-book/issues' vcsUrl = 'https://github.com/mrhaki/gradle-dep-book.git' licenses = ['Apache-2.0'] labels = ['book', 'sample', 'Gradle'] publicDownloadNumbers = true version { desc = 'Fixed some issues.' released = new Date() } } }
It is good to see that if we define the vcsUrl
and licenses
configuration properties, the plugin will automatically create the package in our repository. So, we don't have to use the web browser to create a new package. Instead, we can use the configuration in our build script to automatically create a package. Also, notice that the package is automatically published, unlike in the first example in which it was in an unpublished state.
18.190.217.253