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

Which minimal version of java for Leshan 2.0.0 ? #924

Closed
sbernard31 opened this issue Nov 6, 2020 · 17 comments
Closed

Which minimal version of java for Leshan 2.0.0 ? #924

sbernard31 opened this issue Nov 6, 2020 · 17 comments
Labels
discussion Discussion about anything
Milestone

Comments

@sbernard31
Copy link
Contributor

sbernard31 commented Nov 6, 2020

Leshan 1.x is compatible with java7.
Main reason of that was to support (or at least try to support) android.

With the development of the new version 2.0.0, the question is:
Should we still target java7 or a more recent version of java ?

Californium project wonders the same thing.(eclipse-californium/californium#1159 (comment))

Feedback from community would be strongly appreciated. 🙏

@sbernard31 sbernard31 added the discussion Discussion about anything label Nov 6, 2020
@sbernard31 sbernard31 changed the title Which minimal version of java for Leshan 2.0.0 Which minimal version of java for Leshan 2.0.0 ? Nov 6, 2020
@sbernard31
Copy link
Contributor Author

sbernard31 commented Nov 18, 2020

Regarding eclipse-californium/californium#1159 (comment), we currently lean towards for java8 as minimal version.

@sbernard31
Copy link
Contributor Author

Moving to java 8 could allow to use JLine 3 (#1065) waiting JLine2 seems to doing well. (#1064)

@sbernard31
Copy link
Contributor Author

Logback 1.3.0 which could be need for #568 need java8 at runtime.

@Michal-Wadowski
Copy link
Contributor

In the https://github.com/eclipse/leshan/wiki/F.A.Q.#can-i-use-leshan-with-android- links "leshan-android-demo" and "LwM2MDemoClientAndroid" are not working. It seems to no one actively support android with leshan.

@sbernard31
Copy link
Contributor Author

In the https://github.com/eclipse/leshan/wiki/F.A.Q.#can-i-use-leshan-with-android- links "leshan-android-demo" and "LwM2MDemoClientAndroid" are not working.

I fixed links (it seems those projects are still available on github but through some other links 😬)

It seems to no one actively support android with leshan.

As said, in F.A.Q. : Developers team never tested Leshan with android at least AFAIK.
There is not official support of it but I think it makes sense to not close the door to android if this is not too costly.

@sbernard31
Copy link
Contributor Author

Java 8 will be supported for a long time (2026/2030) :

For Android this is not crystal clear but I guess java 8 should be OK.
See: https://stackoverflow.com/questions/69643374/which-java-version-should-i-use-to-create-a-library-usable-with-android)

During development and only if new API is needed, we could also change the API level to target to a more recent version of android.
See:

@sbernard31
Copy link
Contributor Author

So since #1159 is integrated we are building with java8.

@Michal-Wadowski
Copy link
Contributor

Michal-Wadowski commented Nov 26, 2021

Now we can use syntax sugar from java8 😄 I'm very glad for this 😁.

@sbernard31
Copy link
Contributor Author

For syntax sugar, I guess yes but about the java 8 API, you could be limited by the Android level API set. :)

Coding a reusable library is like living in the past 😬

@Michal-Wadowski
Copy link
Contributor

Michal-Wadowski commented Nov 26, 2021

But I don't see any mechanism preventing us to use java8 API. How we ensure that we don't break android API?

@sbernard31
Copy link
Contributor Author

This should be done by animal-sniffer-maven-plugin : see https://stackoverflow.com/questions/11048805/maven-plugin-for-checking-api-compliance-with-android/49153640#49153640

@minusdavid
Copy link

Going forward, is there anywhere that we can easily find the minimal version of Java within the codebase?

I noticed on https://ci.eclipse.org/leshan/job/leshan/ that Java8 is still being used, so I'll use Java8.

The README.md would benefit from either a reference to Java8 or a reference to a place to check for the required Java version.

(The required mvn version would be good too actually.)

Thanks!

@minusdavid
Copy link

Oops actually I'm using the 1.4.2 jars from https://search.maven.org/search?q=g:org.eclipse.leshan%20AND%20v:1.4.2%20AND%20!a:leshan to set up some local demos.

So based off https://ci.eclipse.org/leshan/job/leshan-1.x/ I'm guessing that I should actually be using Java 7?

@minusdavid
Copy link

Although Java 7 appears to be EOL.

Looks like things are in a bit of a purgatory between Leshan 1.4.2 and 2.0.0...

@sbernard31
Copy link
Contributor Author

Going forward, is there anywhere that we can easily find the minimal version of Java within the codebase?

OK I will add this in the README.

But I don't understand why you search on Jenkins to know the minimal version, if you find this issue #924.
If you read this thread, it"s is clearly said that :

  • Minimal Java version is Java 7 for Leshan 1.x
  • Minimal Java version is Java 8 for Leshan 2.x

Note this is not the required Java version but the minimal one.
As Java is mainly backward compatible, you can use more recent version of java (and of course you should)
Targeting a very low version of java is just a way to make the library usable by as many people as possible.

The required mvn version would be good too actually.

For this one, I'm not so sure, the Leshan maven build should tell you if you are using a too old version of mvn.
And if you know maven, it's pretty easy to see the minimal maven version :
https://github.com/eclipse/leshan/blob/a314ff2fc0a927c41176eeb81df72fcab7d23ec7/pom.xml#L476-L483

By the way no need to be a maven expert to check java minimal version too :
https://github.com/eclipse/leshan/blob/a314ff2fc0a927c41176eeb81df72fcab7d23ec7/build-config/pom.xml#L39-L46

Oops actually I'm using the 1.4.2 jars from https://search.maven.org/search?q=g:org.eclipse.leshan%20AND%20v:1.4.2%20AND%20!a:leshan to set up some local demos.
So based off https://ci.eclipse.org/leshan/job/leshan-1.x/ I'm guessing that I should actually be using Java 7?

No you can just use the Java version of your choice, I must confess that I'm a bit confuse if you want to create demo based on Leshan, just create your maven project using any JDK you want and add Leshan as dependency...
It seems to me that you try to build Leshan locally and I don't understand why ...

Although Java 7 appears to be EOL.

And so what ? When Leshan 1.x was out (mid-2020) Java 7 was still maintained.
Java 7 end of life was July 2022.

We will not change minimal java version for minor version ...
And again we don't force you to use java 7 just make it compatible for it ...

Looks like things are in a bit of a purgatory between Leshan 1.4.2 and 2.0.0...

Could you elaborate what is the point here ?

@minusdavid
Copy link

@sbernard31 : Thanks for adding that information to the README.

The first comment said "Leshan 1.x is compatible with java7" but it didn't say anything else and the rest of the thread was about Leshan 2.x. That first comment was also 2 years old, so I wasn't sure if it still applied.

I use a few other projects that can't support newer versions of Java, so based on the wording I thought it might not be able to use newer versions of Java.

I've had similar problems with Maven versions in the past too, although that was quite a few years ago now.

You can probably guess that I don't use Java often.

--

I'm not very familiar with pom files and Maven plugins, but I did see that leshan/build-config/pom.xml, but only in the master branch. It didn't exist in the 1.x branch. I looked at https://github.com/eclipse/leshan/blob/1.x/pom.xml but I didn't really understand how the different references to 1.7 and 1.8 applied.

--

At https://github.com/eclipse/leshan#compile-leshan--run-demos you have the following line: "mvn clean install"

At the moment, I'm just downloading the already compiled JARs, but I thought it might be interesting to tweak the demo and compile it, so that's why I was wondering about the Maven version.

I figured at this point it made more sense than to use trial and error.

--

As for my comments about Java 7 being EOL and "purgatory", that was just a misunderstanding on my part. Your other comments have clarified everything and helped me to understand.

No worries at all.

@minusdavid
Copy link

I'm used to projects like Keycloak that usually tell you which Java version to use in the Getting Started (e.g. https://www.keycloak.org/getting-started/getting-started-zip)

So I appreciate the update to the README.

And I appreciate the Leshan project! Thanks to you folk and Sierra Wireless in general.

I work on an IoT project that pre-dates the LwM2M protocol, but we're getting some new components with embedded LwM2M clients, so looking to test out that client functionality, and the Leshan client demo and Leshan server demo have been really helpful for testing that hardware.

I'm still thinking about how we'll use Leshan in production. I figure we'll probably wrap it with an API interface that lets us integrate it into existing user consoles, especially since we'll only be using a very small set of LwM2M functionality.

I'll probably have more questions in the future, so merci beaucoup d'avance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Discussion about anything
Projects
None yet
Development

No branches or pull requests

3 participants