-
Notifications
You must be signed in to change notification settings - Fork 30
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
Does not work with JDK 8 bsed project #25
Comments
Thanks for updating for JDK8, I guess, You will have to make a release of this plugin, as the current 1.1.0 release is with JDK11 support and available from public Maven Repo, so the new release has to push on the Maven repo with an updated version so we can start using this maven plugin. I tested fix locally by building the project, Thanks, |
Hi @rvsoni, DepClean is available for JDK 8 in Maven Central. See it at https://search.maven.org/artifact/se.kth.castor/depclean-parent-pom/1.1.0/pom Please close this issue if it works for you. |
Hi, @cesarsotovalero I don't think only updating deapclean-parent-pom:1.1.0 to jdk 8 is enough, I see the same error as only patent pom is updated but the deapclean-maven-plugin is still old jdk11 build, The maven plugin code for deapclean-maven-plugin:1.1.0 is still old and compiled using JDK11, it's not going to work with jdk8, MAINFEST.MF of dealclean-maven-plugin:1.1.0
You need to recompile all dealclean-maven-plugin code with jdk8 and republish to maven repo to make it working with jdk8. Thanks, |
I get the same issue with version Error is related probably to usage of A comment mention a workaround to this issue but is not implemented. I run
According to https://en.wikipedia.org/wiki/Java_class_file#General_layout this confirm that this is some byte code targeting Java 8 even if An explanation about this behavior can be found in jetty/jetty.project#3244 (comment) Actually current pom.xml specify source and target (https://github.com/castor-software/depclean/blob/master/pom.xml#L19) but if Java 9 or higher is used to build the project it should specify the release option ( I will shortly create a pull request that fix the issue and allow successful build on Java 9 or higher (but note that build will failed with Java 8) with error I'm not sure if there is an easy solution to allow build of the project with both Java 8 and Java 9+ versions. I guess that requiring Java 9+ version for building is not a big issue and that compatibility with Java 8+ version is what is important here. |
Use `maven.compiler.release` to avoid runtime issue (see ASSERT-KTH#25). As `maven.compiler.release` lead to the usage of `-release` `javac` option. Removed `maven.compiler.source` and `maven.compiler.target` that are no longer useful. Important: project cannot be build anymore with Java 8 because `javac` version 8 does not support `--release` option added by Maven property `maven.compiler.release`.
I don't think any code change is required, it needs just one fix related to the maven-compiler-plugin, just forked the existing code and made changes into the "depclean-parent-pom" as follow Removed Added
Compiled the code with openjdk version "1.8.0_275" and tested the plugin with "Apache Commons Lang 3.10.1-SNAPSHOT" project, You can see the project compilation log file (depclean-jdk8.txt) and use of the plugin on "Apache Commons Lang 3.10.1-SNAPSHOT". Note: pl. clean up your local maven repo folder "/.m2/repository/se/kth/castor/" before compliation to get clean reasult. You also need to republish the new module to replace the old JDK 11 only code, re-releasing the parent pom only is not enough. I guess you need to increase the release version, all existing releases are already cached into maven repo and many other maven proxy repos, it would be hard to clean all modules. releasing the new version with JDK 8 support is the only way to move forward. Ravi |
@rvsoni I agree that using |
Yes, @amottier, you are correct on fixing this issue by fixing the CI Config to use JDK 8 (i guess OpenJDK) and the correct maven setting will fix this issue, Note. The entire project has to be re-release (with the new version) to the public maven repo to make it enable to use on JDK8. |
This issue is still reproducible with JDK 8 when using latest release of the plugin - 1.1.1 |
This plugin is yet not released with the fix, so the artifacts on the maven repo are not compatible with JDK 8, Ravi |
@cesarsotovalero and all team castor-software, want to say this project sounds like a fantastic idea. I made the changes mentioned by @cesarsotovalero and @rvsoni on this branch, forked from current master built locally to use with a JDK 8 project. When using it locally I got an error related to nio:
For version 2.0.1-Snapshot another change is required to keep compatibility with JDK 8. It seems Path.of is not supported in JDK8 need to be changed to Paths.get. I created this PR to change this: https://github.com/castor-software/depclean/pull/43/files Appreciate your help with this, Marco |
@cesarsotovalero Closed PR as it seems more changes are needed in order to support JDK8 on version 2.0.1-snapshot. Will update all my findings |
Hi @mtorres10. I downgraded to Java 8 in the past in an attempt to address this issue (see 2faeb21). However, I had to upgrade again to Java 11 since it didn't solve the issue. |
@cesarsotovalero I was able to successfully build and execute a using JDK8. These are my findings:
After following those steps I was able to use on a JDK 8 based project without any issues. Side note: on another project I got some errors when plugin de-compresses some jars (just in a couple of them, not all) and json file was not generated. In order to discard it was due using JDK 8 I migrated that project to JDK 11 and tested using depclean for JDK 11 (straight out of the maven repo) with the same results. (I will take a look to this) Depclean is a great idea and enabling JDK 8 will open even more opportunities for its usage. Here is the PR, hope it is helpful: #44 |
@mtorres10 your PR looks good to me but as CI is configured to use OpenJDK 11 for the build I would recommend to update the
instead of
JEP 247 mention that I open #45 as an alternative that used the solution I'm suggesting in my comment. |
@cesarsotovalero thanks for merging the PR 👍 Do you plan to release a 2.0.1 built with this modification? I'm asking because for users who want to use the plugin with Java 8 they currently still need to download the source and build from sources the plugin. |
Minor release is coming soon... |
The plugin is built on Java 11, so not possible to use with a project using jdk 8.
Throws exception,
[ERROR] Failed to execute goal se.kth.castor:depclean-maven-plugin:1.1.0:depclean (default) on project idsk-commons-media: Execution default of goal se.kth.castor:depclean-maven-plugin:1.1.0:depclean failed: An API incompatibility was encountered while executing se.kth.castor:depclean-maven-plugin:1.1.0:depclean: java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;
The text was updated successfully, but these errors were encountered: