Ada*_*ała 3 maven rpm-maven-plugin
我用rpm -maven-plugin构建了三个包.一个父级和两个需要同一版本父级的插件.一切正常,直到我用XY-SNAPSHOT版本构建它.然后我的rpm版本被截断为XYpart,但值${project.version}仍然是XY-SNAPSHOT.它导致插件需要XY-SNAPSHOT父版本,而我已经安装了XY版本.
我想知道我是否可以在"requires"部分使用"截断"版本或强制插件不截断我的版本......
这是我的配置:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.0.1</version>
<executions>
<execution>
<id>parent-package</id>
<goals>
<goal>rpm</goal>
</goals>
<configuration>
<name>parent-package</name>
<mappings>
(...)
</mappings>
</configuration>
</execution>
<execution>
<id>first-plugin</id>
<goals>
<goal>rpm</goal>
</goals>
<configuration>
<name>first-plugin</name>
<mappings>
(...)
</mappings>
<requires>
<require>parent-package = ${project.version}</require>
</requires>
</configuration>
</execution>
<execution>
<id>second-plugin</id>
<goals>
<goal>rpm</goal>
</goals>
<configuration>
<name>second-plugin</name>
<mappings>
(...)
</mappings>
<requires>
<require>parent-package = ${project.version}</require>
</requires>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
RPM规范将a -视为特殊字符.看到这是我在谷歌找到的最好的
The version number is used in version comparisons. The RPM comparison algorithm
is fairly complex, but can get fooled by strange version numbers. So, your best
bet is to stick to dotted numerics, such as 1.5 or 2.3.1.1.4 or 1.0. Version
numbers such as these will compare best from within the RPM system. For example:
Version: 1.1.2
You cannot use a dash in the version number, as RPM uses the dash to separate
the Name-Version-Release elements.
Run Code Online (Sandbox Code Playgroud)
因此Maven版本1.0-SNAPSHOT不会是有效的RPM版本号.
Mojo的RPM Maven插件对版本号进行了一些转换以"帮助"你.特别是它剥离了-SNAPSHOT你发现的,如果有-SNAPSHOT它设置rpm版本SNAPSHOTyyyymmddHHMMSS(注意该版本用于区分相同版本的RPM的两个不同版本)
您需要做的是将一些属性设置为转换后的版本.有很多方法可以做到这一点.正如我在评论中建议的那样,您可以使用它build-helper:regex-property来转换属性.这种方法的缺点是,如果RPM插件修改了它用于版本转换的规则,你的正则表达式可能会让你失去同步.
正确的解决方案是使用rpm:version目标rpm.version为您设置属性,因此您的配置变为:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.0.1</version>
<executions>
<execution>
<id>properties</id>
<goals>
<goal>version</goal>
</goals>
</execution>
<execution>
<id>parent-package</id>
<goals>
<goal>rpm</goal>
</goals>
<configuration>
<name>parent-package</name>
<mappings>
(...)
</mappings>
</configuration>
</execution>
<execution>
<id>first-plugin</id>
<goals>
<goal>rpm</goal>
</goals>
<configuration>
<name>first-plugin</name>
<mappings>
(...)
</mappings>
<requires>
<require>parent-package = ${rpm.version}</require>
</requires>
</configuration>
</execution>
<execution>
<id>second-plugin</id>
<goals>
<goal>rpm</goal>
</goals>
<configuration>
<name>second-plugin</name>
<mappings>
(...)
</mappings>
<requires>
<require>parent-package = ${rpm.version}</require>
</requires>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
如果您需要该属性具有不同的名称,请使用versionProperty配置参数,但请记住,对于多次执行,您可能希望将其保留为默认值
| 归档时间: |
|
| 查看次数: |
5943 次 |
| 最近记录: |