繁体   English   中英

Maven程序集插件和配置文件

[英]maven assembly plugin and profiles

我有一个Maven(3.0.4)项目,该项目中处理一些外部资源,并使用配置文件中定义的某些属性对其进行过滤。

当我启动程序集插件时(手动或挂接到某个阶段),看来maven-resource-plugin不会将命令行指定的配置文件视为活动的。 这样,与指定配置文件中定义的属性相关的令牌不会被替换。

如果我定义了一个配置文件activeByDefault,即使命令行指定了另一个配置文件,它也被认为是活动的...

这是示例:

<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.5</version>
    <executions>
      <execution>
        <id>copy-script</id>
        <phase>process-resources</phase>
        <goals>
           <goal>copy-resources</goal>
        </goals>
        <configuration>
          <outputDirectory>${basedir}/target</outputDirectory>
          <resources>
            <resource>
              <directory>${basedir}/src/main/bash</directory>
              <filtering>true</filtering>
            </resource>
          </resources>
        </configuration>
      </execution>
    </executions>
</plugin>
...
<profiles>
  <profile>
    <id>staging</id>
    <properties>
      <remote.url>some_stag_value</remote.url>
    </properties>
  </profile>
  <profile>
    <id>prod</id>
    <properties>
      <remote.url>some_prod_value</remote.url>
    </properties>
  </profile>
</profiles>

尝试使用!停用配置文件!

mvn groupId:artifactId:goal -P profile_you_want !default_profile 

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM