Skip to content

chore: Run Java 7 Tests #1721

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

Closed
wants to merge 19 commits into from
Closed

chore: Run Java 7 Tests #1721

wants to merge 19 commits into from

Conversation

lqiu96
Copy link
Contributor

@lqiu96 lqiu96 commented Sep 13, 2022

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> ☕️

If you write sample code, please follow the samples format.

@generated-files-bot
Copy link

generated-files-bot bot commented Sep 13, 2022

Warning: This pull request is touching the following templated files:

  • .github/workflows/ci.yaml
  • .kokoro/build.sh
  • .kokoro/common.sh

@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Sep 13, 2022
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. and removed size: s Pull request size is small. labels Sep 13, 2022
@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: xs Pull request size is extra small. labels Sep 13, 2022
@lqiu96
Copy link
Contributor Author

lqiu96 commented Sep 16, 2022

Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /usr/share/apache-maven-3.8.6
Java version: 1.7.0_352, vendor: Azul Systems, Inc., runtime: /opt/hostedtoolcache/Java_Zulu_jdk/7.0.352-1/x64/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-1019-azure", arch: "amd64", family: "unix"

Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)

Confirmed this the correct hash for Maven 3.8.6 and not an Ubuntu wrapper.

@lqiu96
Copy link
Contributor Author

lqiu96 commented Sep 16, 2022

Runing mvn gives this error message:

Error: Exception in thread "main" java.lang.UnsupportedClassVersionError: com/fasterxml/jackson/databind/ObjectMapper : Unsupported major.minor version 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)

Version 52 -> Java 8. The official docs say maven 3.8.6 is compatible with Java 7+. Not sure where it is pulling in Java 8 requirement from.

@lqiu96
Copy link
Contributor Author

lqiu96 commented Sep 19, 2022

Testing locally now:

Using Java 7 Zulu via SDKMan:
| >>> | 7.0.352 | zulu | installed | 7.0.352-zulu

Seeing this error when running Java 7:

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/inject/Module : Unsupported major.minor version 52.0

Seems unrelated to the Matrix environment in Github Actions
Fix: This is due to not using Apache Maven (check the checksum). When you install the official one locally, you get

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/fasterxml/jackson/databind/ObjectMapper : Unsupported major.minor version 52.0

Maven version + Java version is correct

lawrenceqiu@lawrenceqiu:~/IdeaProjects/google-http-java-client$ mvn -v
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /opt/apache-maven-3.8.6
Java version: 1.7.0_352, vendor: Azul Systems, Inc., runtime: /usr/local/google/home/lawrenceqiu/.sdkman/candidates/java/7.0.352-zulu/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.17.11-1rodete2-amd64", arch: "amd64", family: "unix"

Java Compiler is correct

lawrenceqiu@lawrenceqiu:~/IdeaProjects/google-http-java-client$ javac -version
javac 1.7.0_352

$JAVA_HOME

lawrenceqiu@lawrenceqiu:~/IdeaProjects/google-http-java-client$ echo $JAVA_HOME
/usr/local/google/home/lawrenceqiu/.sdkman/candidates/java/7.0.352-zulu

@lqiu96
Copy link
Contributor Author

lqiu96 commented Sep 19, 2022

Plan: Rollback the maven versions to see when it becomes compatible with Java 7.

@lqiu96
Copy link
Contributor Author

lqiu96 commented Sep 22, 2022

Testing locally:

lawrenceqiu@lawrenceqiu:~$ java -version
openjdk version "1.7.0_352"
OpenJDK Runtime Environment (Zulu 7.56.0.11-CA-linux64) (build 1.7.0_352-b01)
OpenJDK 64-Bit Server VM (Zulu 7.56.0.11-CA-linux64) (build 24.352-b01, mixed mode)
lawrenceqiu@lawrenceqiu:~$ mvn -v
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T18:33:14Z)
Maven home: /opt/apache-maven-3.5.4
Java version: 1.7.0_352, vendor: Azul Systems, Inc., runtime: /usr/local/google/home/lawrenceqiu/.sdkman/candidates/java/7.0.352-zulu/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.18.16-1rodete1-amd64", arch: "amd64", family: "unix"
lawrenceqiu@lawrenceqiu:~$ mvn
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.116 s
[INFO] Finished at: 2022-09-22T19:53:49Z
[INFO] ------------------------------------------------------------------------
...

Seems like the last version compatible with Java 7 is Maven version 3.5.4 It does not look compatible

@lqiu96
Copy link
Contributor Author

lqiu96 commented Sep 22, 2022

Using https://github.com/stCarolas/setup-maven Github Action to set mvn -v to 3.5.4

@product-auto-label product-auto-label bot removed the size: s Pull request size is small. label Sep 22, 2022
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants