我的项目具有复杂的生命周期,因此自定义生命周期是有意义的。但是,我希望能够在同一个多模块构建的插件中定义生命周期。该插件只定义了自定义生命周期(在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
答案 0 :(得分:0)
如果我在这里没错你 -
您想要构建使用的
ApolloServer
模块apollo-server-lifecycle-plugin
这也是你的模块 项目
目前的项目结构是:
apollo-server-parent
- apollo-server-lifecycle-plugin
- ApolloServer
从multi-module guide开始,一种简单的方法是确保apollo-server-lifecycle-plugin
始终在ApolloServer
模块之前构建apollo-server-lifecycle-plugin
。最简单的方法是在ApolloServer(pom.xml)
中包含for(Move move: possibleMoves){
Square landing = move.getLanding();
int landingX = move.getLandingXC();
int landingY = move.getLandingYC();
int score = scoring(enemyPiece.pieceName());
if(score > highestWeight){
highestWeight = score;
best = move;
}
}
return best;
的依赖关系,这将确保Reactor排序首先构建插件。
构建
中另一个模块的插件依赖项