我有一个maven mojo插件,参数如下:
public class SomeMojoPlugin
extends AbstractMojo
{
@Parameter( property = "templatefile", required = true )
private File templateFile;我想为这个插件编写单元测试。如何在测试方法中传递此属性/参数templatefile?
发布于 2020-05-21 22:20:00
Maven文档中有一个关于How To Use Maven Plugin Testing Harness的页面。
基本上扩展了AbstractMojoTestCase,实现了生命周期的方法,并为测试提供了一个示例pom.xml文件。
public class MyMojoTest extends AbstractMojoTestCase {
}https://stackoverflow.com/questions/42387934
复制相似问题