如何在maven-resources-plugin中生成maven属性并在以后使用?

问题描述

在我的项目中,我想生成一个属性(本质上是一个 username:password 字符串,以base64编码),然后在 maven-resources-plugin 为被执行。

属性已正确生成,并且在插件外部可见(我已经测试过):

<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <executions>
    <execution>
      <id>encode-user-pass-base64</id>
      <phase>initialize</phase>
      <goals>
        <goal>run</goal>
      </goals>
      <configuration>
        <exportAntProperties>true</exportAntProperties>
        <target>
          <script language="javascript">
            <![CDATA[
              ...<code here to generate base64data>...
              project.setProperty("MAVEN_NPM_AUTH",base64data);
            ]]>
          </script>
        </target>
      </configuration>
    </execution>
  </executions>
</plugin>

现在,问题出在执行 maven-resources-plugin 时:我的资源文件中的所有属性均已正确替换除外 MAVEN_NPM_AUTH

您知道为什么不完全替换此属性吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)