Groovy 许可证渐变插件

Groovy 许可证渐变插件,groovy,gradle,Groovy,Gradle,感谢回复,我正在搜索应用License gradle插件来检查我源代码中的标题。请给我完整的脚本 buildscript { repositories { mavenCentral() } dependencies { classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.5.0' } } apply plugin: 'license' 我在我的build.

感谢回复,我正在搜索应用License gradle插件来检查我源代码中的标题。请给我完整的脚本

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.5.0'
    }
}

apply plugin: 'license'
我在我的
build.gradle
中使用了这段代码,但它并没有更新我所有源文件
src/main/*.groovy文件中的头文件。如果未在groovy文件中写入头,如何编写构建脚本以检查
.groovy
文件中是否存在头

谢谢, kothapeta Raju


我按你说的做了尝试,但得到了以下异常

失败:无法确定要执行的任务

  • 出了什么问题: 在根项目“license gradle plugin master”中找不到任务“licenseFormatMain”

  • 尝试: 运行gradle tasks以获取可用任务的列表

构建失败

谢谢, Raju.

因此,表明您:

将其放入
build.gradle
文件中

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.5.0'
    }
}

apply plugin: 'license'
在项目的根目录中创建文件
许可证

Copyright (C)2013 - Tim Yates

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and
limitations under the License.
然后键入

gradle licenseFormatMain
失败:无法确定要执行的任务

错误:在根项目“license gradle plugin master”中找不到任务“licenseFormatMain”

Try:运行gradle任务以获取可用任务的列表

如果不应用java插件,就会发生这种情况。将此添加到生成文件中为我完成了以下任务:

应用插件:“java”

编辑
我不能通过删除上面的这一行来重现这个问题

gradle licenseFormatMain我使用了gradle licenseFormatMain,但在根项目中找不到获取错误任务“licenseFormatMain”gradle的哪个版本?你能编辑你的问题来发布你正在使用的
build.gradle
文件吗?我正在使用gradle 1.4版本。请帮助我Tim_yates如何编写构建。gradle@RajuKothapeta你有
build.gradle
文件吗?如果是,请编辑此问题,并将其粘贴到中,以便我们可以查看问题所在