Problems compiling the new OR

Hi guys,
yesterday I stopped our custom OR in my computer and now I’m not able to compile the code again, it’s strange because I didn’t make any changes. Anyway, I thought it would be a good time to switch to the new version of OR. However, I also have problems with compilation. Then just a couple of quick questions for now, as I do further research into what might be the cause of the problem.
Do you use Java 21 now?
And second, we’re using the class
org.openremote.container.util.UniqueIdentifierGenerator
but it seems to have disappeared in this version. Is there another class to replace it?

Thanks in advance

paco

Hi!

Do you use Java 21 now?

Our current release, version 1.2.4, uses Java 17 like it has been before.
However, we’re making the move to Java 21 soon, which is in the master branch now.
So if you clone a fresh repo, you’ll need Java 21 now.
Fresh custom projects should still be on Java 17, as they’re not using snapshots by default.
.

And second, we’re using the class
org.openremote.container.util.UniqueIdentifierGenerator
but it seems to have disappeared in this version. Is there another class to replace it?

In May of 2024, we moved the UniqueIdentifierGenerator class to the model package.
To be exact, the path is now; org.openremote.model.util.UniqueIdentifierGenerator.

Hope this helps!

Hi Martin,
I was asking about the java version because I see this in the project.gradle file:

// Use Java 21
tasks.withType(JavaCompile) {
    sourceCompatibility = JavaVersion.VERSION_21
    targetCompatibility = JavaVersion.VERSION_21

I guess when I updated the submodule I got the master branch version. I don’t understand what you mean with snapshots. Well, in my case probably I need java 21.

Regarding the “missing” class I’ll look for it. I hope to be able to get the application up and running again. Java is not my strong point. I’ll let you know.

Thanks
paco

Aaaah that makes sense indeed :+1:

At the end of last year, we’ve migrated the custom projects away from the GitHub submodules.
It’s now using artifacts, which refers to downloadable binaries from Maven, NPM, etc
See more information here:

.
You might still get it to work with GitHub submodules though.
@wborn @Rich is the use of submodules still possible with recent versions, or not at all?

No see the docs you’ve linked to:

Previously Git submodules were used in custom projects for versioning. This has been replaced with dependencies of versioned artifacts. Using submodules for versioning is no longer supported.

I saw it when Martin shared the link. I have a problem now. In my last custom version I had overwritten some methods used in the OR core (i.e. from ForecastSolarService). It seems that now with artefacts I don’t have a copy of the OR core within my custom project, is that so?
This is the first of countless problems, I shouldn’t have touched the version after months of collecting data, lesson learnt.

You indeed don’t have a copy of the OR core source code anymore but import the same code as jar dependencies.

When you say “overwritten”, do you mean override a method in a subclass or modify the source code from the class?
If you subclassed a service, the fact it’s coming from a dependency instead of source code should not be an issue.

Well, I had actually overridden the start method from ForecastSolarService.java to avoid having to own an apiKey, and now it seems that some methods of the class like startProcessing no longer exist. See the picture below. Then, and because many other agents created in java do not work either, I conclude that it is not a good idea to create customisations in java if I intend to update the OR core later on. At least if I’m not an advanced java expert.


Now I’m struggling to figure out how to get the new OR up and running in production (without my custom agents), with docker, I can’t find the documentation and it seems that the method I used before doesn’t work either.

I think you can get there by looking at the changes to the original:

Also, the addInternalSubscription to addSubscription change took place here:
At this point addInternalSubscription changed to addSubscription. Maybe you can find some other changes that impact your code there?