Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fenghuo12
zheng
提交
0374166e
Z
zheng
项目概览
fenghuo12
/
zheng
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zheng
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0374166e
编写于
12月 18, 2016
作者:
shuzheng5201314
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
依赖zhengAdmin
上级
17ea94cb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
134 addition
and
4 deletion
+134
-4
zheng-common/src/main/java/com/zheng/common/util/JarUtil.java
...g-common/src/main/java/com/zheng/common/util/JarUtil.java
+77
-0
zheng-upms/zheng-upms-server/pom.xml
zheng-upms/zheng-upms-server/pom.xml
+7
-3
zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/admin/util/ZhengAdminUtil.java
...c/main/java/com/zheng/upms/admin/util/ZhengAdminUtil.java
+39
-0
zheng-upms/zheng-upms-server/src/main/resources/applicationContext-zhengAdmin.xml
...rver/src/main/resources/applicationContext-zhengAdmin.xml
+9
-0
zheng-upms/zheng-upms-server/src/main/resources/config.properties
...ms/zheng-upms-server/src/main/resources/config.properties
+2
-1
未找到文件。
zheng-common/src/main/java/com/zheng/common/util/JarUtil.java
0 → 100644
浏览文件 @
0374166e
package
com.zheng.common.util
;
import
java.io.*
;
import
java.util.Enumeration
;
import
java.util.jar.JarEntry
;
import
java.util.jar.JarFile
;
/**
* Created by shuzheng on 2016/12/18.
*/
public
class
JarUtil
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"start"
);
decompress
(
"F:\\GitHub\\zhengAdmin\\target\\zhengAdmin.jar"
,
"F:\\GitHub\\zhengAdmin\\target\\test"
);
System
.
out
.
println
(
"end"
);
}
/**
* 解压jar文件到指定目录
* @param fileName
* @param outputPath
*/
public
static
synchronized
void
decompress
(
String
fileName
,
String
outputPath
)
{
// 保证输出路径为目录
if
(!
outputPath
.
endsWith
(
File
.
separator
))
{
outputPath
+=
File
.
separator
;
}
// 如果不存在输出目录,则创建
File
dir
=
new
File
(
outputPath
);
if
(!
dir
.
exists
())
{
dir
.
mkdirs
();
}
// 解压到输出目录
JarFile
jf
=
null
;
try
{
jf
=
new
JarFile
(
fileName
);
for
(
Enumeration
<
JarEntry
>
e
=
jf
.
entries
();
e
.
hasMoreElements
();
)
{
JarEntry
je
=
(
JarEntry
)
e
.
nextElement
();
String
outFileName
=
outputPath
+
je
.
getName
();
File
f
=
new
File
(
outFileName
);
if
(
je
.
isDirectory
())
{
if
(!
f
.
exists
())
{
f
.
mkdirs
();
}
}
else
{
File
pf
=
f
.
getParentFile
();
if
(!
pf
.
exists
())
{
pf
.
mkdirs
();
}
InputStream
in
=
jf
.
getInputStream
(
je
);
OutputStream
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
f
));
byte
[]
buffer
=
new
byte
[
2048
];
int
nBytes
=
0
;
while
((
nBytes
=
in
.
read
(
buffer
))
>
0
)
{
out
.
write
(
buffer
,
0
,
nBytes
);
}
out
.
flush
();
out
.
close
();
in
.
close
();
}
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"解压"
+
fileName
+
"出错---"
+
e
.
getMessage
());
}
finally
{
if
(
jf
!=
null
)
{
try
{
jf
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
zheng-upms/zheng-upms-server/pom.xml
浏览文件 @
0374166e
...
@@ -19,7 +19,11 @@
...
@@ -19,7 +19,11 @@
<groupId>
com.zheng
</groupId>
<groupId>
com.zheng
</groupId>
<artifactId>
zheng-upms-service
</artifactId>
<artifactId>
zheng-upms-service
</artifactId>
<version>
1.0.0
</version>
<version>
1.0.0
</version>
<type>
jar
</type>
</dependency>
<dependency>
<groupId>
com.github.shuzheng
</groupId>
<artifactId>
zhengAdmin
</artifactId>
<version>
1.0.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
junit
</groupId>
<groupId>
junit
</groupId>
...
@@ -80,8 +84,8 @@
...
@@ -80,8 +84,8 @@
<plugin>
<plugin>
<groupId>
org.eclipse.jetty
</groupId>
<groupId>
org.eclipse.jetty
</groupId>
<artifactId>
jetty-maven-plugin
</artifactId>
<artifactId>
jetty-maven-plugin
</artifactId>
<
version>
9.0.0.v20130308
</version
>
<
!--<version>9.0.0.v20130308</version>--
>
<
!--<version>9.2.7.v20150116</version>--
>
<
version>
9.2.7.v20150116
</version
>
<configuration>
<configuration>
<scanIntervalSeconds>
3
</scanIntervalSeconds>
<scanIntervalSeconds>
3
</scanIntervalSeconds>
<webApp>
<webApp>
...
...
zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/admin/util/ZhengAdminUtil.java
0 → 100644
浏览文件 @
0374166e
package
com.zheng.upms.admin.util
;
import
com.zheng.common.util.JarUtil
;
import
com.zheng.common.util.PropertiesFileUtil
;
import
com.zheng.upms.admin.controller.SSOController
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.web.context.ServletContextAware
;
import
javax.servlet.ServletContext
;
/**
* 启动解压zhengAdmin-x.x.x.jar到resources目录
* Created by shuzheng on 2016/12/18.
*/
public
class
ZhengAdminUtil
implements
InitializingBean
,
ServletContextAware
{
private
static
Logger
_log
=
LoggerFactory
.
getLogger
(
ZhengAdminUtil
.
class
);
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
}
@Override
public
void
setServletContext
(
ServletContext
servletContext
)
{
_log
.
info
(
"===== 开始解压zhengAdmin ====="
);
String
version
=
PropertiesFileUtil
.
getInstance
().
get
(
"zhengAdmin.version"
);
_log
.
info
(
"zhengAdmin.jar 版本: {}"
,
version
);
String
jarPath
=
servletContext
.
getRealPath
(
"/WEB-INF/lib/zhengAdmin-"
+
version
+
".jar"
);
_log
.
info
(
"zhengAdmin.jar 包路径: {}"
,
jarPath
);
String
resources
=
servletContext
.
getRealPath
(
"/resources"
);
_log
.
info
(
"zhengAdmin.jar 解压到: {}"
,
resources
);
JarUtil
.
decompress
(
jarPath
,
resources
);
_log
.
info
(
"===== 解压zhengAdmin完成 ====="
);
}
}
zheng-upms/zheng-upms-server/src/main/resources/applicationContext-zhengAdmin.xml
0 → 100644
浏览文件 @
0374166e
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
>
<!-- 启动解压zhengAdmin-x.x.x.jar到resources目录 -->
<bean
id=
"zhengAdminUtil"
class=
"com.zheng.upms.admin.util.ZhengAdminUtil"
></bean>
</beans>
\ No newline at end of file
zheng-upms/zheng-upms-server/src/main/resources/config.properties
浏览文件 @
0374166e
env
=
${profile.env}
env
=
${profile.env}
\ No newline at end of file
zhengAdmin.version
=
1.0.0
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录