Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
武汉红喜
whatsmars
提交
dbd41335
W
whatsmars
项目概览
武汉红喜
/
whatsmars
通知
3
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
whatsmars
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
dbd41335
编写于
7月 02, 2020
作者:
武汉红喜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
whatsmars-initializr
上级
bf668cfc
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
147 addition
and
4 deletion
+147
-4
pom.xml
pom.xml
+6
-0
whatsmars-archetypes/dubbo-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
.../src/main/resources/META-INF/maven/archetype-metadata.xml
+5
-0
whatsmars-archetypes/pom.xml
whatsmars-archetypes/pom.xml
+1
-0
whatsmars-archetypes/web-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
.../src/main/resources/META-INF/maven/archetype-metadata.xml
+5
-0
whatsmars-archetypes/whatsmars-initializr/pom.xml
whatsmars-archetypes/whatsmars-initializr/pom.xml
+29
-0
whatsmars-archetypes/whatsmars-initializr/src/main/java/org/hongxi/whatsmars/initializr/Application.java
...ain/java/org/hongxi/whatsmars/initializr/Application.java
+14
-0
whatsmars-archetypes/whatsmars-initializr/src/main/java/org/hongxi/whatsmars/initializr/controller/InitializrController.java
...whatsmars/initializr/controller/InitializrController.java
+54
-0
whatsmars-archetypes/whatsmars-initializr/src/main/java/org/hongxi/whatsmars/initializr/model/ProjectMeta.java
...va/org/hongxi/whatsmars/initializr/model/ProjectMeta.java
+21
-0
whatsmars-archetypes/whatsmars-initializr/src/main/resources/generate.sh
...types/whatsmars-initializr/src/main/resources/generate.sh
+2
-4
whatsmars-archetypes/whatsmars-initializr/src/main/resources/templates/index.html
...tsmars-initializr/src/main/resources/templates/index.html
+10
-0
未找到文件。
pom.xml
浏览文件 @
dbd41335
...
...
@@ -44,6 +44,7 @@
<commons-collections.version>
3.2.2
</commons-collections.version>
<commons-dbcp.version>
1.4
</commons-dbcp.version>
<commons-fileupload.version>
1.3.3
</commons-fileupload.version>
<commons-io.version>
2.7
</commons-io.version>
<commons-lang.version>
2.6
</commons-lang.version>
<commons-logging.version>
1.2
</commons-logging.version>
<curator.version>
2.12.0
</curator.version>
...
...
@@ -117,6 +118,11 @@
<artifactId>
commons-beanutils
</artifactId>
<version>
${commons-beanutils.version}
</version>
</dependency>
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<version>
${commons-io.version}
</version>
</dependency>
<dependency>
<groupId>
commons-logging
</groupId>
<artifactId>
commons-logging
</artifactId>
...
...
whatsmars-archetypes/dubbo-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
浏览文件 @
dbd41335
...
...
@@ -2,6 +2,11 @@
<archetype-descriptor
name=
"standard"
>
<requiredProperties>
<requiredProperty
key=
"groupId"
/>
<requiredProperty
key=
"artifactId"
/>
<requiredProperty
key=
"version"
>
<defaultValue>
1.0.0-SNAPSHOT
</defaultValue>
</requiredProperty>
<requiredProperty
key=
"package"
>
<defaultValue>
${groupId}
</defaultValue>
</requiredProperty>
...
...
whatsmars-archetypes/pom.xml
浏览文件 @
dbd41335
...
...
@@ -15,6 +15,7 @@
<modules>
<module>
web-archetype
</module>
<module>
dubbo-archetype
</module>
<module>
whatsmars-initializr
</module>
</modules>
...
...
whatsmars-archetypes/web-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
浏览文件 @
dbd41335
...
...
@@ -2,6 +2,11 @@
<archetype-descriptor
name=
"standard"
>
<requiredProperties>
<requiredProperty
key=
"groupId"
/>
<requiredProperty
key=
"artifactId"
/>
<requiredProperty
key=
"version"
>
<defaultValue>
1.0.0-SNAPSHOT
</defaultValue>
</requiredProperty>
<requiredProperty
key=
"package"
>
<defaultValue>
${groupId}
</defaultValue>
</requiredProperty>
...
...
whatsmars-archetypes/whatsmars-initializr/pom.xml
0 → 100644
浏览文件 @
dbd41335
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
whatsmars-archetypes
</artifactId>
<groupId>
org.hongxi
</groupId>
<version>
Rocket.S8
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
whatsmars-initializr
</artifactId>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-thymeleaf
</artifactId>
</dependency>
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
whatsmars-archetypes/whatsmars-initializr/src/main/java/org/hongxi/whatsmars/initializr/Application.java
0 → 100644
浏览文件 @
dbd41335
package
org.hongxi.whatsmars.initializr
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
/**
* Created by shenhongxi on 2020/7/2.
*/
@SpringBootApplication
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
}
}
whatsmars-archetypes/whatsmars-initializr/src/main/java/org/hongxi/whatsmars/initializr/controller/InitializrController.java
0 → 100644
浏览文件 @
dbd41335
package
org.hongxi.whatsmars.initializr.controller
;
import
org.apache.commons.io.FileUtils
;
import
org.hongxi.whatsmars.initializr.model.ProjectMeta
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
javax.validation.Valid
;
import
java.io.File
;
/**
* Created by shenhongxi on 2020/7/2.
*/
@Controller
@RequestMapping
(
"/project"
)
public
class
InitializrController
{
private
static
final
String
CMD
=
"sh generate.sh "
;
@PostMapping
public
ResponseEntity
<
byte
[]>
initialize
(
@Valid
ProjectMeta
projectMeta
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
projectMeta
.
getPackageName
()))
{
projectMeta
.
setPackageName
(
projectMeta
.
getGroupId
());
}
StringBuilder
params
=
new
StringBuilder
(
projectMeta
.
getType
());
params
.
append
(
" "
).
append
(
projectMeta
.
getGroupId
())
.
append
(
" "
).
append
(
projectMeta
.
getArtifactId
())
.
append
(
" "
).
append
(
projectMeta
.
getPackageName
())
.
append
(
" "
).
append
(
projectMeta
.
isIncludeActuator
());
Process
process
=
null
;
try
{
process
=
Runtime
.
getRuntime
().
exec
(
CMD
+
params
);
process
.
waitFor
();
String
dst
=
projectMeta
.
getArtifactId
()
+
".tar"
;
byte
[]
content
=
FileUtils
.
readFileToByteArray
(
new
File
(
dst
));
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentDispositionFormData
(
"attachment"
,
projectMeta
.
getArtifactId
()
+
".tar"
);
headers
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM
);
return
new
ResponseEntity
<>(
content
,
headers
,
HttpStatus
.
OK
);
}
finally
{
if
(
process
!=
null
)
{
process
.
destroy
();
}
}
}
}
whatsmars-archetypes/whatsmars-initializr/src/main/java/org/hongxi/whatsmars/initializr/model/ProjectMeta.java
0 → 100644
浏览文件 @
dbd41335
package
org.hongxi.whatsmars.initializr.model
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
/**
* Created by shenhongxi on 2020/7/2.
*/
@Data
public
class
ProjectMeta
{
@NotEmpty
private
String
type
;
@NotEmpty
private
String
groupId
;
@NotEmpty
private
String
artifactId
;
private
String
packageName
;
private
boolean
includeActuator
;
}
whatsmars-archetypes/generate.sh
→
whatsmars-archetypes/
whatsmars-initializr/src/main/resources/
generate.sh
浏览文件 @
dbd41335
...
...
@@ -27,8 +27,8 @@ rm -f ${artifactId}.tar
mvn archetype:generate
\
-DarchetypeCatalog
=
internal
\
-DarchetypeGroupId
=
org.hongxi
\
-DarchetypeArtifactId
=
${
type
}
-archetype
\
-DarchetypeGroupId
=
org.hongxi
\
-DarchetypeArtifactId
=
${
type
}
-archetype
\
-DarchetypeVersion
=
Rocket.S8
\
-DgroupId
=
${
groupId
}
\
-DartifactId
=
${
artifactId
}
\
...
...
@@ -42,5 +42,3 @@ rm -rf ${artifactId}
time
=
$(
date
"+%Y-%m-%d %H:%M:%S"
)
echo
"
${
time
}
create project
${
artifactId
}
successfully"
>>
generate-project.log
# 可用java调用此脚本生成工程,上传至某个地方,然后下载
\ No newline at end of file
whatsmars-archetypes/whatsmars-initializr/src/main/resources/templates/index.html
0 → 100644
浏览文件 @
dbd41335
<!DOCTYPE html>
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:th=
"http://www.thymeleaf.org"
xmlns:sec=
"http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"
>
<head>
<title>
initializr
</title>
</head>
<body>
whatsmars initializr
</body>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录