maven - 基于配置文件的条件模块
问题描述
只有在未设置某个属性的情况下,我才想通过包含的 pom 包含一个模块。
所以我在我的父母 pom 中定义:
<profiles>
<profile>
<id>aggregator</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<aggregator>aggregator</aggregator>
</properties>
</profile>
</profiles>
在其中一个子模块中,如果未设置属性,我想激活另一个配置文件:
<profiles>
<profile>
<id>incubation</id>
<activation>
<property>
<name>!aggregator</name>
</property>
</activation>
<modules>
<module>../../examples/org.eclipse.nebula.examples</module>
<module>../../examples/org.eclipse.nebula.examples.feature</module>
</modules>
</profile>
</profiles>
AFAICS 这就是https://maven.apache.org/guides/introduction/introduction-to-profiles.html描述它的方式。
但是仍然包含示例模块。这个设置有什么问题?
解决方案
我以不同的方式解决了它。仅在顶级 pom 中使用配置文件,并且仅包含基于该配置文件的部分模块。
推荐阅读
- sql - 提取字符串与 BigQuery 中第一次出现的内容之间的字符
- java - 如何从整数中删除特定数字?
- reactjs - 如何在 ReactJS 中完成组件的介绍动画之前禁用悬停动画?
- acumatica - Acumatica MoveEntry API 不生成批号
- jquery - 如何停止显示(几秒钟)已删除的文本(wordpress)?
- python - 使用游戏中的帧调用预测时,捕获帧的 Keras 错误
- python - 如果我试图预测样本的标签,但样本缺少特征,我应该如何处理?
- mongoose - Mongoose 中 GeoJSON 的默认值
- oracle - 使用输出参数执行存储过程时出现 Oracle OCI 错误
- python - TF.Keras 中具有多输出模型的单损失