-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
146 lines (127 loc) · 3.42 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'groovy'
dependencies {
compile gradleApi()
compile localGroovy()
compile "com.moowork.gradle:gradle-node-plugin:" + project.gradleNodePluginVersion
compile "com.diffplug.spotless:spotless-plugin-gradle:" + project.spotlessPluginVersion
}
sourceSets {
main {
groovy {
srcDirs = ["$projectDir/src/main/groovy"]
}
}
}
group = 'com.missdumbo.gradle'
repositories {
mavenCentral()
jcenter()
maven {url "http://mvnrepository.com/"}
// mavenLocal()
// maven{
// name = "misdumbo"
// url = project.ext.repositoryUrl
// }
}
sourceCompatibility = project.ext.javaSourceCompatibility
targetCompatibility = project.ext.javaTargetCompatibility
configurations {
provided
}
configurations.all {
exclude group: 'asm'
resolutionStrategy{
cacheChangingModulesFor 1, 'seconds'
cacheDynamicVersionsFor 1, 'seconds'
}
}
jar {
duplicatesStrategy='EXCLUDE'
manifest {
attributes("provider":"https://github.com/missdumbo", "Implementation-Title": "Gradle", "Implementation-Version": project.version)
}
archiveName 'gvc-starter.jar'
}
eclipse {
classpath{
downloadSources=project.ext.downloadSource
defaultOutputDir=new File(project.buildDir.path+'/target')
plusConfigurations += [ configurations.provided ]
file {
whenMerged { classpath ->
for ( entryIt in classpath.entries) {
if(entryIt.path == 'org.springsource.ide.eclipse.gradle.classpathcontainer'){
classpath.entries.removeAll { entry ->
entry.kind == 'lib'
}
break
}
}
}
}
}
project {
natures 'org.springsource.ide.eclipse.gradle.core.nature'
natures 'org.springframework.ide.eclipse.core.springnature'
buildCommand 'org.springframework.ide.eclipse.core.springbuilder'
}
}
eclipseJdt {
doLast {
File f = file('.settings/org.eclipse.core.resources.prefs')
f.write('eclipse.preferences.version=1\n')
f.append('encoding/<project>=UTF-8')
}
}
cleanEclipseJdt{
delete(new File(project.projectDir, '.settings/org.eclipse.core.resources.prefs') )
}
task sourceJar(type: Jar) {
from sourceSets.main.allJava
}
publishing {
publications {
mavenJar(MavenPublication){
from components.java
artifact sourceJar{
classifier "sources"
}
project.configurations[JavaPlugin.RUNTIME_CONFIGURATION_NAME].allDependencies.findAll {
it instanceof ModuleDependency && !it.excludeRules.isEmpty()
}.each { ModuleDependency dep ->pom.withXml {
def xmlDep = asNode().dependencies.dependency.find {
it.groupId[0].text() == dep.group && it.artifactId[0].text() == dep.name
}
def xmlExclusions = xmlDep.exclusions[0]
if (!xmlExclusions) {
xmlExclusions = xmlDep.appendNode('exclusions')
}
dep.excludeRules.each { ExcludeRule rule ->
def xmlExclusion = xmlExclusions.appendNode('exclusion')
xmlExclusion.appendNode('groupId', rule.group)
xmlExclusion.appendNode('artifactId', rule.module)
}
}
}
}
}
repositories {
mavenCentral()
// maven {
// url project.version.endsWith("SNAPSHOT")?project.ext.publishRepositoryUrl:project.ext.publishRepositoryUrlRelease
// credentials{
// username project.ext.publishRepositoryUserName
// password project.ext.publishRepositoryPassword
// }
// }
}
}
//build.finalizedBy(publishToMavenLocal)
task wrapper(type: Wrapper) {
gradleVersion = '4.0'
}