通过“构建工具”在多模块中的Maven站点描述符

时间:2018-07-09 17:24:09

标签: maven maven-site-plugin

此刻,我在一个多模块项目中使用了maven-site-plugin。 实际上,我对所有项目都使用默认外观,但是现在我要更改此外观。因为它们中的许多都是多模块项目,所以我已经使用了“ build-tools”扩展名,其中包含checkstyle,findbugs等的配置。

我对站点描述符的想法是现在将站点描述符也集成到“构建工具”中。这样我只需要为每个项目和模块维护一个站点描述符。

我尝试了已经不同的方法和配置,例如maven-site-plugin的构建扩展或插件依赖性。我将方法与siteDirectory配置的不同路径以及描述符文件的“构建工具”内部结合在一起,但没有任何效果。每次插件回退到默认外观时。仅直接集成到单个项目中。

我的问题是,现在是否有办法实现该计划,或者我是否必须在每个项目/父模块中真正集成site-descriptor(site.xml等)并分别进行维护?

感谢和问候 阿波罗克斯


更新

下面的链接是示例项目的两个变体。

https://1drv.ms/u/s!AoIm6kXLf_KHroRFHb_zT3W6dELPKQ

在变体“ example_dependency”中,“ build-tools”模块通过依赖关系集成到插件中,例如maven-spotbugs或maven-site。变体“ example_extensions”尝试构建标签的扩展机制,例如https://spotbugs.github.io/spotbugs-maven-plugin/examples/multi-module-config.html

下的spotbugs示例

依赖项变体是可构建的,但是找不到自定义站点描述符文件。对于此示例,它只是另一个站点皮肤。我认为问题是站点目录的路径定义。在这里,我尝试了已经不同的变体,但没有成功。

扩展变体在初始构建时会引发以下错误,因此我无法测试spotbugs示例的方式。

PS C:\Users\apollox\Desktop\example_extensions> mvn install site
[INFO] Scanning for projects...
Downloading from nexus-mirror: https://.../nexus/content/groups/public/com/example/multi-module/extensions/build-tools/0.1-SNAPSHOT/maven-metadata.xml
Downloading from nexus-mirror: https://.../nexus/content/groups/public/com/example/multi-module/extensions/build-tools/0.1-SNAPSHOT/build-tools-0.1-SNAPSHOT.pom
[WARNING] The POM for com.example.multi-module.extensions:build-tools:jar:0.1-SNAPSHOT is missing, no dependency information available
Downloading from nexus-mirror: https://.../nexus/content/groups/public/com/example/multi-module/extensions/build-tools/0.1-SNAPSHOT/build-tools-0.1-SNAPSHOT.jar
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Unresolveable build extension: Plugin com.example.multi-module.extensions:build-tools:0.1-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact com.example.multi-module.extensions:build-tools:jar:0.1-SNAPSHOT in nexus-mirror (https://.../nexus/content/groups/public/) @
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project com.example.multi-module.extensions:example-progs:0.1-SNAPSHOT (C:\Users\apollox\Desktop\example_extensions\example-progs\pom.xml) has 1 error
[ERROR]     Unresolveable build extension: Plugin com.example.multi-module.extensions:build-tools:0.1-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact com.example.multi-module.extensions:build-tools:jar:0.1-SNAPSHOT in nexus-mirror (https://.../nexus/content/groups/public/) -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/PluginManagerException

0 个答案:

没有答案