diff --git a/src/main/java/io/nutz/demo/maker/module/MakerModule.java b/src/main/java/io/nutz/demo/maker/module/MakerModule.java
index c895cf1c71da23af01067199cce923d199e5fe4f..7e2f80c88a7f7b72b62f3feceb72bbe9ecd45d0e 100644
--- a/src/main/java/io/nutz/demo/maker/module/MakerModule.java
+++ b/src/main/java/io/nutz/demo/maker/module/MakerModule.java
@@ -17,6 +17,7 @@ import org.nutz.jst.loader.impl.JstClasspathLoader;
import org.nutz.lang.Files;
import org.nutz.lang.Lang;
import org.nutz.lang.Streams;
+import org.nutz.lang.Strings;
import org.nutz.lang.random.R;
import org.nutz.lang.util.Context;
import org.nutz.lang.util.Disks;
@@ -70,8 +71,25 @@ public class MakerModule {
// 接下来,生成src/main里面的东西
// 生成application.properties
- String applicationPropertiesStr = _render("src/main/resources/application.properties", params);
- _write(new File(tmpRoot, "src/main/resources/application.properties"), applicationPropertiesStr);
+
+ // 根据params.pout.enable 判断是否要以打包在外面的方式生成文件
+
+ if(getEnable(params, "pout")) {
+ createProperties(params, tmpRoot, "beetlsql.properties");
+ createProperties(params, tmpRoot, "db.properties");
+ createProperties(params, tmpRoot, "mongo.properties");
+ createProperties(params, tmpRoot, "ngrok.properties");
+ createProperties(params, tmpRoot, "redis.properties");
+ createProperties(params, tmpRoot, "server.properties");
+ createProperties(params, tmpRoot, "uflo.properties");
+ createProperties(params, tmpRoot, "undertow.properties");
+ createProperties(params, tmpRoot, "ureport.properties");
+ createProperties(params, tmpRoot, "urule.properties");
+ _write(new File(tmpRoot, "src/main/resources/application.properties"), "nutz.boot.configure.properties.dir=config");
+ } else {
+ String applicationPropertiesStr = _render("src/main/resources/application.properties", params);
+ _write(new File(tmpRoot, "src/main/resources/application.properties"), applicationPropertiesStr);
+ }
// 生成log4j.properties
String log4jPropertiesStr = _render("src/main/resources/log4j.properties", params);
@@ -144,6 +162,17 @@ public class MakerModule {
zip.flush();
zip.close();
}
+
+ // 根据key获取enable属性
+ protected Boolean getEnable(NutMap params, String key) {
+ NutMap poutMap = (NutMap)params.get(key);
+ return poutMap.getBoolean("enable");
+ }
+ // 生成配置文件
+ protected void createProperties(NutMap params, File tmpRoot, String fileName) {
+ String propertiesStr = _render("src/main/resources/config/" + fileName, params);
+ if(!Strings.isBlank(propertiesStr.trim())) _write(new File(tmpRoot, "src/main/resources/config/" + fileName), propertiesStr);
+ }
public void init() {
tmpDir = new File(conf.get("nutz.maker.tmpdir", "/tmp/maker")).getAbsoluteFile();
diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html
index 01573bfedca62d7bfbc0d3f40072c6118170f308..14a0781d12055086211494851be742702b279834 100644
--- a/src/main/resources/static/index.html
+++ b/src/main/resources/static/index.html
@@ -183,6 +183,11 @@
+
+
+
+
+
立即创建
@@ -333,6 +338,9 @@
},
configClient: {
enable: false
+ },
+ pout: {
+ enable: false
}
},
nbJson: "",
@@ -389,15 +397,15 @@
return false;
}
if (this.nb.jetty.enable && this.nb.tomcat.enable) {
- alert("Jetty和Tomcat只能选一个");
+ alert("Jetty和Tomcat只能选一个");
return false;
}
if (this.nb.jetty.enable && this.nb.undertow.enable) {
- alert("Jetty和Undertow只能选一个");
+ alert("Jetty和Undertow只能选一个");
return false;
}
if (this.nb.tomcat.enable && this.nb.undertow.enable) {
- alert("Tomcat和Undertow只能选一个");
+ alert("Tomcat和Undertow只能选一个");
return false;
}
this.nbJson = JSON.stringify(this.nb, null, 2);
diff --git a/src/main/resources/template/_pom.xml b/src/main/resources/template/_pom.xml
index b6f9a543c5e03644edc480af3ac7c2f5f77ecd35..457471a17052cf15485331b3379a829b959fdec5 100644
--- a/src/main/resources/template/_pom.xml
+++ b/src/main/resources/template/_pom.xml
@@ -92,7 +92,44 @@
+# if(params.pout && params.pout.enable) {
+
+
+ src/main/resources
+
+ **/*
+
+ true
+
+
+# }
+# if(params.pout && params.pout.enable) {
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ copy-resources
+ package
+
+ copy-resources
+
+
+ UTF-8
+
+ $${project.build.directory}
+
+
+
+ src/main/resources/
+
+
+
+
+
+
+# }
maven-compiler-plugin
3.7.0
@@ -118,6 +155,49 @@
nutzboot-maven-plugin
$${nutzboot.version}
+# if(params.pout && params.pout.enable) {
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.0.2
+
+
+
+ true
+ lib/
+ false
+ true
+ true
+ ${params.packageName}.MainLauncher
+
+
+ .
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy
+ package
+
+ copy-dependencies
+
+
+
+ $${project.build.directory}/lib
+
+ false
+ false
+ true
+
+
+
+
+# }
diff --git a/src/main/resources/template/src/main/resources/config/beetlsql.properties b/src/main/resources/template/src/main/resources/config/beetlsql.properties
new file mode 100644
index 0000000000000000000000000000000000000000..2233dd8021c8cb2a1bd700e86bfa2d6edf094b73
--- /dev/null
+++ b/src/main/resources/template/src/main/resources/config/beetlsql.properties
@@ -0,0 +1,6 @@
+# if (params.beetlsql.enable) {
+beetlsql.dbStyle=mysql
+beetlsql.nameconv=default
+beetlsql.debug=true
+beetlsql.trans=true
+# }
\ No newline at end of file
diff --git a/src/main/resources/template/src/main/resources/config/db.properties b/src/main/resources/template/src/main/resources/config/db.properties
new file mode 100644
index 0000000000000000000000000000000000000000..baf58571f368d1de459e2d5d6e4a350f1ad17c1c
--- /dev/null
+++ b/src/main/resources/template/src/main/resources/config/db.properties
@@ -0,0 +1,6 @@
+# if (params.jdbc.enable) {
+jdbc.type=druid
+jdbc.url=${params.jdbc.url}
+jdbc.username=${params.jdbc.username}
+jdbc.password=${params.jdbc.password}
+# }
\ No newline at end of file
diff --git a/src/main/resources/template/src/main/resources/config/mongo.properties b/src/main/resources/template/src/main/resources/config/mongo.properties
new file mode 100644
index 0000000000000000000000000000000000000000..e16f0385218a80ee756842976c28d5b8b355eb06
--- /dev/null
+++ b/src/main/resources/template/src/main/resources/config/mongo.properties
@@ -0,0 +1,3 @@
+# if (params.mongo.enable) {
+mongo.dbname=[[${params.mongo.dbname}]]
+# }
\ No newline at end of file
diff --git a/src/main/resources/template/src/main/resources/config/ngrok.properties b/src/main/resources/template/src/main/resources/config/ngrok.properties
new file mode 100644
index 0000000000000000000000000000000000000000..1bfce083d466f2ab7b7ae7918f7b1874dde15dc8
--- /dev/null
+++ b/src/main/resources/template/src/main/resources/config/ngrok.properties
@@ -0,0 +1,3 @@
+# if (params.ngrok.enable) {
+ngrok.client.auth_token=login nutz.cn to get you key
+# }
\ No newline at end of file
diff --git a/src/main/resources/template/src/main/resources/config/redis.properties b/src/main/resources/template/src/main/resources/config/redis.properties
new file mode 100644
index 0000000000000000000000000000000000000000..081913d0d28677da6ea087caad15a0a722d3b7f5
--- /dev/null
+++ b/src/main/resources/template/src/main/resources/config/redis.properties
@@ -0,0 +1,6 @@
+# if (params.redis.enable) {
+redis.host=127.0.0.1
+redis.port=6379
+redis.timeout=2000
+redis.database=0
+# }
\ No newline at end of file
diff --git a/src/main/resources/template/src/main/resources/config/server.properties b/src/main/resources/template/src/main/resources/config/server.properties
new file mode 100644
index 0000000000000000000000000000000000000000..74fe6340031262066250623756dfad6c231b5e83
--- /dev/null
+++ b/src/main/resources/template/src/main/resources/config/server.properties
@@ -0,0 +1,8 @@
+# if (params.jetty.enable || params.tomcat.enable || params.undertow.enable ) {
+server.port=${params.jetty.port || 8080}
+server.host=${params.jetty.host || "0.0.0.0"}
+# }
+# if (params.tomcat.enable) {
+tomcat.port=8080
+tomcat.host=0.0.0.0
+# }
\ No newline at end of file
diff --git a/src/main/resources/template/src/main/resources/config/uflo.properties b/src/main/resources/template/src/main/resources/config/uflo.properties
new file mode 100644
index 0000000000000000000000000000000000000000..82796b220c7d1822bcceb0d38790857659dd9752
--- /dev/null
+++ b/src/main/resources/template/src/main/resources/config/uflo.properties
@@ -0,0 +1,3 @@
+# if (params.uflo2.enable) {
+uflo.debug=true
+# }
\ No newline at end of file
diff --git a/src/main/resources/template/src/main/resources/config/undertow.properties b/src/main/resources/template/src/main/resources/config/undertow.properties
new file mode 100644
index 0000000000000000000000000000000000000000..7f8aa74f06234187b207b188d5ad8ded30437610
--- /dev/null
+++ b/src/main/resources/template/src/main/resources/config/undertow.properties
@@ -0,0 +1,4 @@
+# if (params.undertow.enable) {
+undertow.port=8080
+undertow.host=0.0.0.0
+# }
\ No newline at end of file
diff --git a/src/main/resources/template/src/main/resources/config/ureport.properties b/src/main/resources/template/src/main/resources/config/ureport.properties
new file mode 100644
index 0000000000000000000000000000000000000000..de2ee4040015da2b6313f9c5084e02da796c80bf
--- /dev/null
+++ b/src/main/resources/template/src/main/resources/config/ureport.properties
@@ -0,0 +1,3 @@
+# if (params.ureport.enable) {
+ureport.repository.dir=./ureport.repo
+# }
\ No newline at end of file
diff --git a/src/main/resources/template/src/main/resources/config/urule.properties b/src/main/resources/template/src/main/resources/config/urule.properties
new file mode 100644
index 0000000000000000000000000000000000000000..a3fe458d99be5816e2d696677528cdba02a9148d
--- /dev/null
+++ b/src/main/resources/template/src/main/resources/config/urule.properties
@@ -0,0 +1,3 @@
+# if (params.urule.enable) {
+urule.repository.dir=./urule.repo
+# }
\ No newline at end of file