diff --git a/build.gradle b/build.gradle index b8a7532..5b7e506 100644 --- a/build.gradle +++ b/build.gradle @@ -10,8 +10,20 @@ ext{ // 项目中依赖的jar的路径 // 如果依赖的jar需要打包到zip中,放置在/lib目录下 libPath = "$projectDir/webroot/WEB-INF/lib" + pluginPre = "fr-plugin" + pluginName = "extendedCharts" + pluginVersion = getVersion() } +/*读取plugin.xml中的version*/ +def getVersion(){ + def xmlFile = "./plugin.xml" + def plugin = new XmlParser().parse(xmlFile) + return plugin.version[0].text() +} + + + repositories { mavenLocal() maven { @@ -67,25 +79,28 @@ jar.dependsOn("preJar") task makeJar(type: Jar,dependsOn: preJar){ from fileTree(dir:"$buildDir/classes/java/main") + baseName pluginPre + appendix pluginName + version pluginVersion destinationDir = file("$buildDir/libs") } -task copyFile(type: Copy,dependsOn: ["jar"]){ +task copyFile(type: Copy,dependsOn: ["makeJar"]){ from "$buildDir/libs" from("$projectDir/lib") { include "*.jar" } from "$projectDir/plugin.xml" - into file("$buildDir/temp/fr-"+"$project.name"+"-$project.version") + into file("$buildDir/temp/fr-plugin-"+"$pluginName"+"-$pluginVersion") } task zip(type:Zip,dependsOn:["copyFile"]){ from "$buildDir/temp" destinationDir file("$buildDir/install") //生成的文件名: baseName-appendix-0.0.1.zip -// baseName 'baseName' -// appendix 'appendix' -// version '0.0.1' + baseName pluginPre + appendix pluginName + version pluginVersion } //控制build时包含哪些文件,排除哪些文件