Today, I was trying to use a Gradle plugin that was currently not published to Bintray or any other public repository. I performed following actions to use that plugin in my project.
Step 1: Build the gradle plugin
Clone the gradle plugin to your local machine and run the following command to publish plugin to your local Maven repository.
$ ./gradlew clean build
$ ./gradlew publishToMavenLocal
Step 2: Add plugin to your project build.gradle
Once you have published your plugin to local Maven repository then you need to add the plugin to your project so that you can execute it. Add the following to your
apply plugin: 'my-demo-plugin'
build.gradle shown above we are applying our plugin
my-demo-plugin using the
apply plugin command. Then we used
buildscript method to add our plugin to classpath. Also, we used local maven repo using
mavenLocal() Gradle function.
OpenShift has supported Apache Maven as default build system for Java based projects since the first release. All the Java projects created by OpenShift are maven based. A few months ago we also added support for Apache Ant. All OpenShift gears now have Apache Ant installed on them. So, using Apache Ant to build your project is as easy as updating the OpenShift build action hook. You can refer to my blog post to learn how you can use Ant to build your OpenShift projects.
Lately I have seen lot of developers asking how they can use Gradle to build their projects. Gradle combines the power and flexibility of Ant with the dependency management and conventions of Maven into a more effective way to build. A lot of open source projects and enterprises are using Gradle as their build system. The Spring Framework is one popular example of an open source project using Gradle. In this blog post, we will learn how we can configure an OpenShift Java project to use Gradle instead of Apache Maven to build the project.
Read full blog here https://www.openshift.com/blogs/run-gradle-builds-on-openshift