Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using com.ibm.wala.cast.python.ml as a library is problematic due to Maven Shade plug-in #28

Closed
khatchad opened this issue Apr 14, 2023 · 5 comments

Comments

@khatchad
Copy link
Collaborator

com.ibm.wala.cast.python currently uses the Maven Shade plug-in:

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<!-- Additional configuration. -->
</configuration>
<executions>
<!-- Run shade goal on package phase -->
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<!-- add Main-Class to manifest file -->
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.ibm.wala.cast.python.ml.driver.Ariadne</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>

I believe it does this for two reasons:

  1. Produce an executable JAR by adding the appropriate MANIFEST.mf file.
  2. Produce a standalone JAR that includes all of the dependencies ("uber" JAR).

However, this is problematic for using com.ibm.wala.cast.python.ml as a library:

If the uber JAR is reused as a dependency of some other project, directly including classes from the artifact's dependencies in the uber JAR can cause class loading conflicts due to duplicate classes on the class path.

@khatchad khatchad changed the title Using com.ibm.wala.cast.python.ml as a library is problematic due to Maven shade plug-in Using com.ibm.wala.cast.python.ml as a library is problematic due to Maven Shade plug-in Apr 14, 2023
@msridhar
Copy link
Member

Sometimes this can be addressed by shifting classes from dependencies to a different (unlikely to conflict) package name. Is that possible with this plugin?

@khatchad
Copy link
Collaborator Author

khatchad commented Apr 14, 2023

Yes, it is. But, I am wondering whether just to use two JARs. The execution one would have some special name. The default JAR would be for library usage.

@khatchad
Copy link
Collaborator Author

@msridhar
Copy link
Member

msridhar commented Apr 14, 2023 via email

@khatchad
Copy link
Collaborator Author

Should be solved by #29.

khatchad added a commit to ponder-lab/ML that referenced this issue May 23, 2023
* Address wala#28. (#29)

See https://maven.apache.org/plugins/maven-shade-plugin/examples/attached-artifact.html for reference.

* Remove unused footnote. (#31)

Forgot to remove this one with the last update.

* Lowercase parent pom artifact ID. (#32)

Fixes wala#30.

* Fix wala#33. (#34)

Make consistent by using Jython 3 as a dependency.

* Metadata, build script, and warnings (#35)

* Remove obsolete bundles.

These are being used as JARs now.

* Export missing packages.

Since wala/ML is now using JAR packaging, this probably doesn't matter.
However, it fixes the warnings. And, if it ever gets OSGi component
packaged again, we can use it.

* Fix build.properities file.

Source and data directiories don't exist for these subprojects.

* Fix more warnings.

* Use verify to run the tests.

* Export more packages.

* Fix generics hiding warning.

* Fix Jython and Jython3 test directory metadata.

* Add GH actions file (#40)

* Add GH actions file.

* Remove optional dependency analysis.

Was failing.

* Fix path.

* Switch Jython repos.

* Revert "Switch Jython repos."

This reverts commit 20052de.

* Print out the stack trace.

* Switch to Jython3 for testing ML.

* Revert "Print out the stack trace."

This reverts commit 8fb7951.

* Update run.sh

Fix broken resolution.

* Ignore failing test.

Reinstate once wala#42 is fixed.

* Revert "Work around https://github.com/ponder-lab/ML/issues/4."

This reverts commit 0e5c334.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants