gpt4 book ai didi

git - 自定义Gradle任务失败-找不到GitPush

转载 作者:行者123 更新时间:2023-12-03 05:18:16 25 4
gpt4 key购买 nike

我正在尝试在Gradle任务中推送到远程git repo。我发现的最好方法是使用在这里找到的插件Gradle-Git:https://github.com/ajoberstar/gradle-git

我基本上只是想能够运行push任务,然后从那里开始配置它以在我的项目中使用。

这是我的build.gradle脚本的样子。

apply plugin: 'eclipse'
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'base'

import org.ajoberstar.gradle.git.tasks.*

repositories {
mavenCentral()
maven {
url "[my custom repository repo]"
}
}

dependencies {
compile 'org.ajoberstar:gradle-git:0.4.0'
}

task push(type: GitPush) {
println "Test"
}

我的错误是
FAILURE: Build failed with an exception.

* Where:
Build file '[my_path]\build.gradle' line: 19

* What went wrong:
A problem occurred evaluating root project 'Name'.
> Could not find property 'GitPush' on root project 'Name'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

并与--stacktrace一起运行会在此处生成异常日志: http://pastebin.com/uqjf5U5k

最佳答案

您尚未按照插件网站上的说明进行操作

要向构建本身添加一些内容,您需要有一个buildscript

buildscript {
repositories { mavenCentral() }
dependencies { classpath 'org.ajoberstar:gradle-git:0.4.0' }
}

关于git - 自定义Gradle任务失败-找不到GitPush,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16446725/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com