I am using apply plugin: ‘java-library-distribution’ in my build.gradle script to create the zip file It is working perfectly .One thing which I noticed here is after unzipping my zip file it creates the same folder inside the same folder.
Below is the output of the tree command which shows after unzipping the zip file I saw AnalyticsLib-4.0.0 and again there is one folder with same name AnalyticsLib-4.0.0 which is wired.Can someone tell me what is the issue?After unzip it should show only AnalyticsLib-4.0.0----Lib folder
C:.
└───AnalyticsLib-4.0.0
└───AnalyticsLib-4.0.0
└───lib
Below is my gradle script
apply plugin: 'jacoco'
apply plugin: 'findbugs'
apply plugin: 'pmd'
apply plugin: 'checkstyle'
apply plugin: 'maven'
apply plugin: 'java-library-distribution'
//-- set the group for publishing
group = 'com.tru.analyticsengine'
/**
* Initializing GAVC settings
*/
def buildProperties = new Properties()
file("version.properties").withInputStream {
stream -> buildProperties.load(stream)
}
//add the jenkins build version to the version
def env = System.getenv()
if (env["BUILD_NUMBER"]) buildProperties.analyticsengineBuildVersion += ".${env["BUILD_NUMBER"]}"
version = buildProperties.analyticsengineBuildVersion
println "${version}"
//name is set in the settings.gradle file
group = "com.truvenhealth.analyticsengine"
version = buildProperties.analyticsengineBuildVersion
println "Building ${project.group}:${project.name}:${project.version}"
sourceCompatibility = 1.7
compileJava.options.encoding = 'UTF-8'
repositories {
maven { url "http://cm.t.t.com:8/artifactory/libs-snapshot" }
maven { url "http://cm.t.t.com:8/artifactory/libs-release" }
maven { url "http://cm.t.t.com:8/artifactory/libs-stage" }
maven { url "http://cm.t.t.com:8/artifactory/simple/ext-release-local/" }
}
dependencies {
compile group: 'com.truv.analyticsengine', name: 'common', version:'4.0.0.94'
compile group: 'com.truv.analyticsengine', name: 'LicenseVerifier', version:'4.0.0.89'
compile group: 'com.truv.analyticsengine', name: 'MegNativeJNI', version: '4.0.0.84', ext: 'so'
compile group: 'com.truv.analyticsengine', name: 'NativeJNI', version: '4.0.0.97', ext: 'so'
compile(group: 'com.operasolutions', name: 'RiskAnalytics', version:'1.1') {
exclude(module: 'jyson')
}
compile group: 'org.springframework', name: 'spring-context', version:'3.2.5.RELEASE'
compile group: 'org.springframework', name: 'spring-beans', version:'3.2.5.RELEASE'
compile group: 'org.springframework', name: 'spring-core', version:'3.2.5.RELEASE'
compile group: 'org.springframework', name: 'spring-aop', version:'3.2.5.RELEASE'
compile group: 'org.springframework', name: 'spring-expression', version:'3.2.5.RELEASE'
compile group: 'org.apache.commons', name: 'commons-collections4', version:'4.0'
compile group: 'commons-io', name: 'commons-io', version:'2.4'
compile group: 'net.sf.supercsv', name: 'super-csv-dozer', version:'2.1.0'
compile group: 'net.sf.supercsv', name: 'super-csv', version:'2.1.0'
compile group: 'org.aspectj', name: 'aspectjtools', version:'1.6.2'
compile group: 'org.python', name: 'jython-standalone', version:'2.5.3'
compile group: 'com.google.code.gson', name: 'gson', version:'1.7.2'
compile group: 'log4j', name: 'log4j', version:'1.2.16'
compile group: 'com.xhaus', name: 'jyson', version:'1.0.2'
compile group: 'com.google.guava', name: 'guava', version:'17.0'
compile group: 'com.jamonapi', name: 'jamon', version:'2.4'
compile group: 'ch.qos.logback', name: 'logback-classic', version:'1.1.1'
compile group: 'ch.qos.logback', name: 'logback-core', version:'1.1.1'
compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.6'
compile group: 'org.codehaus.mojo', name: 'properties-maven-plugin', version:'1.0-alpha-2'
compile group: 'args4j', name: 'args4j', version:'2.0.28'
compile group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version:'1.9.5'
testCompile group: 'junit', name: 'junit', version:'4.11'
testCompile group: 'org.mockito', name: 'mockito-all', version:'1.9.5'
}
jacoco {
toolVersion = "0.7.1.201405082137"
}
test {
jacoco {
append = false
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpFile = file("$buildDir/jacoco/classpathdumps")
}
}
jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
executionData = fileTree(dir: 'build/jacoco', include: '**/*.exec')
reports {
xml{
enabled true
//Following value is a file
destination "${buildDir}/reports/jacoco/xml/jacoco.xml"
}
csv.enabled false
html{
enabled true
//Following value is a folder
destination "${buildDir}/reports/jacoco/html"
}
}
}
findbugs {
ignoreFailures = true
//sourceSets = [sourceSets.main]
}
pmd {
ruleSets = ["java-basic", "java-braces", "java-design"]
ignoreFailures = true
//sourceSets = [sourceSets.main]
}
checkstyle {
configFile = new File(rootDir, "config/checkstyle.xml")
ignoreFailures = true
//sourceSets = [sourceSets.main]
}
// adding test report to taskGraph
build.dependsOn jacocoTestReport
def pomFile = file("${buildDir}/libs/${archivesBaseName.toLowerCase()}-${version}.pom")
task newPom << {
pom {
project {
groupId project.group
artifactId project.name
version project.version
description = "Configuration Management Gradle Plugin"
}
}.writeTo(pomFile)
}
// adding pom generation to taskGraph
build.dependsOn newPom
//disabling the install task since we're not using maven for real
install.enabled = false
//for publishing to artifactory via jenkins
if(project.hasProperty('artifactoryPublish')) {
artifactoryPublish {
mavenDescriptor pomFile
}
}
jar {
// Keep jar clean:
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
manifest {
attributes 'Manifest-Version': '1.0',
'Build-Jdk': '1.7.0_45',
'Class-Path': configurations.compile.files.collect { "lib/$it.name" }.join(' ')
}
}
// ------ Publish the jar file to artifactory ------
artifacts {
distZip
newPom
}