MCPcopy Create free account
hub / github.com/SeanDragon/protools / ToolMaven

Class ToolMaven

common/src/main/java/pro/tools/system/ToolMaven.java:11–30  ·  view source on GitHub ↗

Created on 2017/3/20 11:38 星期六. 进行maven的基本操作 @author SeanDragon

Source from the content-addressed store, hash-verified

9 * @author SeanDragon
10 */
11public final class ToolMaven {
12 private ToolMaven() {
13 throw new UnsupportedOperationException("我是工具类,别初始化我。。。");
14 }
15
16 public static boolean install(String groupId, String artifactId, String version, String fileName) throws IOException {
17 String mvnInstallStr = "mvn install:install-java.file -DgroupId=" + groupId + " -DartifactId=" + artifactId + " " +
18 "-Dversion=" + version + " -Dfile=" + fileName + " -Dpackaging=jar -DgeneratePom=true";
19 ToolShell.ToolCommandExec toolCommandExec = new ToolShell.ToolCommandExec(true, false, mvnInstallStr);
20 ToolShell.ToolCommandResult toolCommandResult = ToolShell.execCmd(toolCommandExec);
21 return toolCommandResult.errorMsg.length() <= 1;
22 }
23
24 public static boolean jar(String filePath) throws IOException {
25 String jarStr = "mvn jar:jar";
26 ToolShell.ToolCommandExec toolCommandExec = new ToolShell.ToolCommandExec(true, false, " cd " + filePath, jarStr);
27 ToolShell.ToolCommandResult toolCommandResult = ToolShell.execCmd(toolCommandExec);
28 return toolCommandResult.errorMsg.length() <= 1;
29 }
30}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected