根据当前模块激活不同的Maven配置文件? [英] Activate different Maven profiles depending on current module?

查看:138
本文介绍了根据当前模块激活不同的Maven配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个多模块构建,其中包含使用Java和Flex等不同技术的模块.是否可以通过当前编译的模块激活不同的配置文件?

We have a multi module build with modules using different technologies, like Java and Flex. Is it somehow possible to activate different profiles based on the module that is compiled currently?

我尝试了类似的激活方式

I tried it with an activation like

<profile>
  <id>flex</id>
  <activation>
    <file>
      <exists>${basedir}/src/main/flex</exists>
    </file>
  </activation>
  ...
</profile

但这没用,尽管$ {basedir}的使用已中记录了Maven文档(这是Maven中的错误).根据当前模块进行不同的激活是否有其他可能性?还是Maven只允许激活所有模块的配置文件,或者根本不允许激活?

But it didn't work, although the use of ${basedir} is documented in the Maven documentation (this is a bug in Maven). Is there a different possibility to have different activations based on the current module? Or does Maven only allow to activate a profile for all modules or not at all?

推荐答案

对于那些像我这样阅读此问题以寻找答案的人,该用例现在可以在Maven 3中使用.

For those like myself reading this question looking for answers, this use case now works in Maven 3.

在3的早期版本中存在一个影响此功能的错误(请参见 http://jira .codehaus.org/browse/MNG-2363 ),但使用Maven 3.0.4可以正确地为我工作.

There is was a bug affecting this feature in early versions of 3 (see http://jira.codehaus.org/browse/MNG-2363) but it works for me correctly using Maven 3.0.4.

这篇关于根据当前模块激活不同的Maven配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆