@ -26,7 +26,6 @@ import java.util.ArrayList;
import java.util.Date ;
import java.util.HashMap ;
import java.util.concurrent.Callable ;
import java.util.regex.Pattern ;
public class SpringBootCallable implements Callable {
@ -62,81 +61,41 @@ public class SpringBootCallable implements Callable {
// 生成资源目录
File resourcesDir = Tool . createPath ( dir , "src" , "main" , "resources" ) ;
// 生成域名目录
File domainDir = javaDir ;
for ( String s : project . getDomain ( ) . split ( "\\." ) ) {
domainDir = Tool . createPath ( domainDir , s ) ;
}
File domainDir = Tool . createPath ( javaDir , project . getDomain ( ) . split ( "\\." ) ) ;
// 生成单元测试java目录
File testJavaDir = Tool . createPath ( dir , "src" , "test" , "java" ) ;
File testDomainDir = testJavaDir ;
for ( String s : project . getDomain ( ) . split ( "\\." ) ) {
testDomainDir = Tool . createPath ( testDomainDir , s ) ;
}
// 生成单元测试域名目录
File testDomainDir = Tool . createPath ( testJavaDir , project . getDomain ( ) . split ( "\\." ) ) ;
// 生成单元测试resources目录
File testResourcesDir = Tool . createPath ( dir , "src" , "test" , "resources" ) ;
// 生成POM
generatePom ( dir , project ) ;
// Application
// 生成Application
System . out . println ( "生成模块:Application" ) ;
generateApplication ( Tool . createPath ( domainDir ) , project ) ;
if ( project . getFrame ( ) . value ( ) > Frame . 空 白 框 架 . value ( ) ) { //生成java文件
//生成 Controller
if ( project . getFrame ( ) . value ( ) > = Frame . 接 口 框 架 . value ( ) ) {
System . out . println ( "生成模块:action" ) ;
generateController ( Tool . createPath ( domainDir , "action" ) , project ) ;
}
// 生成 Config
if ( project . getFrame ( ) . value ( ) > = Frame . 服 务 框 架 . value ( ) ) {
System . out . println ( "生成模块:config" ) ;
generateConfig ( Tool . createPath ( domainDir , "config" ) , project ) ;
}
// 模块
generateModule ( Tool . createPath ( domainDir , "module" ) , project ) ;
if ( project . getFrame ( ) . value ( ) > = Frame . 服 务 框 架 . value ( ) ) {
generateModuleFor 服 务 框 架 ( Tool . createPath ( domainDir , "module" ) , project ) ;
}
if ( project . getFrame ( ) . value ( ) > = Frame . 接 口 框 架 . value ( ) ) {
generateModuleFor 接 口 框 架 ( Tool . createPath ( domainDir , "module" ) , project ) ;
}
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) {
generateModuleFor 网 页 框 架 ( Tool . createPath ( domainDir , "module" ) , project ) ;
}
// frame等内容
if ( project . getFrame ( ) . value ( ) > Frame . 空 白 框 架 . value ( ) ) {
System . out . println ( "生成模块:frame" ) ;
generateFrame ( Tool . createPath ( domainDir , "frame" ) , project ) ;
}
// Task
System . out . println ( "生成模块:module" ) ;
generateModule ( Tool . createPath ( domainDir , "module" ) , project ) ;
System . out . println ( "生成模块:task" ) ;
if ( project . getFrame ( ) . value ( ) > Frame . 空 白 框 架 . value ( ) ) {
generateTask ( Tool . createPath ( domainDir , "task" ) , project ) ;
}
}
generateResources_template ( resourcesDir , project ) ;
generateModuleForSys ( Tool . createPath ( domainDir , "module" ) , project ) ;
//生成resources文件
generateResources ( resourcesDir , project ) ;
if ( project . getFrame ( ) . value ( ) > Frame . 空 白 框 架 . value ( ) ) {
{ //生成Test
System . out . println ( "生成模块:Test" ) ;
generateTest ( testDomainDir , project ) ;
}
{ //生成Test Resources
System . out . println ( "生成模块:Test Resources" ) ;
generateTestResources ( testResourcesDir , project ) ;
}
}
System . out . println ( "finish" ) ;
return true ;
@ -172,7 +131,6 @@ public class SpringBootCallable implements Callable {
ctx . put ( "author" , project . getAuthor ( ) ) ;
ctx . put ( "modules" , project . getModules ( ) ) ;
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) {
File control = Tool . createPath ( root , "control" ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( control , "Header.java" ) , "SpringBoot/java/action/control/Header.java" , ctx ) ;
@ -197,17 +155,11 @@ public class SpringBootCallable implements Callable {
}
}
if ( project . getFrame ( ) . value ( ) >= Frame . 网 页 框 架 . value ( ) ) { //生成系统模块
if ( project . getFrame ( ) . value ( ) == Frame . 管 理 框 架 . value ( ) ) { //管理架构
File wsys = Tool . createPath ( ajax , "wsys" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/action/ajax/wsys/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( wsys , name ) , "SpringBoot/java/action/ajax/wsys/" + name , ctx ) ;
}
File wsvr = Tool . createPath ( ajax , "wsvr" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/action/ajax/wsvr/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( wsvr , name ) , "SpringBoot/java/action/ajax/wsvr/" + name , ctx ) ;
}
}
}
}
@ -229,7 +181,7 @@ public class SpringBootCallable implements Callable {
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 网页 框 架 . value ( ) ) { //生成系统模块
if ( project . getFrame ( ) . value ( ) > = Frame . 管理 框 架 . value ( ) ) { //生成系统模块
File wsys = Tool . createPath ( api , "wsys" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/action/api/wsys/" ) ) {
@ -254,18 +206,12 @@ public class SpringBootCallable implements Callable {
ctx . put ( "author" , project . getAuthor ( ) ) ;
//config
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( root , "FreeMarkerConfig.java" ) , "SpringBoot/java/config/FreeMarkerConfig.java" , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "WebMvcConfig.java" ) , "SpringBoot/java/config/WebMvcConfig.java" , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "CacheConfig.java" ) , "SpringBoot/java/config/CacheConfig.java" , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "SecurityConfig.java" ) , "SpringBoot/java/config/SecurityConfig.java" , ctx ) ;
}
if ( project . getFrame ( ) . value ( ) > = Frame . 接 口 框 架 . value ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( root , "ActionConfig.java" ) , "SpringBoot/java/config/ActionConfig.java" , ctx ) ;
}
if ( project . getFrame ( ) . value ( ) > = Frame . 服 务 框 架 . value ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( root , "TaskConfig.java" ) , "SpringBoot/java/config/TaskConfig.java" , ctx ) ;
}
if ( project . isNeedAsync ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( root , "ThreadPoolConfig.java" ) , "SpringBoot/java/config/ThreadPoolConfig.java" , ctx ) ;
}
@ -360,88 +306,7 @@ public class SpringBootCallable implements Callable {
}
}
public void generateModuleFor 服 务 框 架 ( File root , Project project ) {
Module wsvrModule = tryGetModule ( project , "wsvr" ) ;
if ( wsvrModule = = null | | ! wsvrModule . getNeedGenerate ( ) ) { // 防止与系统冲突,一般不会重复,通常是架构重新设计时遇到
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "project" , project ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
ctx . put ( "dataBase" , project . getDatabase ( ) . toString ( ) ) ;
File ent = Tool . createPath ( root , "wsvr" , "ent" ) ;
File mpr = Tool . createPath ( root , "wsvr" , "mpr" ) ;
File mgr = Tool . createPath ( root , "wsvr" , "mgr" ) ;
File req = Tool . createPath ( root , "wsvr" , "req" ) ;
File rsp = Tool . createPath ( root , "wsvr" , "rsp" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsvr/ent/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( ent , name ) , "SpringBoot/java/module/wsvr/ent/" + name , ctx ) ;
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsvr/mgr/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( mgr , name ) , "SpringBoot/java/module/wsvr/mgr/" + name , ctx ) ;
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsvr/mpr/" ) ) {
if ( name . endsWith ( ".java" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( mpr , name ) , "SpringBoot/java/module/wsvr/mpr/" + name , ctx ) ;
} else if ( name . contains ( project . getDatabase ( ) . name ( ) ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( mpr , name . replaceAll ( project . getDatabase ( ) . name ( ) + "_" , "" ) ) , "SpringBoot/java/module/wsvr/mpr/" + name , ctx ) ;
}
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsvr/req/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( req , name ) , "SpringBoot/java/module/wsvr/req/" + name , ctx ) ;
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsvr/rsp/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( rsp , name ) , "SpringBoot/java/module/wsvr/rsp/" + name , ctx ) ;
}
}
}
public void generateModuleFor 接 口 框 架 ( File root , Project project ) {
Module wsysModule = tryGetModule ( project , "wsys" ) ;
if ( wsysModule = = null | | ! wsysModule . getNeedGenerate ( ) ) { // 防止与系统冲突,一般不会重复,通常是架构重新设计时遇到
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "project" , project ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
ctx . put ( "dataBase" , project . getDatabase ( ) . toString ( ) ) ;
File ent = Tool . createPath ( root , "wsys" , "ent" ) ;
File mpr = Tool . createPath ( root , "wsys" , "mpr" ) ;
File mgr = Tool . createPath ( root , "wsys" , "mgr" ) ;
File req = Tool . createPath ( root , "wsys" , "req" ) ;
File rsp = Tool . createPath ( root , "wsys" , "rsp" ) ;
Pattern compile = Pattern . compile ( "Dict.*" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsys/ent/" ) ) {
if ( compile . matcher ( name ) . find ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( ent , name ) , "SpringBoot/java/module/wsys/ent/" + name , ctx ) ;
}
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsys/mgr/" ) ) {
if ( compile . matcher ( name ) . find ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( mgr , name ) , "SpringBoot/java/module/wsys/mgr/" + name , ctx ) ;
}
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsys/mpr/" ) ) {
if ( compile . matcher ( name ) . find ( ) ) {
if ( name . endsWith ( ".java" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( mpr , name ) , "SpringBoot/java/module/wsys/mpr/" + name , ctx ) ;
} else if ( name . contains ( project . getDatabase ( ) . name ( ) ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( mpr , name . replaceAll ( project . getDatabase ( ) . name ( ) + "_" , "" ) ) , "SpringBoot/java/module/wsys/mpr/" + name , ctx ) ;
}
}
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsys/req/" ) ) {
if ( compile . matcher ( name ) . find ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( req , name ) , "SpringBoot/java/module/wsys/req/" + name , ctx ) ;
}
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsys/rsp/" ) ) {
if ( compile . matcher ( name ) . find ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( rsp , name ) , "SpringBoot/java/module/wsys/rsp/" + name , ctx ) ;
}
}
}
}
public void generateModuleFor 网 页 框 架 ( File root , Project project ) {
public void generateModuleForSys ( File root , Project project ) {
Module wsysModule = tryGetModule ( project , "wsys" ) ;
if ( wsysModule = = null | | ! wsysModule . getNeedGenerate ( ) ) { // 防止与系统冲突,一般不会重复,通常是架构重新设计时遇到
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
@ -461,9 +326,6 @@ public class SpringBootCallable implements Callable {
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsys/mgr/" ) ) {
if ( name . contains ( "TokensManager" ) & & project . getFrame ( ) . value ( ) < Frame . 接 口 框 架 . value ( ) ) { // 当不需要Web和Api时不需要处理Token问题
continue ;
}
freeMarkerManager . outputTemp ( Tool . createFile ( mgr , name ) , "SpringBoot/java/module/wsys/mgr/" + name , ctx ) ;
}
@ -538,7 +400,7 @@ public class SpringBootCallable implements Callable {
}
//excel
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) {
File excel = Tool . createPath ( root , "excel" ) ;
File excelannotation = Tool . createPath ( excel , "annotation" ) ;
File excelconverter = Tool . createPath ( excel , "converter" ) ;
@ -563,19 +425,16 @@ public class SpringBootCallable implements Callable {
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/frame/excel/listener/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( excellistener , name ) , "SpringBoot/java/frame/excel/listener/" + name , ctx ) ;
}
}
//validation
if ( project . getFrame ( ) . value ( ) > = Frame . 接 口 框 架 . value ( ) ) {
File validation = Tool . createPath ( root , "validation" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/frame/validation/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( validation , name ) , "SpringBoot/java/frame/validation/" + name , ctx ) ;
}
}
}
/ * *
* 生 成 frame 类
* 生 成 Task 类
*
* @param root
* @param project
@ -592,7 +451,7 @@ public class SpringBootCallable implements Callable {
//task
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/task/" ) ) {
if ( name . contains ( "TokenTask" ) & & project . getFrame ( ) . value ( ) < Frame . 网 页 框 架 . value ( ) ) {
if ( name . contains ( "TokenTask" ) & & project . getFrame ( ) . value ( ) == Frame . 无 . value ( ) ) {
continue ;
}
freeMarkerManager . outputTemp ( Tool . createFile ( root , name ) , "SpringBoot/java/task/" + name , ctx ) ;
@ -630,7 +489,6 @@ public class SpringBootCallable implements Callable {
freeMarkerManager . outputTemp ( Tool . createFile ( root , "application.properties" ) , "SpringBoot/resources/application.ftl" , ctx ) ;
if ( project . getFrame ( ) . value ( ) > Frame . 空 白 框 架 . value ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( root , "start-dev.bat" ) , "SpringBoot/resources/start-dev.bat" , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "start-prod.bat" ) , "SpringBoot/resources/start-prod.bat" , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "application-dev.properties" ) , "SpringBoot/resources/application-dev.ftl" , ctx ) ;
@ -658,20 +516,9 @@ public class SpringBootCallable implements Callable {
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 服 务 框 架 . value ( ) ) {
Module wsvrModule = tryGetModule ( project , "wsvr" ) ;
if ( wsvrModule = = null | | ! wsvrModule . getNeedGenerate ( ) ) { // 覆盖
File wsvr = Tool . createPath ( dbtool , "wsvr_table" ) ;
File lib = Tool . createPath ( root , "lib" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/resources/dbtool/wsvr_table/" ) ) {
if ( name . contains ( project . getDatabase ( ) . name ( ) ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( wsvr , name ) , "SpringBoot/resources/dbtool/wsvr_table/" + name , ctx ) ;
}
}
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) { //生成系统模块
if ( project . getFrame ( ) . value ( ) = = Frame . 管 理 框 架 . value ( ) ) {
Module wsysModule = tryGetModule ( project , "wsys" ) ;
if ( wsysModule = = null | | ! wsysModule . getNeedGenerate ( ) ) { // 覆盖
File wsys = Tool . createPath ( dbtool , "wsys_table" ) ;
@ -722,7 +569,7 @@ public class SpringBootCallable implements Callable {
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) {
{
System . out . println ( "生成模块:Static" ) ;
File static_ = Tool . createPath ( root , "static" ) ;
File css = Tool . createPath ( static_ , "css" ) ;
@ -778,7 +625,7 @@ public class SpringBootCallable implements Callable {
}
//生成网页
if ( project . getFrame ( ) . value ( ) >= Frame . 网 页 框 架 . value ( ) ) {
if ( project . getFrame ( ) . value ( ) == Frame . 管 理 框 架 . value ( ) ) {
Module wsysModule = tryGetModule ( project , "wsys" ) ; // 防止与系统冲突,一般不会重复,通常是架构重新设计时遇到
if ( wsysModule = = null | | ! wsysModule . getNeedGenerate ( ) ) {
File wsys = Tool . createPath ( screen , "wsys" ) ;
@ -797,6 +644,15 @@ public class SpringBootCallable implements Callable {
}
}
}
/ * *
* 生 成 Resources_template
*
* @param root
* @param project
* /
public void generateResources_template ( File root , Project project ) {
}
public void generateTestResources ( File root , Project project ) {
@ -831,6 +687,7 @@ public class SpringBootCallable implements Callable {
ctx . put ( "author" , project . getAuthor ( ) ) ;
File file = Tool . createFile ( root , "UtilTest" + ".java" ) ;
freeMarkerManager . outputTemp ( file , "SpringBoot/test/UtilTest.java" , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "ExcelTest.java" ) , "SpringBoot/test/ExcelTest.java" , ctx ) ;
}
for ( Module md : project . getModules ( ) ) {
@ -852,61 +709,20 @@ public class SpringBootCallable implements Callable {
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 服 务 框 架 . value ( ) ) {
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
ctx . put ( "moduleName" , project . getName ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
File wsvr = Tool . createPath ( root , "wsvr" ) ;
for ( String apiFile : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/test/wsvr/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( wsvr , apiFile ) , "SpringBoot/test/wsvr/" + apiFile , ctx ) ;
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 接 口 框 架 . value ( ) ) {
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
ctx . put ( "moduleName" , project . getName ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
File wsys = Tool . createPath ( root , "wsys" ) ;
for ( String apiFile : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/test/wsys/" ) ) {
if ( apiFile . contains ( "Dict" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( wsys , apiFile ) , "SpringBoot/test/wsys/" + apiFile , ctx ) ;
}
}
}
if ( project . getFrame ( ) . value ( ) >= Frame . 网 页 框 架 . value ( ) ) {
if ( project . getFrame ( ) . value ( ) = = Frame . 管 理 框 架 . value ( ) ) {
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
ctx . put ( "moduleName" , project . getName ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
ctx . put ( "project" , project ) ;
File wsys = Tool . createPath ( root , "wsys" ) ;
for ( String apiFile : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/test/wsys/" ) ) {
if ( apiFile . contains ( "TokensTest" ) & & project . getFrame ( ) . value ( ) < Frame . 接 口 框 架 . value ( ) ) {
continue ;
}
freeMarkerManager . outputTemp ( Tool . createFile ( wsys , apiFile ) , "SpringBoot/test/wsys/" + apiFile , ctx ) ;
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 接 口 框 架 . value ( ) ) { //数据初始化
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "project" , project ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "DataInit.java" ) , "SpringBoot/test/DataInit.java" , ctx ) ;
}
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) { //数据初始化
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "ExcelTest.java" ) , "SpringBoot/test/ExcelTest.java" , ctx ) ;
}
}
private Module tryGetModule ( Project project , String moduleName ) {