mojohaus / rpm-maven-plugin

http://www.mojohaus.org/rpm-maven-plugin/
Other
56 stars 48 forks source link

How to generate the right filename in .m2? #12

Closed dadoonet closed 9 years ago

dadoonet commented 9 years ago

Here is the issue I have:

<groupId>org.codehaus.mojo.rpm.its</groupId>
<artifactId>MRPM-XXX</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>rpm</packaging>

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>rpm-maven-plugin</artifactId>
            <version>2.1.3</version>
            <extensions>true</extensions>
            <configuration>
                <group>Application/Internet</group>
            </configuration>
        </plugin>
    </plugins>
</build>

Running mvn install gives:

[INFO] --- rpm-maven-plugin:2.1.4-SNAPSHOT:rpm (default-rpm) @ MRPM-XXX ---
... Skipping logs
[INFO] Building target platforms: noarch-apple-mac os x
[INFO] Processing files: MRPM-XXX-2.0.0-SNAPSHOT20150908184159.noarch
[INFO] Wrote: /Users/dpilato/Documents/Elasticsearch/dev/3rdparty/rpm-maven-plugin/src/it/MRPM-XXX/target/rpm/MRPM-XXX/RPMS/noarch/MRPM-XXX-2.0.0-SNAPSHOT20150908184159.noarch.rpm
[INFO] 

Perfect. We generated an artifact named: MRPM-XXX-2.0.0-SNAPSHOT20150908184159.noarch.rpm which respects rpm naming convention.

But then the install part:

[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ MRPM-XXX ---
[INFO] Installing /Users/dpilato/Documents/Elasticsearch/dev/3rdparty/rpm-maven-plugin/src/it/MRPM-XXX/target/rpm/MRPM-XXX/RPMS/noarch/MRPM-XXX-2.0.0-SNAPSHOT20150908184159.noarch.rpm to /Users/dpilato/.m2/repository/org/codehaus/mojo/rpm/its/MRPM-XXX/2.0.0-SNAPSHOT/MRPM-XXX-2.0.0-SNAPSHOT.rpm
[INFO] Installing /Users/dpilato/Documents/Elasticsearch/dev/3rdparty/rpm-maven-plugin/src/it/MRPM-XXX/pom.xml to /Users/dpilato/.m2/repository/org/codehaus/mojo/rpm/its/MRPM-XXX/2.0.0-SNAPSHOT/MRPM-XXX-2.0.0-SNAPSHOT.pom

We can see that the RPM is now installed in .m2 as MRPM-XXX-2.0.0-SNAPSHOT.rpm which does not contain anymore the arch part.

This is caused by the fact that install plugin is relying on artifact coordinates which are:

<artifactId>MRPM-XXX</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>rpm</packaging>

So the finalName seems to be generated as basically ${project.artifactId}-${project.version}.${project.packaging}.

Could it be possible to fix that?

The only workaround I found for now is by hacking the version to be 1.0.0-SNAPSHOT.noarch but I don't think it's the best workaround! :)

Thoughts?

bokken commented 9 years ago

Maven has its own set of naming rules which must be followed. In the end, rpm does not care about the filename.

On Tue, Sep 8, 2015, 1:53 PM David Pilato notifications@github.com wrote:

Here is the issue I have:

org.codehaus.mojo.rpm.its MRPM-XXX 1.0.0-SNAPSHOT rpm org.codehaus.mojo rpm-maven-plugin 2.1.3 true Application/Internet

Running mvn install gives:

[INFO] --- rpm-maven-plugin:2.1.4-SNAPSHOT:rpm (default-rpm) @ MRPM-XXX --- ... Skipping logs [INFO] Building target platforms: noarch-apple-mac os x [INFO] Processing files: MRPM-XXX-2.0.0-SNAPSHOT20150908184159.noarch [INFO] Wrote: /Users/dpilato/Documents/Elasticsearch/dev/3rdparty/rpm-maven-plugin/src/it/MRPM-XXX/target/rpm/MRPM-XXX/RPMS/noarch/MRPM-XXX-2.0.0-SNAPSHOT20150908184159.noarch.rpm [INFO]

Perfect. We generated an artifact named: MRPM-XXX-2.0.0-SNAPSHOT20150908184159.noarch.rpm which respects rpm naming convention.

But then the install part:

[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ MRPM-XXX --- [INFO] Installing /Users/dpilato/Documents/Elasticsearch/dev/3rdparty/rpm-maven-plugin/src/it/MRPM-XXX/target/rpm/MRPM-XXX/RPMS/noarch/MRPM-XXX-2.0.0-SNAPSHOT20150908184159.noarch.rpm to /Users/dpilato/.m2/repository/org/codehaus/mojo/rpm/its/MRPM-XXX/2.0.0-SNAPSHOT/MRPM-XXX-2.0.0-SNAPSHOT.rpm [INFO] Installing /Users/dpilato/Documents/Elasticsearch/dev/3rdparty/rpm-maven-plugin/src/it/MRPM-XXX/pom.xml to /Users/dpilato/.m2/repository/org/codehaus/mojo/rpm/its/MRPM-XXX/2.0.0-SNAPSHOT/MRPM-XXX-2.0.0-SNAPSHOT.pom

We can see that the RPM is now installed in .m2 as MRPM-XXX-2.0.0-SNAPSHOT.rpm which does not contain anymore the arch part.

This is caused by the fact that install plugin is relying on artifact coordinates which are:

MRPM-XXX 1.0.0-SNAPSHOT rpm

So the finalName seems to be generated as basically ${project.artifactId}-${project.version}.${project.packaging}.

Could it be possible to fix that?

The only workaround I found for now is by hacking the version to be 1.0.0-SNAPSHOT.noarch but I don't think it's the best workaround! :)

Thoughts?

— Reply to this email directly or view it on GitHub https://github.com/mojohaus/rpm-maven-plugin/issues/12.

dadoonet commented 9 years ago

@bokken Thanks for the answer. But if I read correctly this page, RPM convention is expecting name-version-release.architecture.rpm as a filename.

Do I miss something?

bokken commented 9 years ago

While that is the naming convention, it does not actually matter. The version, release, and architecture information is in the rpm file itself.

On Tue, Sep 8, 2015, 3:11 PM David Pilato notifications@github.com wrote:

@bokken https://github.com/bokken Thanks for the answer. But if I read correctly this page http://www.rpm.org/max-rpm/ch-rpm-file-format.html, RPM convention is expecting name-version-release.architecture.rpm as a filename.

Do I miss something?

— Reply to this email directly or view it on GitHub https://github.com/mojohaus/rpm-maven-plugin/issues/12#issuecomment-138685996 .

dadoonet commented 9 years ago

@spinscale @electrical WDYT guys? Are we trying to fix something which should not really get fixed?

dantran commented 9 years ago

!dadoonet, I dont think it is possible to generate the true RPM nameing convention for maven artifact. the closest is the define it as a classifier

dadoonet commented 9 years ago

Thanks.