feat():测试
parent
e1840fc74b
commit
3e97c2fb02
|
@ -26,7 +26,7 @@ public class OSSFileCompile{
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
|
StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
|
||||||
// 执行编译任务
|
// 执行编译任务
|
||||||
Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromStrings(Arrays.asList("/home/"+source));
|
Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromStrings(Arrays.asList(source));
|
||||||
Boolean result = compiler.getTask(null, fileManager, null, Arrays.asList("-cp", "/home/lib"), null, compilationUnits).call();
|
Boolean result = compiler.getTask(null, fileManager, null, Arrays.asList("-cp", "/home/lib"), null, compilationUnits).call();
|
||||||
// int result = compiler.run(null, null, null, source);
|
// int result = compiler.run(null, null, null, source);
|
||||||
// 检查编译结果
|
// 检查编译结果
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class OSSFileLoad {
|
||||||
return Result.error("预下载文件不存在");
|
return Result.error("预下载文件不存在");
|
||||||
}
|
}
|
||||||
// 本地文件下载路径
|
// 本地文件下载路径
|
||||||
String localPath = "home/lib/"+fileName;
|
String localPath = "home/"+fileName;
|
||||||
// ObjectMetadata object = ossClient.getObject(new GetObjectRequest(bucketName, filePath + fileName), new File(localPath));
|
// ObjectMetadata object = ossClient.getObject(new GetObjectRequest(bucketName, filePath + fileName), new File(localPath));
|
||||||
// System.out.println(object);
|
// System.out.println(object);
|
||||||
//
|
//
|
||||||
|
@ -76,7 +76,7 @@ public class OSSFileLoad {
|
||||||
}
|
}
|
||||||
//对路径里的.java文件进行编译
|
//对路径里的.java文件进行编译
|
||||||
System.out.println("第一步");
|
System.out.println("第一步");
|
||||||
OSSFileCompile.compile("home/lib/"+fileName);
|
OSSFileCompile.compile("home/"+fileName);
|
||||||
// SourceCodeCompiler.javaCompilerFile("home/"+fileName);
|
// SourceCodeCompiler.javaCompilerFile("home/"+fileName);
|
||||||
// System.out.println("第二步");
|
// System.out.println("第二步");
|
||||||
// File outputDir = new File("home/"); // 或者是你指定的其他输出目录
|
// File outputDir = new File("home/"); // 或者是你指定的其他输出目录
|
||||||
|
|
Loading…
Reference in New Issue