Commit eab6e157 authored by maweidong's avatar maweidong

feat:新增APP版本

parent 2b36f33e
...@@ -94,12 +94,12 @@ def isSnapshot() { ...@@ -94,12 +94,12 @@ def isSnapshot() {
return "SNAPSHOT" == getChannelString() return "SNAPSHOT" == getChannelString()
} }
task printenv() { //task printenv() {
// for (Map.Entry<String, String> entry : System.getenv()) { //// for (Map.Entry<String, String> entry : System.getenv()) {
// println("key:${entry.key},value:${entry.value}") //// println("key:${entry.key},value:${entry.value}")
// } //// }
getBizModuleLastVersion() // getBizModuleLastVersion()
} //}
def getBizModuleLastVersion() { def getBizModuleLastVersion() {
...@@ -136,49 +136,49 @@ def getBizModuleLastVersion() { ...@@ -136,49 +136,49 @@ def getBizModuleLastVersion() {
def getHttpVersion(def group, def module) { def getHttpVersion(def group, def module) {
def group_path = group.replace(".", "/") def group_path = group.replace(".", "/")
HttpURLConnection connection = null; HttpURLConnection connection = null
InputStream is = null; InputStream is = null
BufferedReader br = null; BufferedReader br = null
String result = null;// 返回结果字符串 String result = null// 返回结果字符串
try { try {
// 创建远程url连接对象 // 创建远程url连接对象
URL url = new URL("https://nexus3.yit.com/repository/maven-public/$group_path/$module/maven-metadata.xml"); URL url = new URL("https://nexus3.yit.com/repository/maven-public/$group_path/$module/maven-metadata.xml")
// 通过远程url连接对象打开一个连接 , 强转成httpURLConnection类 // 通过远程url连接对象打开一个连接 , 强转成httpURLConnection类
connection = (HttpURLConnection) url.openConnection(); connection = (HttpURLConnection) url.openConnection()
// 设置连接方式:get // 设置连接方式:get
connection.setRequestMethod("GET"); connection.setRequestMethod("GET")
// 设置连接主机服务器的超时时间:15000毫秒 // 设置连接主机服务器的超时时间:15000毫秒
connection.setConnectTimeout(15000); connection.setConnectTimeout(15000)
// 设置读取远程返回的数据时间:60000毫秒 // 设置读取远程返回的数据时间:60000毫秒
connection.setReadTimeout(60000); connection.setReadTimeout(60000)
// 发送请求 // 发送请求
connection.connect(); connection.connect()
// 通过connection连接,获取输入流 // 通过connection连接,获取输入流
if (connection.getResponseCode() == 200) { if (connection.getResponseCode() == 200) {
is = connection.getInputStream(); is = connection.getInputStream()
// 封装输入流is,并指定字符集 // 封装输入流is,并指定字符集
br = new BufferedReader(new InputStreamReader(is, "UTF-8")); br = new BufferedReader(new InputStreamReader(is, "UTF-8"))
// 存放数据 // 存放数据
StringBuffer sbf = new StringBuffer(); StringBuffer sbf = new StringBuffer()
String temp = null; String temp = null
while ((temp = br.readLine()) != null) { while ((temp = br.readLine()) != null) {
sbf.append(temp); sbf.append(temp)
sbf.append("\r\n"); sbf.append("\r\n")
} }
result = sbf.toString(); result = sbf.toString()
} }
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
e.printStackTrace(); e.printStackTrace()
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace()
} finally { } finally {
// 关闭资源 // 关闭资源
if (null != br) { if (null != br) {
try { try {
br.close(); br.close()
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace()
} }
} }
...@@ -186,15 +186,15 @@ def getHttpVersion(def group, def module) { ...@@ -186,15 +186,15 @@ def getHttpVersion(def group, def module) {
try { try {
is.close(); is.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace()
} }
} }
connection.disconnect();// 关闭远程连接 connection.disconnect()// 关闭远程连接
} }
def xmlSlurper = new XmlSlurper() def xmlSlurper = new XmlSlurper()
def response = xmlSlurper.parseText(result) def response = xmlSlurper.parseText(result)
println("$module ${response.versioning.latest}") println("$module=${response.versioning.latest}")
} }
......
ext { ext {
app_version = "4.0.0" app_version = "4.0.0"
shell = "4.0.0.2" shell = "4.0.0.3-SNAPSHOT"
shop = "4.0.0.2" shop = "4.0.0.2"
live = "4.0.0.2" live = "4.0.0.2"
cms = "4.0.0.2" cms = "4.0.0.3-SNAPSHOT"
base = "4.0.0.9" base = "4.0.0.10-SNAPSHOT"
food = "3.2.0.6" food = "3.2.0.6"
browser = "4.0.0.4" browser = "4.0.0.4"
category = "4.0.0.2" category = "4.0.0.2"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment