forked from snowplow/snowplow-java-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
102 lines (86 loc) · 3.32 KB
/
build.gradle
File metadata and controls
102 lines (86 loc) · 3.32 KB
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
/*
* Copyright (c) 2014 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the Apache License Version 2.0 is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
*/
// Applying the java plugin to add support for Java
apply plugin: 'java'
// As per http://www.gradle.org/docs/current/userguide/publishing_maven.html
apply plugin: 'maven-publish'
group = 'com.snowplowanalytics'
version = '0.2.0'
// Where to find the dependencies of our project
repositories {
// Use 'maven central' for resolving our dependencies
mavenCentral()
}
// Dependencies for our production and test code
dependencies {
// Apache Commons
compile 'commons-codec:commons-codec:1.2'
compile 'commons-net:commons-net:3.3'
// Apache HTTP
compile 'org.apache.httpcomponents:httpclient:4.3.3'
compile 'org.apache.httpcomponents:httpasyncclient:4.0.1'
// SLF4J logging API
compile 'org.slf4j:slf4j-simple:1.7.7'
// Jackson JSON processor
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.1.1'
testCompile 'junit:junit:4.11'
}
task sourceJar(type: Jar, dependsOn: 'generateSources') {
from sourceSets.main.allJava
}
// Publishing
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourceJar {
classifier "sources"
}
}
}
repositories {
maven {
url "$buildDir/repo" // change to point to your repo, e.g. http://my.org/repo
}
}
}
task generateSources {
project.ext.set("outputDir", "$projectDir/src/main/java/com/snowplowanalytics/snowplow/tracker/core")
doFirst {
println outputDir
def srcFile = new File((String)outputDir, "Version.java")
srcFile.parentFile.mkdirs()
srcFile.write(
"""/*
* Copyright (c) 2014 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the Apache License Version 2.0 is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
*/
package com.snowplowanalytics.snowplow.tracker.core;
// DO NOT EDIT. AUTO-GENERATED.
public class Version {
static final String TRACKER = "java-core-$project.version";
static final String VERSION = "$project.version";
}
""")
}
}
compileJava.dependsOn generateSources
compileJava.source generateSources.outputs.files, sourceSets.main.java