Prechádzať zdrojové kódy

修复 maven 构建时的路径错误

reghao 4 rokov pred
rodič
commit
c5b34958f2

+ 1 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/AppBuilder.java

@@ -108,7 +108,7 @@ public class AppBuilder {
                 codeCompiler = new ShellCompiler(compilerConfig);
                 break;
             case maven:
-                String appDirPath = app.getProjDirname() + app.getAppRootPath();
+                String appDirPath = app.getAppRootPath();
                 codeCompiler = new MavenCompiler(compilerConfig.getHomePath(), app.getEnv(), appDirPath);
                 break;
             case docker:

+ 7 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/util/buildtool/compiler/MavenCompiler.java

@@ -37,7 +37,13 @@ public class MavenCompiler implements CodeCompiler {
     @Override
     public void compile(String appId, String appCompileHome) throws Exception {
         String pomPath = appCompileHome + "/pom.xml";
-        String appDirname = appDirPath.substring(appDirPath.lastIndexOf(File.separator)+1);
+        String appDirname;
+        if (appDirPath.startsWith("/")) {
+            appDirname = appDirPath.substring(1);
+        } else {
+            appDirname = appDirPath;
+        }
+
         setInvocationRequest(appDirname, pomPath);
         InvocationResult result = invoker.execute(request);
         if (result.getExitCode() != 0) {