Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用maven rpm插件如何替换与汇编插件类似的文件中的文本_Maven_Maven Assembly Plugin_Rpm Maven Plugin - Fatal编程技术网

使用maven rpm插件如何替换与汇编插件类似的文件中的文本

使用maven rpm插件如何替换与汇编插件类似的文件中的文本,maven,maven-assembly-plugin,rpm-maven-plugin,Maven,Maven Assembly Plugin,Rpm Maven Plugin,我有一个maven项目,在那里我创建了两个包。一个是tar.gz文件(对于某些目标)和RPM文件(对于可以使用RPM的linux目标)。我在tar.gz文件中使用maven汇编插件。我使用maven rpm插件进行rpm打包 程序集插件允许指定true选项,该选项将替换目标文件中的任何maven属性。例如(来自我的pom): 当我使用上面定义的maven程序集插件时,${project.artifactId}-${project.version}会相应地被翻译 但是,当我在RPM构建中使用相同的

我有一个maven项目,在那里我创建了两个包。一个是tar.gz文件(对于某些目标)和RPM文件(对于可以使用RPM的linux目标)。我在tar.gz文件中使用maven汇编插件。我使用maven rpm插件进行rpm打包

程序集插件允许指定true选项,该选项将替换目标文件中的任何maven属性。例如(来自我的pom):

当我使用上面定义的maven程序集插件时,${project.artifactId}-${project.version}会相应地被翻译

但是,当我在RPM构建中使用相同的文件时,这些变量不会被替换

有没有办法让RPM配置像程序集配置一样工作?我找不到任何文件告诉我这是可能的。顺便说一句,我的RPM配置如下所示:

         <mapping>
          <directory>/opt/argo/client/bin</directory>
          <directoryIncluded>false</directoryIncluded>
          <username>argo</username>
          <groupname>argogroup</groupname>
          <filemode>744</filemode>
          <sources>
            <source>
              <location>src/resources/client/bin</location>
              <includes>
                <include>*.sh</include>
              </includes>
            </source>
          </sources>
        </mapping>

/opt/argo/client/bin
假的
阿尔戈
argogroup
744
src/resources/client/bin
*sh先生
我最想做的就是在地图上写好,今天到此为止。使用maven rpm插件有没有办法做到这一点

我正在考虑使用maven replacer插件,但这并不像我希望的那样优雅

有什么建议吗?

看看:

筛选:
true
false
,表示是否要为此资源启用筛选。。。资源还可以使用POM中默认定义的属性(例如${project.version})


在使用postinstallScriptlet配置时遇到了同样的问题,通过遵循使用maven资源插件的方向解决了这个问题,可以在这里看到:

因此,您的配置应该是:

对于maven资源插件:

<configuration>
    <outputDirectory>${basedir}/target/classes/scripts</outputDirectory>
    <resources>          
        <resource>
          <directory>src/resources/client/bin</directory>
          <filtering>true</filtering>
        </resource>
    </resources>              
</configuration>

${basedir}/target/classes/scripts
src/resources/client/bin
真的
对于rpm maven插件:

    <mapping>
      <directory>/opt/argo/client/bin</directory>
      <directoryIncluded>false</directoryIncluded>
      <username>argo</username>
      <groupname>argogroup</groupname>
      <filemode>744</filemode>
      <sources>
        <source>
          <location>${basedir}/target/classes/scripts</location>
          <includes>
            <include>*.sh</include>
          </includes>
        </source>
      </sources>
    </mapping>

/opt/argo/client/bin
假的
阿尔戈
argogroup
744
${basedir}/target/classes/scripts
*sh先生

这样,maven资源插件会将您的maven属性过滤到复制的文件中,该文件将在rpm maven插件上引用

很抱歉,我花了这么长时间才回复您。我按照你上面概述的思路重新配置了我的maven产品。我希望RPM插件内置一些东西,但我想我要求太多了。我将此模式用于许多其他构建需求,例如设置在多个环境中进行测试。谢谢你抽出时间,我很感激。
<configuration>
    <outputDirectory>${basedir}/target/classes/scripts</outputDirectory>
    <resources>          
        <resource>
          <directory>src/resources/client/bin</directory>
          <filtering>true</filtering>
        </resource>
    </resources>              
</configuration>
    <mapping>
      <directory>/opt/argo/client/bin</directory>
      <directoryIncluded>false</directoryIncluded>
      <username>argo</username>
      <groupname>argogroup</groupname>
      <filemode>744</filemode>
      <sources>
        <source>
          <location>${basedir}/target/classes/scripts</location>
          <includes>
            <include>*.sh</include>
          </includes>
        </source>
      </sources>
    </mapping>