Maven RPM插件:CentOS 6.5和5.6的不同内容

Maven RPM插件:CentOS 6.5和5.6的不同内容,maven,rpm-maven-plugin,Maven,Rpm Maven Plugin,我一直在使用rpm maven插件生成rpm,安装在CentOS 6.5上。现在我需要扩展它,用CentOS 5.6上编译的二进制文件打包RPM。我的开发机器是OSX,我希望能够在上面测试CentOS 6.5和5.6的RPM生成。这意味着我应该能够将目标操作系统作为命令行参数传递。有什么办法吗 我查看了插件的文档,似乎我需要使用过滤器,但我找不到如何确定CentOS 5.6和6.5的分类器的值 谢谢 我最终创建了两个独立的maven rpm插件执行:一个用于CentOS 6.5,另一个用于Cen

我一直在使用rpm maven插件生成rpm,安装在CentOS 6.5上。现在我需要扩展它,用CentOS 5.6上编译的二进制文件打包RPM。我的开发机器是OSX,我希望能够在上面测试CentOS 6.5和5.6的RPM生成。这意味着我应该能够将目标操作系统作为命令行参数传递。有什么办法吗

我查看了插件的文档,似乎我需要使用过滤器,但我找不到如何确定CentOS 5.6和6.5的分类器的值


谢谢

我最终创建了两个独立的maven rpm插件执行:一个用于CentOS 6.5,另一个用于CentOS 5.6。我还禁用了在发布过程中将RPM自动上传到Maven repo的功能,因为这两个RPM的名称相同。我通过将-Dmaven.deploy.skip=true添加到maven发布插件部分来禁用上传

以下是my pom.xml的相关摘录(可使用
mvn软件包执行)


org.codehaus.mojo
rpm maven插件
2.2.0
org.apache.maven.plugins
maven发布插件
2.5.2
-Dmaven.deploy.skip=true
清洁安装
假的
真的
org.codehaus.mojo
rpm maven插件
CentOS-5.6
附加转速
${rpmName}
x86_64
目标/rpm/centos-5.6
收集
755
755
根
根
${installDir}
真的
${project.build.directory}/classes/centos-5.6/collectd
等/*
${installDir}/etc
假的
真的
${project.build.directory}/classes/centos-5.6/collectd/etc
644
${installDir}/var/log
真的
${installDir}/var/lib
真的
${installDir}/var/run
真的
/etc/init.d
假的
${project.build.directory}/classes/centos common/init.d/collectd
CentOS-6.5
附加转速
${rpmName}
x86_64
目标/rpm/centos-6.5
收集
755
755
根
根
${installDir}
真的
${project.build.directory}/classes/centos-6.5/collectd
等/*
${installDir}/etc
假的
真的
${project.build.directory}/classes/centos-6.5/collectd/etc
644
${installDir}/var/log
真的
${installDir}/var/lib
真的
${installDir}/var/run
真的
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>rpm-maven-plugin</artifactId>
                <version>2.2.0</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <arguments>-Dmaven.deploy.skip=true</arguments>
                    <preparationGoals>clean install</preparationGoals>
                    <pushChanges>false</pushChanges>
                    <localCheckout>true</localCheckout>
                    <!--Disable deployment at the end because CentOS 5.6 and 6.5 profile artifacts will collide-->
                    <goals></goals>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

    <plugins>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>rpm-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>CentOS-5.6</id>
                    <goals>
                        <goal>attached-rpm</goal>
                    </goals>
                    <configuration>
                        <name>${rpmName}</name>
                        <needarch>x86_64</needarch>
                        <workarea>target/rpm/centos-5.6</workarea>
                        <group>CollectD</group>
                        <defaultDirmode>755</defaultDirmode>
                        <defaultFilemode>755</defaultFilemode>
                        <defaultUsername>root</defaultUsername>
                        <defaultGroupname>root</defaultGroupname>
                        <mappings>
                            <!-- Root directory -->
                            <mapping>
                                <directory>${installDir}</directory>
                                <directoryIncluded>true</directoryIncluded>
                                <sources>
                                    <source>
                                        <location>${project.build.directory}/classes/centos-5.6/collectd</location>
                                        <excludes>
                                            <exclude>etc/*</exclude>
                                        </excludes>
                                    </source>
                                </sources>
                            </mapping>
                            <!-- Overwrite configurations with the right file permissions -->
                            <mapping>
                                <directory>${installDir}/etc</directory>
                                <directoryIncluded>false</directoryIncluded>
                                <configuration>true</configuration>
                                <sources>
                                    <source>
                                        <location>${project.build.directory}/classes/centos-5.6/collectd/etc</location>
                                    </source>
                                </sources>
                                <filemode>644</filemode>
                            </mapping>
                            <!-- local output directories for logging and so on -->
                            <mapping>
                                <directory>${installDir}/var/log</directory>
                                <directoryIncluded>true</directoryIncluded>
                            </mapping>
                            <mapping>
                                <directory>${installDir}/var/lib</directory>
                                <directoryIncluded>true</directoryIncluded>
                            </mapping>
                            <mapping>
                                <directory>${installDir}/var/run</directory>
                                <directoryIncluded>true</directoryIncluded>
                            </mapping>
                            <!-- collectd service startup script -->
                            <mapping>
                                <directory>/etc/init.d</directory>
                                <directoryIncluded>false</directoryIncluded>
                                <sources>
                                    <source>
                                        <location>${project.build.directory}/classes/centos-common/init.d/collectd</location>
                                    </source>
                                </sources>
                            </mapping>
                        </mappings>
                    </configuration>
                </execution>
                <execution>
                    <id>CentOS-6.5</id>
                    <goals>
                        <goal>attached-rpm</goal>
                    </goals>

                    <configuration>
                        <name>${rpmName}</name>
                        <needarch>x86_64</needarch>
                        <workarea>target/rpm/centos-6.5</workarea>
                        <group>CollectD</group>
                        <defaultDirmode>755</defaultDirmode>
                        <defaultFilemode>755</defaultFilemode>
                        <defaultUsername>root</defaultUsername>
                        <defaultGroupname>root</defaultGroupname>
                        <mappings>
                            <!-- Root directory -->
                            <mapping>
                                <directory>${installDir}</directory>
                                <directoryIncluded>true</directoryIncluded>
                                <sources>
                                    <source>
                                        <location>${project.build.directory}/classes/centos-6.5/collectd</location>
                                        <excludes>
                                            <exclude>etc/*</exclude>
                                        </excludes>
                                    </source>
                                </sources>
                            </mapping>
                            <!-- Overwrite configurations with the right file permissions -->
                            <mapping>
                                <directory>${installDir}/etc</directory>
                                <directoryIncluded>false</directoryIncluded>
                                <configuration>true</configuration>
                                <sources>
                                    <source>
                                        <location>${project.build.directory}/classes/centos-6.5/collectd/etc</location>
                                    </source>
                                </sources>
                                <filemode>644</filemode>
                            </mapping>
                            <!-- local output directories for logging and so on -->
                            <mapping>
                                <directory>${installDir}/var/log</directory>
                                <directoryIncluded>true</directoryIncluded>
                            </mapping>
                            <mapping>
                                <directory>${installDir}/var/lib</directory>
                                <directoryIncluded>true</directoryIncluded>
                            </mapping>
                            <mapping>
                                <directory>${installDir}/var/run</directory>
                                <directoryIncluded>true</directoryIncluded>
                            </mapping>
                            <!-- collectd service startup script -->
                            <mapping>
                                <directory>/etc/init.d</directory>
                                <directoryIncluded>false</directoryIncluded>
                                <sources>
                                    <source>
                                        <location>${project.build.directory}/classes/centos-common/init.d/collectd</location>
                                    </source>
                                </sources>
                            </mapping>
                        </mappings>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>