1 Star 0 Fork 0

jbooster/jbooster-enumdocs-gradle-plugin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.gradle 3.64 KB
一键复制 编辑 原始数据 按行查看 历史
咖啡豆 提交于 2017-09-29 04:56 . package jool into fatjar
buildscript {
ext {
projectVersion = '0.0.8'
// dependencies
boosterVersion = '1.0.0-SNAPSHOT'
thymeleafVersion = '3.0.7.RELEASE'
caffeineVersion = '2.3.5'
junitVersion = '4.12'
}
repositories {
jcenter()
}
it.dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
}
}
plugins {
id "com.gradle.plugin-publish" version "0.9.7"
}
apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.plugin-shadow'
tasks.withType(GroovyCompile) {
groovyOptions.encoding = "UTF-8"
options.encoding = "UTF-8"
}
group 'org.jbooster.enumdocs.generator'
version projectVersion
repositories {
maven { url MAVEN_REPO_ALIYUN }
maven { url MAVEN_REPO_JBOOSTER }
jcenter()
mavenCentral()
mavenLocal()
}
dependencies {
shadow gradleApi()
shadow localGroovy()
shadow("org.thymeleaf:thymeleaf:$thymeleafVersion")
shadow("com.github.ben-manes.caffeine:caffeine:$caffeineVersion")
compile("org.jbooster:jbooster-common-core:$boosterVersion")
testCompile("junit:junit:$junitVersion")
}
shadowJar {
outputs.upToDateWhen { false }
classifier = ''
dependencies {
it.exclude(it.dependency("org.thymeleaf:thymeleaf"))
it.exclude(it.dependency("com.github.ben-manes.caffeine:caffeine"))
}
}
jar.dependsOn shadowJar
jar.onlyIf(Specs.SATISFIES_NONE)
configureRelocationShadowJar.onlyIf(Specs.SATISFIES_NONE)
pluginBundle {
website = 'http://git.oschina.net/jbooster/jbooster-enumdocs-gradle-plugin'
vcsUrl = 'http://git.oschina.net/jbooster/jbooster-enumdocs-gradle-plugin'
description = 'jbooster enumdocs generator gradle plugin'
tags = ['enumdocs', 'thymeleaf', 'generator', 'jbooster']
plugins {
enumdocsGeneratorPlugin {
id = 'org.jbooster.enumdocs.generator'
displayName = 'jbooster enumdocs generator gradle plugin'
}
}
mavenCoordinates {
groupId = project.group
artifactId = project.name
}
withDependencies {
it.clear()
project.configurations.shadow.allDependencies.findAll { dep ->
dep.group != null
}.each { dep -> it.add(convert(dep)) }
}
}
publishing {
publications {
plugin(MavenPublication) {
project.shadow.component(it)
artifact sourcesJar
artifact javadocJar
// have to manually change the scope of maven dependencies in the generated pom from runtime to compile
// see https://discuss.gradle.org/t/maven-publish-plugin-generated-pom-making-dependency-scope-runtime/7494
pom.withXml {
asNode().dependencies.'*'.findAll {
it.scope.text() == 'runtime' && project.configurations.shadow.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each {
it.scope*.value = 'compile'
}
}
}
}
}
task sourcesJar(type: Jar) {
classifier 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
classifier 'javadoc'
from javadoc
}
task wrapper(type: Wrapper) {
gradleVersion = '4.1'
distributionUrl = distributionUrl.replace('https://services.gradle.org/distributions', GRADLE_DISTRIBUTIONS)
}
static def convert(Dependency dep) {
org.apache.maven.model.Dependency dependency = new org.apache.maven.model.Dependency()
dependency.setGroupId(dep.group)
dependency.setArtifactId(dep.name)
dependency.setVersion(dep.version)
dependency.setScope('compile')
dependency
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Groovy
1
https://gitee.com/jbooster/jbooster-enumdocs-gradle-plugin.git
git@gitee.com:jbooster/jbooster-enumdocs-gradle-plugin.git
jbooster
jbooster-enumdocs-gradle-plugin
jbooster-enumdocs-gradle-plugin
master

搜索帮助