【问题标题】:Unable to apply gradle script plugin from HTTP URL无法从 HTTP URL 应用 gradle 脚本插件
【发布时间】:2018-10-28 02:29:19
【问题描述】:

我使用 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'

【问题讨论】:

    标签: gradle plugins build.gradle gradle-plugin


    【解决方案1】:

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

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

    它应该按预期工作

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-24
      • 1970-01-01
      • 2022-06-20
      • 1970-01-01
      • 2018-12-17
      • 2015-05-11
      • 2020-05-18
      相关资源
      最近更新 更多