简体   繁体   English

如何配置Maven,以便在下游项目中执行上游工件中的插件

[英]How to configure Maven so that a plugin in an upstream artifact is executed in the downstream project

Project A requires the Enforcer Plugin to run to verify that a particular environment is in place during the building of the artifact. 项目A要求Enforcer插件运行以验证在构建工件期间是否存在特定的环境。 Project A is deployed in the normal manner to Maven Central. 项目A以常规方式部署到Maven Central。

Project B, which is entirely separate, depends on Project A and has no knowledge of the Enforcer Plugin used in Project A. 完全独立的项目B依赖于项目A,并且不了解项目A中使用的Enforcer插件。

Is there a way to ensure that the Enforcer Plugin present in Project A's POM is executed during the build of Project B, without Project B having to do any special configuration outside of the usual dependency declaration? 有没有一种方法可以确保在项目B的构建过程中执行项目A的POM中存在的Enforcer插件,而项目B不必在通常的依赖项声明之外进行任何特殊配置?

The configuration in Project A can be as esoteric as necessary to make it work. 项目A中的配置可以根据需要进行深奥。 Project B cannot be given special instructions. 项目B无法获得特别指示。

With your constraints: No, it's not possible. 有您的限制:不,这是不可能的。

The only way to make this work is by making A the parent project of B or by moving this check into a new parent POM which both A and B inherit from. 进行此工作的唯一方法是将A设为B的父项目,或将此支票移到A和B都继承的新父POM中。

But as long as you refuse to change B's setup, it can't be done. 但是,只要您拒绝更改B的设置,就无法完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 maven 如何自动将插件从另一个工件应用到项目 - maven how to automaticaly apply plugin from another artifact to project 为 Maven 项目配置 JFrog 工件存储库 - Configure JFrog artifact repository for Maven project 如何配置Maven以使用本地工件 - how to configure maven to use local artifact 如何配置Maven安装插件以更改项目构建文件位置 - How to configure maven install plugin to change project build file location 如何在多模块项目中配置Maven shade插件? - How to configure Maven shade plugin in a multi-module project? 配置 maven-compiler-plugin 使其适用于 JDK-8 和 JDK-12(在 Spring Boot 项目中) - Configure maven-compiler-plugin so it works both with JDK-8 and JDK-12 (in Spring Boot project) 如何配置Maven,以便Maven exec插件可以访问“ src /”外部目录中的配置文件 - How do I configure maven so that the maven exec plugin can access a config file in a directory outside 'src/' 如何创建Maven JavaScript项目的压缩工件 - how to create a zipped artifact of a maven javascript project 如何在Maven项目中使用JFrog工件存储库 - How to use JFrog artifact repository in a Maven project 货运Maven插件-无法部署局部战争-“工件不是项目的依赖项” - Cargo maven plugin - cannot deploy local war - “Artifact is not a dependency of the project”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM