MaD*_*aDa 11 java maven-plugin maven jasmine-maven-plugin
我正在分析我可以在以下configuration部分内配置的Maven插件plugin:
<plugin>
...
<executions>...</executions>
<configuration>
<!-- items placed here are visible to the MOJO -->
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
该插件完全忽略了一个配置项execution,但是:
<plugin>
...
<executions>
<execution>
<id>execution1</id>
<phase>test</phase>
<goals><goal>test</goal></goals>
<configuration>
<!-- items placed here are ignored -->
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我和Maven一起跑mvn test.我确信执行发生,因为Maven id正确打印,但插件未配置 - 打印有关在<configuration>移出部分时不存在的错误设置的警告<executions>.
问题是:它是插件实现的方式,它只接受"顶级"配置吗?我研究了它的源代码,在我看来,它是Maven在MOJO类上调用setter而且它对插件是透明的,选项来自哪个部分.
MOJO注释为:
* @component
* @goal test
* @phase test
* @execute phase="jasmine-process-test-resources"
Run Code Online (Sandbox Code Playgroud)
有问题的插件正在分叉自定义生命周期。
分叉的自定义生命周期将删除指定 id ( ) 的执行execution1(因为它是分叉的生命周期)
因此,由分叉生命周期执行的任何插件目标都将丢失其配置。主要魔力本身应该是获取配置,但问题出在分叉的生命周期执行上。
我猜测它是哪个插件,如果我的猜测是正确的,这是自定义生命周期,您看到的警告来自其他 mojo,其文本如下
JavaScript source folder was expected but was not found. Set configuration property
`jsSrcDir` to the directory containing your JavaScript sources. Skipping
jasmine:resources processing.
Run Code Online (Sandbox Code Playgroud)
在这种情况下,您需要将该<configuration>部分放在外部块中或配置生命周期的执行。
配置生命周期的执行将需要添加id具有 magic 格式的执行。我不是 100% 确定,但在您的情况下,您将使用orid的 s定义额外的执行,以确保配置成功。default-resourcesjasmine-lifecycle-resources
不太详细的方法是将配置放在外部部分并完成它。
| 归档时间: |
|
| 查看次数: |
3201 次 |
| 最近记录: |