4

いくつかの外部リソースを処理し、プロファイルで定義されたいくつかのプロパティを使用してそれらをフィルタリングする 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>
4

1 に答える 1

2

次を使用してプロファイルを無効にしてみてください!

mvn groupId:artifactId:goal -P profile_you_want !default_profile 
于 2013-01-16T14:15:12.953 に答える