-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
105 lines (91 loc) · 2.7 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
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'application'
apply plugin: 'maven-publish'
group = 'org.jboss.qe'
version = '1.2.0.Final-SNAPSHOT'
mainClassName = 'org.jboss.qe.dscreator.Main'
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
// needs to have default values for maven publish plugin does not complain - see section publishing
project.ext.publishUsername = project.ext.has('publishUsername') ? project.publishUsername : 'unknown'
project.ext.publishPassword = project.ext.has('publishPassword') ? project.publishPassword : 'unknown'
idea {
project {
languageLevel = '1.6'
}
module {
downloadSources = true
downloadJavadoc = true
}
}
jar {
manifest {
attributes (
"Main-Class" : "org.jboss.qe.dscreator.Main"
)
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.4'
}
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.2.1'
compile 'commons-cli:commons-cli:1.2'
}
/*
For publishing on Nexus you need to run command like
gradle publishMavenJavaPublicationToJboss-qa-releasesRepository -PpublishUsername=username -PpublishPassword=password
or just specific publish command
gradle publishMavenJavaPublicationToJboss-qa-releasesRepository
and define the username and password in gradle.properties file in project directory
*/
task sourceJar(type: Jar) {
from sourceSets.main.allSource
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact (sourceJar) {
classifier 'sources'
}
artifact ('README.md') {
classifier = 'README'
extension = 'md'
}
pom.withXml {
// there is 'a problem' that default scope for dependencies in pom is runtime
def scopeNodes = asNode().depthFirst().findAll { println it.name().getQualifiedName(); it.name().getQualifiedName() == 'scope' }
scopeNodes.each {it.setValue('compile')}
}
}
}
repositories {
maven {
name 'jboss-qa-releases'
url 'http://nexus.qa.jboss.com:8081/nexus/content/repositories/releases'
credentials {
username project.publishUsername
password project.publishPassword
}
}
maven {
name 'jboss-qa-snapshots'
url 'http://nexus.qa.jboss.com:8081/nexus/content/repositories/snapshots'
credentials {
username project.publishUsername
password project.publishPassword
}
}
}
}
// create fat jar with all dependencies inside
task fatJar(type: Jar) {
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}