Procházet zdrojové kódy

修正:yaml增加代码路径读取模式

master
郑根木 před 2 roky
rodič
revize
8dd4ebfed8
5 změnil soubory, kde provedl 15 přidání a 19 odebrání
  1. +1
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/spring/BpmConfigBean.java
  2. +10
    -15
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/util/IdeaUtil.java
  3. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java
  4. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java
  5. +1
    -1
      smtweb-framework/bpm/src/test/java/cc/smtweb/system/bpm/test/TestMain.java

+ 1
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/spring/BpmConfigBean.java Zobrazit soubor

@@ -11,4 +11,5 @@ public class BpmConfigBean {
// 是否debug模式
private boolean debug;
private String codeJavaPath;
private int mode;
}

+ 10
- 15
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/util/IdeaUtil.java Zobrazit soubor

@@ -22,15 +22,18 @@ import java.util.Map;
* 读取Idea信息的工具类
*/
public class IdeaUtil {
private final static int MODE_POM = 1;
//获取工程中的Module文件
public static Map<String, String> getModules(String ideaPath) {
File file = new File(ideaPath + "/pom.xml");
if (file.exists()) {
return getModulesFromPom(ideaPath, file);
public static Map<String, String> getModules(String ideaPath, int mode) {
if (mode == MODE_POM) {
File file = new File(ideaPath + "/pom.xml");
if (file.exists()) {
return getModulesFromPom(ideaPath, file);
}
} else {
File file = new File(ideaPath + "/.idea/modules.xml");
if (file.exists()) return getModulesFromModule(ideaPath, file);
}

file = new File(ideaPath + "/.idea/modules.xml");
if (file.exists()) return getModulesFromModule(ideaPath, file);
return null;
}

@@ -62,14 +65,6 @@ public class IdeaUtil {
return map;
}


public static void main(String args[]) throws Exception {
Map<String, String> list = getModules("e:/jujia/git/6.0/smtweb2/smtweb-framework");
for (Map.Entry<String, String> s : list.entrySet()) {
System.out.println(s.getKey() + "=" + s.getValue());
}
}

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@JacksonXmlRootElement(localName = "project")


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java Zobrazit soubor

@@ -99,7 +99,7 @@ public class CodeBuildHandler extends AbstractHandler {
packageName = "cc.smtweb.biz." + moduleName + ".web";
}
BpmConfigBean bpmConfigBean = SpringUtil.getBean(BpmConfigBean.class);
Map<String, String> mapIdeaModules = IdeaUtil.getModules(bpmConfigBean.getCodeJavaPath());
Map<String, String> mapIdeaModules = IdeaUtil.getModules(bpmConfigBean.getCodeJavaPath(), bpmConfigBean.getMode());
if (mapIdeaModules == null || mapIdeaModules.isEmpty()) throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!");
codePath = mapIdeaModules.get(moduleName);
if (StringUtils.isEmpty(codePath)) {


+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java Zobrazit soubor

@@ -373,8 +373,8 @@ public class ModelFormHelper {
if (StringUtils.isEmpty(moduleName)) return null;

BpmConfigBean bpmConfigBean = SpringUtil.getBean(BpmConfigBean.class);
Map<String, String> mapIdeaModules = IdeaUtil.getModules(bpmConfigBean.getCodeJavaPath());
if (mapIdeaModules.isEmpty()) throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!");
Map<String, String> mapIdeaModules = IdeaUtil.getModules(bpmConfigBean.getCodeJavaPath(), bpmConfigBean.getMode());
if (mapIdeaModules == null || mapIdeaModules.isEmpty()) throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!");
String codeJavaPath = mapIdeaModules.get(moduleName);
if (StringUtils.isEmpty(codeJavaPath)) {
throw new BizException("没有找到对应项目在idea中Module的路径(" + moduleName + ")!");


+ 1
- 1
smtweb-framework/bpm/src/test/java/cc/smtweb/system/bpm/test/TestMain.java Zobrazit soubor

@@ -15,7 +15,7 @@ import java.util.Map;
public class TestMain {

public static void main(String[] args) throws Exception {
Map<String, String> map = IdeaUtil.getModules("d:/work/smtweb2/smtweb-framework");
// Map<String, String> map = IdeaUtil.getModules("d:/work/smtweb2/smtweb-framework", 1);

}
}

Načítá se…
Zrušit
Uložit