Browse Source

打的jar包以及zip,名称完全和ant打包一致,版本号来自plugin.xml,jar名字来自gradle定义的属性

pull/5/head
tianxx7 4 years ago
parent
commit
c79ff4b3e6
  1. 25
      build.gradle

25
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时包含哪些文件,

Loading…
Cancel
Save