mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
JavaSourceCompiler#compile增加自定义options重载
This commit is contained in:
parent
ccc316ee8c
commit
a717d03420
@ -10,6 +10,7 @@
|
||||
* 【core 】 build(pom): 添加 Automatic-Module-Name属性(pr#2926@Github)
|
||||
* 【core 】 根据JDK-8080225修改了部分新建文件输入流和文件输出流的创建方式(pr#2930@Github)
|
||||
* 【http 】 HttpRequest#body增加支持Resource重载(issue#2901@Github)
|
||||
* 【core 】 JavaSourceCompiler#compile增加自定义options重载(issue#I6IVZK@Gitee)
|
||||
|
||||
### 🐞Bug修复
|
||||
* 【db 】 修复识别JDBC驱动时重复问题(pr#940@Gitee)
|
||||
|
@ -168,6 +168,16 @@ public class JavaSourceCompiler {
|
||||
* @return 类加载器
|
||||
*/
|
||||
public ClassLoader compile() {
|
||||
return compile(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编译所有文件并返回类加载器
|
||||
*
|
||||
* @param options 编译参数
|
||||
* @return 类加载器
|
||||
*/
|
||||
public ClassLoader compile(List<String> options) {
|
||||
// 获得classPath
|
||||
final List<File> classPath = getClassPath();
|
||||
final URL[] urLs = URLUtil.getURLs(classPath.toArray(new File[0]));
|
||||
@ -181,7 +191,9 @@ public class JavaSourceCompiler {
|
||||
final JavaClassFileManager javaFileManager = new JavaClassFileManager(ucl, CompilerUtil.getFileManager());
|
||||
|
||||
// classpath
|
||||
final List<String> options = new ArrayList<>();
|
||||
if (null == options) {
|
||||
options = new ArrayList<>();
|
||||
}
|
||||
if (false == classPath.isEmpty()) {
|
||||
final List<String> cp = CollUtil.map(classPath, File::getAbsolutePath, true);
|
||||
options.add("-cp");
|
||||
|
Loading…
x
Reference in New Issue
Block a user