Reputation: 5720
I tried to apply plugin
directly from GitHub
repo e.g. as given below
apply from 'https://github.com/gradle/gradle-hello-world-plugin'
but on running
./gradlew codeLines
It gives me error as
* Where:
Script 'https://github.com/SurpSG/code-lines-counter-gradle-plugin' line: 7
* What went wrong:
Could not compile script 'https://github.com/SurpSG/code-lines-counter-gradle-plugin'.
> startup failed:
script 'https://github.com/SurpSG/code-lines-counter-gradle-plugin': 7: unexpected token: < @ line 7, column 1.
<!DOCTYPE html>
^
How can I directly apply plugin
from remote git repo?
Upvotes: 3
Views: 577
Reputation: 552
The plugin is automatically published to jitpack.
You could apply the plugin in the next way:
buildscript {
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.github.SurpSG:code-lines-counter-gradle-plugin:0.0.1'
}
}
apply plugin: 'com.github.code-lines'
Note! code-lines-counter-gradle-plugin is sample project created as a part of tutorial. I don't recommend to use it because it far from production ready
Upvotes: 2
Reputation: 16833
I don't think it's possible. The closest think you can do is clone the plugin, build it and point to it
buildscript {
repositories {
[...]
}
dependencies {
classpath files('relative/path/to/gradle-hello-world-plugin.jar')
}
}
apply plugin: org.gradle.plugin.HelloWorldPlugin
Source : https://stackoverflow.com/a/35472676/2003986
Upvotes: 0