[英]Can I use a custom lifecycle defined in a multi-module project?
我有一个具有复杂生命周期的项目,因此自定义生命周期是有意义的。 但是,我希望能够在同一多模块构建的插件中定义生命周期。 该插件仅定义了自定义生命周期(在components.xml
)。
apollo-server-parent
- apollo-server-lifecycle-plugin
- src/main/resources/META-INF/plexus/components.xml (defines apollo-server-product)
- ApolloServer
- pom.xml
... <packaging>apollo-server-product</packaging> ... <plugin> <groupId>ca.nanometrics.apollo</groupId> <artifactId>apollo-server-lifecycle-plugin</artifactId> <version>${project.parent.version}</version> <extensions>true</extensions> </plugin>
但是,如果我这样做,将无法构建Maven,因为它无法找到apollo-server-lifecycle-plugin,因为在构建反应堆时尚未构建它。 关于如何解决此问题的任何想法? 我是否必须在单独的项目中定义插件?
我得到的错误示例:
[ERROR] Some problems were encountered while processing the POMs:
[ERROR] Unresolveable build extension: Plugin ca.nanometrics.apollo:apollo-server-plugin:4.0.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact ca.nanometrics.apollo:apollo-server-plugin:jar:4.0.0-SNAPSHOT in releases (http://.../nexus/content/groups/public) @
[ERROR] Unknown packaging: apollo-server-product @ ca.nanometrics.apollo:ApolloServer:[unknown-version], /opt/atlassian/pipelines/agent/build/ApolloServer/pom.xml, line 10, column 14
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project ca.nanometrics.apollo:ApolloServer:4.0.0-SNAPSHOT (/opt/atlassian/pipelines/agent/build/ApolloServer/pom.xml) has 2 errors
[ERROR] Unresolveable build extension: Plugin ca.nanometrics.apollo:apollo-server-plugin:4.0.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact ca.nanometrics.apollo:apollo-server-plugin:jar:4.0.0-SNAPSHOT in releases (http://.../nexus/content/groups/public) -> [Help 2]
[ERROR] Unknown packaging: apollo-server-product @ ca.nanometrics.apollo:ApolloServer:[unknown-version], /opt/atlassian/pipelines/agent/build/ApolloServer/pom.xml, line 10, column 14
如果我在这里没弄错你-
您要构建
ApolloServer
模块,该模块使用apollo-server-lifecycle-plugin
也是项目的一个模块。
当前的项目结构为:
apollo-server-parent
- apollo-server-lifecycle-plugin
- ApolloServer
从多模块指南中 ,一种简单的方法可以确保始终在ApolloServer
模块之前构建apollo-server-lifecycle-plugin
。 最简单的方法是在ApolloServer(pom.xml)
中包含apollo-server-lifecycle-plugin
的依赖关系,这将确保Reactor排序首先构建插件。
插件对构建中另一个模块的依赖
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.