robotframework / robotframework

Generic automation framework for acceptance testing and RPA
http://robotframework.org
Apache License 2.0
9.65k stars 2.32k forks source link

Extending JAR distribution fails #3780

Closed gpmind closed 2 years ago

gpmind commented 3 years ago

I have a list of requirements that I install with pip3 into a Lib folder:

requests==2.23.0 robotframework-requests==0.7.2 robotframework-seleniumlibrary==4.4.0 rauth==0.7.3 configparser==5.0.0 robotframework-jsonlibrary==0.3.1 pyyaml==5.3.1

When I try updating the jython jar:

jar uf robotframework-3.2.1.jar Lib

Then I get:

jar: Package org.objectweb.asm.signature missing from ModulePackages class file attribute

I was following: https://github.com/robotframework/robotframework/blob/master/doc/userguide/src/ExtendingRobotFramework/ExtendingRobotFrameworkJar.rst

gpmind commented 3 years ago

Looks like I have the versioning on the robotframework jar wrong, this works with 3.1.2, but not the latest versions: 3.2.1 & I just tried 3.2.2

Why would that be?

pekkaklarck commented 3 years ago

Have you @gpmind been able to debug this any further? I don't have much experience from this topic so cannot really help. Do you @Hi-Fi possibly have experience related to this and would you have time to debug?

Hi-Fi commented 3 years ago

Jython was changed from 2.7.0 to 2.7.2 to RF 3.2, so first hunch would be some issue there. I think the jar itself is working fine do this related only to extending.

Also org.ow2.asm.asm version was changed from 5.2 to 7.1.

Hi-Fi commented 3 years ago

Just repackages both 3.1.2 and 3.2.2 with OpenJDK

openjdk version "1.8.0_282"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.282-b08, mixed mode)

And with those local versions jar uf worked fine. So I think that when 4.0.0 release is made, we should test also extending command before pushing release to Maven Central. As it feels a bit strange currently make new version to Maven Central.

Edit: I just tested also JAR from Maven central, and it worked also fine. @gpmind what Java version you're using?

pekkaklarck commented 2 years ago

I encountered this same

jar: Package org.objectweb.asm.signature missing from ModulePackages class file attribute

error when building standalone JAR using OpenJDK to debug #4100. I noticed there was some strange module-info.class file in the root of the jython-standalone-2.7.2.jar that seemed to cause this issue. It doesn't exist in jython-standalone-2.7.1.jar and after removing as part of creating a new JAR the problem went away.

I'll commit the changes to remove that apparently unnecessary and seemingly harmful file to our tasks.py file. Have you @Hi-Fi used invoke jar for creating the standalone JAR that you have published? If yes, then with RF 4.1.2 that problematic file isn't there and extending ought to work fine.

It's strange this problem hasn't occurred more widely. Perhaps it only occurs with OpenJDK and perhaps only with certain versions.

Hi-Fi commented 2 years ago

Yes, I have created always releases with that invoke. It might be that some are made with Oracle Java, but at least latest was with OpenJDK.

pekkaklarck commented 2 years ago

Submitted an issue about this strange file to Jython's tracker: https://bugs.jython.org/issue2924

pekkaklarck commented 2 years ago

Hopefully the above fix is safe and really fixes the problem. If @gpmind or someone else who has encountered this is interested to test it before RF 4.1.2 jar distribution has been released, you can check out the latest code, install invoke and then run invoke jar at the project root. It should create you new standalone jar under the dist directory that you can then test.

Notice that RF 4.1.2 is the last planned release to support Python 2 and Jython. It would be great if we got problems like this fixed before its released. The release was initially planned for this Thursday, but I think I'll only create a release candidate then to give users a bit more time to test these fixes.

pekkaklarck commented 2 years ago

According to a recent comment to the Jython bug report I submitted, the file was there by accident. We haven't heard about problems since RF 4.1.2 with the fix was released in October 2021 either.