maven程序集插件和配置文件

时间:2013-01-16 12:49:09

标签: java maven maven-assembly-plugin maven-resources-plugin

我有一个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>

1 个答案:

答案 0 :(得分:2)

尝试使用!停用个人资料:

mvn groupId:artifactId:goal -P profile_you_want !default_profile 
相关问题