You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.3 KiB
Groovy
70 lines
1.3 KiB
Groovy
8 years ago
|
plugins {
|
||
|
id 'java'
|
||
|
id 'eclipse'
|
||
|
}
|
||
|
|
||
|
repositories {
|
||
|
mavenLocal()
|
||
|
}
|
||
|
|
||
|
def addDependency(configurationName, dependency) {
|
||
|
def coordinates = [
|
||
|
'group': dependency.groupId.text(),
|
||
|
'name': dependency.artifactId.text(),
|
||
|
'version': dependency.version.text()
|
||
|
]
|
||
|
dependencies {
|
||
|
add configurationName, coordinates
|
||
|
}
|
||
|
}
|
||
|
|
||
|
def effectivePomFile = file('target/effective-pom.xml')
|
||
|
if (effectivePomFile.file) {
|
||
|
def pom = new XmlSlurper().parseText(file('target/effective-pom.xml').text)
|
||
|
pom.dependencies.dependency.each { dependency ->
|
||
|
def scope = dependency.scope.text()
|
||
|
if (scope == 'compile') {
|
||
|
addDependency scope, dependency
|
||
|
}
|
||
|
else if (scope == 'test') {
|
||
|
addDependency 'testCompile', dependency
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
dependencies {
|
||
|
compile localGroovy()
|
||
|
compile gradleApi()
|
||
|
}
|
||
|
|
||
|
jar {
|
||
|
manifest {
|
||
|
attributes 'Implementation-Version': (version ? version : 'unknown')
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
eclipseJdt {
|
||
|
inputFile = rootProject.file('../../eclipse/org.eclipse.jdt.core.prefs')
|
||
|
doLast {
|
||
|
project.file('.settings/org.eclipse.jdt.ui.prefs').withWriter { writer ->
|
||
|
writer << file('../../eclipse/org.eclipse.jdt.ui.prefs').text
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
task sourcesJar(type: Jar) {
|
||
|
classifier = 'sources'
|
||
|
from sourceSets.main.allSource
|
||
|
}
|
||
|
|
||
|
task javadocJar(type: Jar) {
|
||
|
classifier = "javadoc"
|
||
|
from javadoc
|
||
|
}
|
||
|
|
||
|
artifacts {
|
||
|
archives sourcesJar
|
||
|
archives javadocJar
|
||
|
}
|