yeg*_*256 25 java maven-2 maven
我正在尝试使用内部定义的属性激活maven配置文件pom.xml:
<project>
  [...]
  <properties>
    <run.it>true</run.it>
  </properties>
  [...]
  <profiles>
    <profile>
      <activation>
        <property><name>run.it</name></property>
      </activation>
      [...]
    </profile>
  </profiles>
  [...]
</project>
显然它不起作用.但是,激活可以从命令行进行:
mvn -Drun.it
是"按设计"吗?如果是,那么可能的解决方法是什么?
如何使用这样的激活
    <profile>
        <id>gwt</id>
        <activation>
            <file>
                <exists>uses-gwt.marker</exists>
            </file>
        </activation>
并将文件'uses-gwt.marker'添加到源代码管理中,紧挨着pom.xml.这为所有开发人员提供了相同的状态,允许面向方面的pom.我们在父pom中使用这种技术,并将hte标记文件放在childs svn中.不理想,但有效.
.mvn在最近的 Maven 版本(3.5+?)中,您可以在项目的根目录创建一个文件夹和一个文件.mvn/maven.config文件夹和一个文件. 在此文件中,您可以像在命令行上一样激活配置文件或设置属性。
-Dactivate.myprofile=true
-Pmyprofile
希望 maven5 能够获得对 Mixins 的支持,这可能会使构建设置更加可重用。
| 归档时间: | 
 | 
| 查看次数: | 38487 次 | 
| 最近记录: |