Open srowen opened 7 years ago
Currently, this can be worked around by shading JPMML in the same way in the client app:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>shade</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>your.group:*</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>org.jpmml</pattern>
<shadedPattern>oryx.org.jpmml</shadedPattern>
<includes>
<include>org.jpmml.**</include>
</includes>
</relocation>
<relocation>
<pattern>org.dmg</pattern>
<shadedPattern>oryx.org.dmg</shadedPattern>
<includes>
<include>org.dmg.**</include>
</includes>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
Any solution I can think of ends up requiring an API change for MLUpdate, which is, while not a formal API, something that people might want to extend. However, it's clear anyone trying to extend it will find it doesn't work anyway.
The modified API would be a little clunky, making people pass Strings instead of PMML objects.
The workaround above isn't that bad and can be documented in the example project. Also, Spark 2.3 will shade JPMML and let Oryx un-shade this, in Oryx 2.6 perhaps.
For now I favor just documenting the workaround and removing all the shading later. It might be the least change.
Quoting from the mailing list:
Oryx shades its use of PMML classes to avoid classpath conflict with Spark. That's fine as it's internal to Oryx.
Except, one key thing I overlooked: MLUpdate actually forms a sort of API outside of the api package, and it does use one PMML class in its signature.