【发布时间】:2021-02-13 12:24:59
【问题描述】:
我正在使用 Google Compile-Testing 和 JUnit 为我的注释处理器编写测试。
如何提供一些存在于maven的库(例如"somegroup:somelib:1.0")进行编译?
Compilation compilation = Compiler.javac().withProcessors(new MyProcessor())
.withClasspath(???) //What's there to use?
.compile(
JavaFileObjects.forResource("path/to/SomeClass.java")
...
);
【问题讨论】:
-
我通过提供像
.withClasspath(ImmutableList.of( new File("C:\\Users\\hohserg\\.gradle\\caches\\modules-2\\files-2.1\\io.netty\\netty-all\\4.1.25.Final\\d0626cd3108294d1d58c05859add27b4ef21f83b\\netty-all-4.1.25.Final.jar")))这样的下载库来解决它,但它看起来很诡异
标签: java testing junit5 annotation-processing google-compile-testing