gradle - 无法从HTTP URL应用Gradle脚本插件

标签 gradle plugins build.gradle gradle-plugin

我使用gradle v4.2,这是我的build.gradle。我需要应用脚本插件,该插件在我的github url中有一个非常简单的自定义任务。

    apply plugin: 'java'
    apply plugin: 'maven'
    apply from: 'https://github.com/contactsai123/TestAssured/blob/master/custom.gradle'

但是我得到以下输出:
    Download https://github.com/contactsai123/TestAssured/blob/master/custom.gradle

    FAILURE: Build failed with an exception.

    Where:
    Script 
    'https://github.com/contactsai123/TestAssured/blob/master/custom.gradle' 
     line: 7

    What went wrong:
   Could not compile script 


  'https://github.com/contactsai123/TestAssured/blob/master/custom.gradle'.
  > startup failed:
  script 
 'https://github.com/contactsai123/TestAssured/blob/master/custom.gradle': 
  7: unexpected token: < @ line 7, column 1.
  <!DOCTYPE html>
 ^

 1 error

当我从本地目录引用时,虽然同一个custom.gradle可以正常工作:
apply plugin: 'java'
apply plugin: 'maven'
apply from: 'custom.gradle'

最佳答案

那是因为您将其引用为网页而不是raw,但是尝试将其作为原始文件

https://raw.githubusercontent.com/contactsai123/TestAssured/master/custom.gradle

它应该按预期工作

关于gradle - 无法从HTTP URL应用Gradle脚本插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50397912/

相关文章:

android-studio - 错误:Conflict with dependency 'com.google.code.findbugs:jsr305'

gradle - 根据Gradle中的构建类型更新值

android - 新依赖 React native - gradle clean - 无法解析所有依赖

spring - Gradle Spring Boot 依赖项未找到多模块项目

android -/tools/external/gradle/gradle-4.5-bin.zip(无此类文件或目录)

java - 进程 'Gradle Test Executor' 以非零退出值 29 结束

plugins - 如何构建 Sublime Text 2 插件来编译 Racket (方案)代码?

eclipse - 如何在Eclipse中还原软件更新

java - Eclipse 插件 : Pass values from one View to other View

android - Jacoco 与 Gradle 0.10.0 : Remote object doesn't exist