netflix的gradle插件

本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

转载自夜明的孤行灯

本文链接地址: https://www.huangyunkun.com/2016/02/09/gradle-netflixoss-project-plugin/

Netflix在开源界的声誉稳步上涨,主要源于其公司产品特性中抽象出的微服务体系概念落地的开源技术。NetflixOSS不管包含主要的抽象组件,也开源了它使用的gradle插件,很多插件非常易用。

Gradle作为构建工具,有远优于Maven的配置灵活性和Groovy对于Java世界极高的亲和力。

一个普通的模板项目一般只是用了java和对应IDE插件,比如

apply plugin: java
apply plugin: idea
apply plugin: eclipse

但是除此之外还有一些基本的,比如发布,版本号升级,项目联系人,协议检查等等等等基本配置。

Netflix的gradle-netflixoss-project-plugin可以快速实现这些。

buildscript {
  repositories { jcenter() }
  dependencies { classpath 'com.netflix.nebula:gradle-netflixoss-project-plugin:3.2.2' }
}

allprojects {
    apply plugin: 'nebula.netflixoss'
}

这个插件其实也是调用其他插件,除了协议检查使用了hierynomus的以外,其他都是 Netflix自己的。默认的协议header是Netflix的,需要自己重新配置,格式如下:

Copyright ${year} Netflix, Inc.

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.

参考链接:

Github上的仓库:https://github.com/nebula-plugins/gradle-netflixoss-project-plugin

HEADER格式:https://github.com/nebula-plugins/gradle-netflixoss-project-plugin/blob/master/src/main/resources/netflixoss/HEADER

本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

转载自夜明的孤行灯

本文链接地址: https://www.huangyunkun.com/2016/02/09/gradle-netflixoss-project-plugin/

发表评论