基于配置文件的Maven更新属性

时间:2017-05-09 12:26:51

标签: java maven maven-2 maven-profiles

我想在maven构建期间更改不同属性的值。 Maven Change a value in a file based on profile 我也试过很多其他的但它从来没有用过,我也不明白为什么......

这是我的pom.xml

, null, result).then(resp => {
        dispatch(setFetchedThing({ thing: resp }));
      }).catch((ex) => {
        console.log(ex);
      });
    });
  };
}

我有一个基于maven的项目,这里有一个名为front-config.properties的文件中src / main / resources下的内容:

enter image description here

之后,我运行以下命令:

" mvn clean install -DskipTests -Pdev"或

" mvn clean install -DskipTests -Denvironment = dev"

我一直在属性文件中使用我的令牌,它永远不会被替换......

如果有人可以帮助我,请提前致谢!

1 个答案:

答案 0 :(得分:0)

如果您有一个包含过滤器属性的文件,则应该

  1. 在您的<profile>
  2. 中包含过滤器属性文件的位置

    ```

    <properties>
        <filter.properties>filter-values-myId.properties</filter.properties>
    </properties>
    

    ```

    1. <build>
    2. 中添加过滤器标记

      ```

      <filters>
          <filter>${[a filter property] file location}</filter>
      </filters>
      

      ```

      参考:https://gist.github.com/Qkyrie/6018561

      https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

相关问题