From b6d8a4cfcef84a3ec4bc1086192f72697bf63070 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 10 Jul 2018 11:58:41 +0800 Subject: [PATCH] build --- build.third_step0.gradle | 44 ++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/build.third_step0.gradle b/build.third_step0.gradle index 053396940..1fbfd6993 100644 --- a/build.third_step0.gradle +++ b/build.third_step0.gradle @@ -1,15 +1,22 @@ apply plugin: 'java' +apply plugin: 'maven-publish' +def classesDir='build/classes/main' tasks.withType(JavaCompile){ options.encoding = 'UTF-8' - destinationDir = file('build/classes/main') + destinationDir = file(classesDir) +} + +configurations.all { + resolutionStrategy.cacheChangingModulesFor 0, 'seconds' } //指定构建的jdk版本 sourceCompatibility=1.5 -def jarname="fine-third-10.0.jar" -def classesDir='build/classes/main' + + //解压lib下的jar到classes文件夹 + jar{ - baseName="fine-third-10.0" + baseName="fine-third-${version}" } repositories { @@ -28,10 +35,13 @@ sourceSets{ } //获取什么分支名 -FileTree files =fileTree(dir:'./',include:'build.*.gradle') +FileTree files =fileTree(dir:'./',include:'build*.gradle') def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf (java.io.File.separator)) def branchName=buildDir.substring(buildDir.lastIndexOf (java.io.File.separator)+1) +version='10.0' def srcDir="." +def maven_version="${version}-RELEASE-SNAPSHOT" +def jar_version = version configurations { thirdjar @@ -39,12 +49,34 @@ configurations { } dependencies { - thirdjar "com.fr.third:fine-third:10.0-FEATURE-SNAPSHOT" + thirdjar "com.fr.third:fine-third:10.0-RELEASE-SNAPSHOT" sigar "com.fr.third:sigar:1.6.0" testCompile 'junit:junit:4.12' } +publishing { + publications { + third(MavenPublication) { + groupId "com.fr.third" + artifactId "fine-third" + version maven_version + from components.java + } + } + repositories { + maven { + + url "http://mvn.finedevelop.com/repository/fanruan/" + credentials { + username = findProperty("NEXUS_USERNAME") + password = findProperty("NEXUS_PASSWORD") + } + + } + } +} + task unpack(type:Copy) { delete classesDir destinationDir=file(classesDir)