Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
7b64118a
o2oa
项目概览
weixin_42566577
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7b64118a
编写于
8月 03, 2022
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update version with git.
上级
5a6be422
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
48 addition
and
50 deletion
+48
-50
o2server/pom.xml
o2server/pom.xml
+10
-1
o2server/x_base_core_project/src/main/java/com/x/base/core/project/build/CreateVersion.java
...ain/java/com/x/base/core/project/build/CreateVersion.java
+38
-11
o2server/x_base_core_project/src/main/java/com/x/base/core/project/build/PackageO2server.java
...n/java/com/x/base/core/project/build/PackageO2server.java
+0
-38
未找到文件。
o2server/pom.xml
浏览文件 @
7b64118a
...
...
@@ -391,6 +391,10 @@
<groupId>
io.swagger.core.v3
</groupId>
<artifactId>
swagger-jaxrs2
</artifactId>
</dependency>
<dependency>
<groupId>
org.eclipse.jgit
</groupId>
<artifactId>
org.eclipse.jgit
</artifactId>
</dependency>
</dependencies>
<build>
<finalName>
${project.artifactId}
</finalName>
...
...
@@ -812,7 +816,7 @@
<dependency>
<groupId>
com.hankcs
</groupId>
<artifactId>
hanlp
</artifactId>
<version>
portable-1.
7.4
</version>
<version>
portable-1.
8.3
</version>
</dependency>
<dependency>
<groupId>
de.vandermeer
</groupId>
...
...
@@ -1104,6 +1108,11 @@
<artifactId>
swagger-jaxrs2
</artifactId>
<version>
2.2.0
</version>
</dependency>
<dependency>
<groupId>
org.eclipse.jgit
</groupId>
<artifactId>
org.eclipse.jgit
</artifactId>
<version>
6.2.0.202206071550-r
</version>
</dependency>
</dependencies>
</dependencyManagement>
<!--repositories>
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/build/CreateVersion.java
浏览文件 @
7b64118a
...
...
@@ -2,33 +2,60 @@ package com.x.base.core.project.build;
import
java.io.File
;
import
java.io.FileReader
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Date
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.maven.model.Model
;
import
org.apache.maven.model.io.xpp3.MavenXpp3Reader
;
import
org.eclipse.jgit.api.DescribeCommand
;
import
org.eclipse.jgit.api.Git
;
import
com.x.base.core.project.gson.XGsonBuilder
;
import
com.x.base.core.project.tools.DateTools
;
import
com.x.base.core.project.tools.DefaultCharset
;
public
class
CreateVersion
{
public
static
void
main
(
String
...
args
)
throws
Exception
{
File
base
=
new
File
(
args
[
0
]);
File
file
=
new
File
(
base
,
"version.o2"
);
File
pom
=
new
File
(
base
,
"pom.xml"
);
MavenXpp3Reader
reader
=
new
MavenXpp3Reader
();
Model
model
=
reader
.
read
(
new
FileReader
(
pom
));
LinkedHashMap
<
String
,
String
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"version"
,
model
.
getVersion
()
+
""
);
map
.
put
(
"date"
,
DateTools
.
format
(
new
Date
()));
Map
<
String
,
String
>
map
=
fromGit
(
base
);
if
(
map
.
isEmpty
())
{
map
=
fromMaven
(
base
);
}
FileUtils
.
write
(
file
,
XGsonBuilder
.
toJson
(
map
),
StandardCharsets
.
UTF_8
);
System
.
exit
(
0
);
}
FileUtils
.
write
(
file
,
XGsonBuilder
.
toJson
(
map
),
DefaultCharset
.
charset_utf_8
);
private
static
Map
<
String
,
String
>
fromGit
(
File
base
)
{
Map
<
String
,
String
>
map
=
new
LinkedHashMap
<>();
File
dir
=
base
.
getParentFile
().
getAbsoluteFile
();
try
(
Git
git
=
Git
.
init
().
setDirectory
(
dir
).
call
())
{
DescribeCommand
describeCommand
=
git
.
describe
().
setTags
(
true
).
setAlways
(
true
);
String
version
=
describeCommand
.
call
();
map
.
put
(
"version"
,
version
);
map
.
put
(
"date"
,
DateTools
.
format
(
new
Date
()));
return
map
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
new
LinkedHashMap
<>();
}
private
static
Map
<
String
,
String
>
fromMaven
(
File
base
)
{
Map
<
String
,
String
>
map
=
new
LinkedHashMap
<>();
try
{
File
pom
=
new
File
(
base
,
"pom.xml"
);
MavenXpp3Reader
reader
=
new
MavenXpp3Reader
();
Model
model
=
reader
.
read
(
new
FileReader
(
pom
));
map
.
put
(
"version"
,
model
.
getVersion
()
+
""
);
map
.
put
(
"date"
,
DateTools
.
format
(
new
Date
()));
return
map
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
new
LinkedHashMap
<>();
}
}
o2server/x_base_core_project/src/main/java/com/x/base/core/project/build/PackageO2server.java
浏览文件 @
7b64118a
...
...
@@ -25,47 +25,9 @@ public class PackageO2server {
public
static
void
main
(
String
...
args
)
throws
Exception
{
File
base
=
new
File
(
args
[
0
]).
getParentFile
();
createO2Version
(
base
.
getAbsolutePath
());
CreateConfigSample
.
main
(
base
.
getAbsolutePath
());
CreateLocalSample
.
main
(
base
.
getAbsolutePath
());
CreateVersion
.
main
(
base
.
getAbsolutePath
());
}
public
static
void
compress
(
ZipOutputStream
outputStream
,
String
base
,
String
path
)
throws
Exception
{
File
file
=
new
File
(
base
,
path
);
if
(!
file
.
exists
())
{
System
.
out
.
println
(
"file or directory not exist:"
+
path
+
"."
);
return
;
}
if
(
file
.
isFile
())
{
outputStream
.
putNextEntry
(
new
ZipEntry
(
path
));
byte
[]
bytes
=
Files
.
readAllBytes
(
Paths
.
get
(
file
.
getAbsolutePath
()));
outputStream
.
write
(
bytes
,
0
,
bytes
.
length
);
}
else
if
(
file
.
isDirectory
())
{
Path
b
=
Paths
.
get
(
base
);
Files
.
walkFileTree
(
Paths
.
get
(
file
.
getAbsolutePath
()),
new
SimpleFileVisitor
<
Path
>()
{
public
FileVisitResult
visitFile
(
Path
file
,
BasicFileAttributes
attributes
)
{
try
{
Path
p
=
b
.
relativize
(
file
);
outputStream
.
putNextEntry
(
new
ZipEntry
(
p
.
toString
()));
byte
[]
bytes
=
Files
.
readAllBytes
(
file
);
outputStream
.
write
(
bytes
,
0
,
bytes
.
length
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
FileVisitResult
.
CONTINUE
;
}
});
}
}
public
static
void
createO2Version
(
String
base
)
throws
Exception
{
File
file
=
new
File
(
base
,
"version.o2"
);
FileUtils
.
write
(
file
,
DateTools
.
format
(
new
Date
(),
DateTools
.
format_yyyyMMddHHmmss
),
DefaultCharset
.
charset_utf_8
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录