簡體   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