首页 文章

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

提问于
浏览
1

我使用gradle v4.2,这是我的build.gradle . 我需要应用脚本插件,它有一个非常简单的自定义任务位于我的github网址中 .

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'

1 回答

  • 1

    这是因为您将其引用为不是 raw 的网页,而是将其视为原始网页

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

    它应该按预期工作

相关问题