Quantcast

Maven Shade Plugin - How to Shade

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Maven Shade Plugin - How to Shade

Manish Maheshwari
Hi,

Quick help - This is the first time i am using the shade plugin. I saw the
shading documentation here -  but could not figure out which transformer
should I use -
https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html

My requirement is this - I am using Apache Spark 1.6 that has a dependency
on JPMML 1.1.15 as documented here -
https://repository.cloudera.com/artifactory/cloudera-repos/org/apache/spark/spark-mllib_2.10/1.6.0-cdh5.7.5-SNAPSHOT/spark-mllib_2.10-1.6.0-cdh5.7.5-20161028.092134-21.pom

    <dependency>
      <groupId>org.jpmml</groupId>
*      <artifactId>pmml-model</artifactId>*
*      <version>1.1.15</version>*
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>FastInfoset</artifactId>
          <groupId>com.sun.xml.fastinfoset</groupId>
        </exclusion>
        <exclusion>
          <artifactId>istack-commons-runtime</artifactId>
          <groupId>com.sun.istack</groupId>
        </exclusion>
      </exclusions>
    </dependency>

My code uses org.jpmml version 1.2.6
        <dependency>
            <groupId>org.jpmml</groupId>
            <artifactId>pmml-model</artifactId>
            <version>1.2.6</version>
        </dependency>


Now my shade pom snippet looks like -
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <relocations>
                                <relocation>
                                    <pattern>org.jpmml</pattern>

<shadedPattern>my.spark.jpmml</shadedPattern>
                                </relocation>
                            </relocations>
                            <transformers>
                                <transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"
/>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

But this does not work as intended and my package fails. Any idea what is
missing here.

Thanks,
Manish
Loading...