mojohaus / rpm-maven-plugin

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

including dependency includes from jitpack are not working #48

Closed adriens closed 6 years ago

adriens commented 8 years ago

Description

Hi,

in a rpm project (https://github.com/adriens/schemacrawler-rpm) i need to include a jar that comes from jitpack (as it has no been release on maven central). I can do this with jdeb (for the debian package with jdeb), unfortunately i cannot manage to do the same with rpm-maven-plugin.

For now, i get the following stack while trying to build the rpm :

[INFO] 
[INFO] --- rpm-maven-plugin:2.1.5:rpm (generate-rpm) @ schemacrawler-rpm ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.504 s
[INFO] Finished at: 2016-04-14T09:50:30+11:00
[INFO] Final Memory: 18M/326M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.5:rpm (generate-rpm) on project schemacrawler-rpm: A type incompatibility occured while executing org.codehaus.mojo:rpm-maven-plugin:2.1.5:rpm: org.codehaus.mojo.rpm.Dependency cannot be cast to org.codehaus.mojo.rpm.Source
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.codehaus.mojo:rpm-maven-plugin:2.1.5
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/salad74/.m2/repository/org/codehaus/mojo/rpm-maven-plugin/2.1.5/rpm-maven-plugin-2.1.5.jar
[ERROR] urls[1] = file:/home/salad74/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar
[ERROR] urls[2] = file:/home/salad74/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar
[ERROR] urls[3] = file:/home/salad74/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.jar
[ERROR] urls[4] = file:/home/salad74/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.jar
[ERROR] urls[5] = file:/home/salad74/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.jar
[ERROR] urls[6] = file:/home/salad74/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
[ERROR] urls[7] = file:/home/salad74/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[8] = file:/home/salad74/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[9] = file:/home/salad74/.m2/repository/org/apache/maven/shared/maven-filtering/1.3/maven-filtering-1.3.jar
[ERROR] urls[10] = file:/home/salad74/.m2/repository/org/apache/maven/shared/maven-shared-utils/0.6/maven-shared-utils-0.6.jar
[ERROR] urls[11] = file:/home/salad74/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
[ERROR] urls[12] = file:/home/salad74/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.4/plexus-build-api-0.0.4.jar
[ERROR] urls[13] = file:/home/salad74/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.22/plexus-interpolation-1.22.jar
[ERROR] urls[14] = file:/home/salad74/.m2/repository/org/codehaus/plexus/plexus-archiver/3.0.3/plexus-archiver-3.0.3.jar
[ERROR] urls[15] = file:/home/salad74/.m2/repository/org/codehaus/plexus/plexus-io/2.7/plexus-io-2.7.jar
[ERROR] urls[16] = file:/home/salad74/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar
[ERROR] urls[17] = file:/home/salad74/.m2/repository/org/apache/commons/commons-compress/1.10/commons-compress-1.10.jar
[ERROR] urls[18] = file:/home/salad74/.m2/repository/org/iq80/snappy/snappy/0.4/snappy-0.4.jar
[ERROR] urls[19] = file:/home/salad74/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[20] = file:/home/salad74/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[21] = file:/home/salad74/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Steps to reproduce

Add the jitpack repo :

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

Add the dependency, in my case :

        <!-- Additional lints dependency -->
        <dependency>
        <groupId>com.github.mbarre</groupId>
        <artifactId>schemacrawler-additionnallints</artifactId>
        <version>${schemacrawler-additionnallints.version}</version>
    </dependency>

At this stage, the build is working fine... then comes the interesting part, the mapping section :

<mapping>
                            <directory>/opt/schemacrawler-${project.version}/additional-lints</directory>
                            <sources>
                                <source>
                                    <location>src/main/resources/ADDITIONAL-LINTS.HOWTO.txt</location>
                                </source>
                                <source>
                                    <location>src/main/resources/ADDITIONAL-LINTS.LICENSE.txt</location>
                                </source>
                                <source>
                                    <location>src/main/resources/ADDITIONAL-LINTS.README.md</location>
                                </source>
                                <!-- This jitpack dependency causes the build to fail -->
                                <dependency>
                                    <includes>
                                        <include>com.github.mbarre:schemacrawler-additionnallints</include>
                                    </includes>
                                </dependency>
                            </sources>
                        </mapping>

... then the build fails :

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.358 s
[INFO] Finished at: 2016-04-14T09:51:49+11:00
[INFO] Final Memory: 18M/323M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.5:rpm (generate-rpm) on project schemacrawler-rpm: A type incompatibility occured while executing org.codehaus.mojo:rpm-maven-plugin:2.1.5:rpm: org.codehaus.mojo.rpm.Dependency cannot be cast to org.codehaus.mojo.rpm.Source
bokken commented 8 years ago

Move the outside of within .

Dependency is a top level attribute of Mapping.

http://www.mojohaus.org/rpm-maven-plugin/map-params.html

dantran commented 6 years ago

close as wont fix with a suggest solution from bokken