-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
170 lines (139 loc) · 5.48 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java library project to get you started.
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
* User Manual available at https://docs.gradle.org/6.8/userguide/building_java_projects.html
*/
plugins {
// Apply the java-library plugin for API and implementation separation.
// Provides support for building a Java library.
// (de) Also ein jar wird erstellt
id 'java-library'
}
// --warning-mode=all // (all,fail,none,summary), summary ist default - diese prop in ~/.gradle/gradle.properties
// All extra properties must be defined through the "ext" namespace!
// oder so:
def JAR_BASENAME = "de.klst.orderx"
//def JAR_VERSION = "1.1.0"
version = '1.1.0'
//compileJava.options.encoding = 'UTF-8' // sonst wird auf WIN Cp1252 genutzt
//compileTestJava.options.encoding = 'UTF-8'
// oder besser:
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
repositories {
// declare any Maven/Ivy/file repository here:
/*
https://mvnrepository.com/repos/central
*/
mavenCentral()
/* Use JCenter for resolving dependencies: https://bintray.com/
Bintray's JCenter is an up-to-date collection of all popular Maven OSS artifacts,
including artifacts published directly to Bintray.
JCenter macht dicht (ab April 2021 nur noch read only), siehe
https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/
*/
jcenter()
}
/*
Abhängigkeiten in Gradle folgen dem gleichen Format wie Maven. Abhängigkeiten sind wie folgt aufgebaut:
group:name:version
compile 'org.springframework:spring-core:4.3.1.RELEASE'
Eine alternative Syntax hierfür benennt jede Komponente der Abhängigkeit explizit wie folgt:
compile group: 'org.springframework', name: 'spring-core', version: '4.3.1.RELEASE'
Manchmal haben Sie eine lokale JAR-Datei, die Sie Ihrem Gradle-Build als Abhängigkeit hinzufügen müssen. So können Sie das machen:
dependencies {
compile files('path/local_dependency.jar') // deprecated syntax!
}
*/
dependencies {
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
// testImplementation('org.hamcrest:hamcrest:2.2')
// Use JUnit test framework.
testImplementation 'junit:junit:4.13'
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.1")
// This dependency is exported to consumers, that is to say found on their compile classpath.
// used in marshaller:
api('org.glassfish.jaxb:jaxb-runtime:2.3.3')
// used in jaxb-runtime:
api('com.sun.istack:istack-commons-runtime:3.0.11')
// wg. Singleton:
api('javax.inject:javax.inject:1')
// Bsp. This dependency is used internally, and not exposed to consumers on their own compile classpath.
// implementation 'com.google.guava:guava:29.0-jre'
}
//sourceSets.main.java.srcDirs += ['e-doc-commons/src/main/java']
sourceSets {
// am Anfang bei Configure project
logger.info("configurations=$configurations")
logger.info("project=$project")
logger.info("it=$it")
sourceSets.each { srcSet ->
println "sourceSet ["+srcSet.name+"]"
print "-->Source directories: "+srcSet.allJava.srcDirs+"\n"
print "-->Output directories: "+srcSet.output.classesDirs.files+"\n"
print "-->Compile classpath:\n"
srcSet.compileClasspath.files.each {
print " "+it.path+"\n"
}
println ""
if(srcSet.name=="main") {
srcSet.java.srcDirs += ['e-doc-commons/src/main/java']
}
}
}
/* archiveFileName
If the name has not been explicitly set, the pattern for the name is:
[archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension]
Examples: de.klst.orderx-api-1.1.0.jar de.klst.orderx-impl-1.1.0.jar
excludes / includes // Set<String>, Default with java plugin: []
The set of exclude/includes patterns.
Patterns may include:
'*' to match any number of characters
'?' to match any single character
'**' to match any number of directories or files
*/
task apiJar(type: Jar) {
archiveBaseName = JAR_BASENAME
archiveAppendix = "api"
// archiveVersion = JAR_VERSION
includeEmptyDirs = false
from sourceSets.main.output
// include / exclude patterns are relative to the root(s)
includes = ["**/api/**"]
doLast {
logger.info("api jar: source.each:")
source.each { src ->
logger.info(""+src)
}
}
}
jar {
archiveBaseName = JAR_BASENAME
archiveAppendix = "impl"
excludes = ["**/api/**"]
// direkt nach clean wird hier nur MANIFEST.MF ausgegeben, daher doLast ...
doLast {
// Test: (die Einstellung aus .gradle/gradle.properties wird ignoriert)
// logger.quiet('An info log message which is always logged.')
// logger.error('An error log message.')
// logger.warn('A warning log message.')
// logger.lifecycle("A lifecycle info log message: logging.level=${logging.level}")
// logger.info('An info log message.')
// logger.debug('A debug log message.')
// logger.trace('A trace log message.') // Gradle never logs TRACE level logs
logger.info("impl jar: source.each:")
source.each { src ->
logger.info(""+src)
// println(src)
}
}
// tasks.each { task ->
// println "["+task+"]"
// }
}
artifacts {
archives apiJar
}