Any plans for Java 9 Jigsaw (module) of Spring projects? - spring

Java 9 is scheduled to be released soon (July 27). Are there any plans to release a Java 9 compliant version of Spring projects that will be modular (Java 9 project Jigsaw)?

Spring 5, the next major version of Spring, won't be modular. However you can use Spring 5 jars/artifacts as automatic modules in your module-info files. See official blogpost and What's new annoucement.

Conserning module-info.java see Declare Spring modules with JDK 9 module metadata issue last commit:
This issue is marked as "General Backlog", indicating that we won't deal with it for 5.1 (otherwise it'd be marked for 5.1 GA still) and probably not in subsequent 5.x releases either (otherwise it'd be marked as "5.x Backlog").
Specifically, we can't ship module-info files quite yet since we'd need stable module names for all of our optional dependencies... and many of those don't declare stable module names at this point (that is, they don't even include an Automatic-Module-Name manifest entry in their jar). Also, we'd need to build the entire framework on JDK 9+ for the compiler to understand the module-info.java format which is not entirely trivial either, even if the framework itself is known to work fine with JDK 9/10/11 at runtime.
All in all, my prediction about module-info files for 5.1 turned out to be too ambitious. Our current focus is on general JDK 11 compatibility (SPR-16391) on the classpath and as automatic modules on the module path, as well as GraalVM compatibility (SPR-16991). The use of jlink requires manual addition of module-info.class files to the framework jars for the time being... which might stay that way for several years still until we ship a JDK 11 baselined Spring Framework 6.0 against a new generation of dependencies.

Update For 11/3/2022
from Juergen Hoeller in #18079
Our strategic alignment with the module system has been in competition with our AOT and GraalVM native image efforts in 6.0, so we unfortunately had no chance to experiment with a build migration to full module descriptors yet. There have been very few requests for it even in the course of this year, so we wonder whether there is much practical value to be uncovered here for the time being anyway. Looking forward, the use of jlink's module-bounded approach for application/framework-level modules might get superseded by runtime images based on GraalVM-style individual reachability analysis in the long run.
That said, OpenJDK's Project Leyden aims to reuse module system concepts and tools for its standardized static image approach, so deeper module system alignment remains part of our long-term technology strategy for the Spring Framework 6.x generation.

Related

gradlew: What wrong can happen if gradle versions is not consistent

I am new to gradle. But I do understand to some extent why developers are encouraged to use gradlew instead of gradle. However what worse could happen if developers use different versions of gradle to build their project? At the end of the day any gradle version makes sure that dependencies of the project is managed properly. For example if a Spring Boot project is dependent of a starter plugin version 2.x, no matter what version of gradle is used, the build tool makes sure that 2.x is available
As far as I'm aware the main point to use a common version of Gradle is plugin compatibility.
Gradle's internal APIs changed quite a lot in the last few versions, so not every plugin works with every Gradle version.
For example: Spring Boot's 2.3.4 reference explicitly states that it's build plugin requires Gradle 6.3 or later (although 5.6 is mentioned to work in a deprecated form)
https://docs.spring.io/spring-boot/docs/2.3.x/reference/htmlsingle/#getting-started-system-requirements
So while you can be sure that the Spring Boot version is used (because you defined it in your buildfile) any older version of Gradle is likely to run into Exceptions when trying to build your project.
Even if you're just using plugins that are provided by Gradle itself there can be compatibility issues. For example the java configuration block was first introduced in Gradle 5 (I think) and therefore would cause a syntax error in earlier versions.
Or simple things like Java versions that older version of Gradle do not support.
The more plugins you use it becomes increasingly unlikely that a lot of Gradle versions will be able to run it. Using the Gradle Wrapper is therefore a simple way that your build works for everyone.
And from the other perspecitve: if you are the one that usually maintains the build you can use all the latest Gradle features using the Wrapper as you can be sure it will not break anything. Getting everyone on the team to update manually before you can use a feature can be a pain
That beeing said, it's really primarly a maintenance issue. Nothing bad can happen if anyone uses their own installed version of gradle, except it might just not work
If everyone on the team uses a similar version nothing might happen at all

How to update the quarkus version used

What is the recommended way of upgrading the quarkus version used in an existing application?
I have taken a look at my pom.xml, since the quarkus extensions dont specify the version used, I assume that they will get updated based on the main quarkus version.
The properties which look to be relevant in the update are quarkus-plugin.version, quarkus.platform.group-id and surefire-plugin.version.
How can I decide which ones to change, and is there anything else to be aware of?
There is one important thing to know, we have:
Quarkus Core: this is the main Quarkus artifacts + all the core extensions: the quarkus-bom is the one of Core. The Quarkus Maven plugin is part of it too.
Quarkus Platform: it contains more extensions such as Camel Quarkus: the quarkus-universe-bom is the one from the Platform, it contains the Core + the additional extensions
We usually release Quarkus core then Quarkus Platform with a few days between the two as we often need a release of Camel Quarkus, which is an Apache project and organizes a 72 hours vote for each release.
In a newly created project, you have the following properties:
<quarkus-plugin.version>1.1.1.Final</quarkus-plugin.version>
<quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>1.1.1.Final</quarkus.platform.version>
quarkus-plugin.version is the version of the Quarkus Maven plugin, it should be in line with the version of the core you use
quarkus.platform.artifact-id can right now either be quarkus-universe-bom for the whole Platform or just quarkus-bom for the Core only.
quarkus.platform.version is the version of the BOM.
Usually all these versions should be aligned. But... it could happen that we would need some quick update in the Platform and not of the core and we could then only release a new version of the platform. This hasn't happened yet to be honest.
Let's take an example of what happened today: I released Quarkus Core 1.2.0.Final but we are still waiting for Camel Quarkus to be released to release the Platform.
If you want to update early, you can change the BOM to use the quarkus-bom and update everything to 1.2.0.Final.
Or you can wait for the Platform to be released early next week and stay on the Platform quarkus-universe-bom.
We also only update the website documentation and code.quarkus.io when the full Platform is released.
It used to work to simply issue the command
mvn io.quarkus:quarkus-maven-plugin:1.4.2.Final:create
in the base project directory for it to automatically update the Quarkus versions in the project pom.xml file, but since 1.6.0.Final it errors:
project XXXXX: Unable to generate the project in a directory that already contains a pom.xml -> [Help 1]
I will create an improvement suggestion ticket at Quarkus to restore this functionality, maybe with a dedicated maven goal (like update)

Maven : Is there a way to check if a particular version of child dependency is compatible with parent?

I have a janusgraph-cassandra dependency in my project which brings cassandra-all transitive dependency with it.
Now I am trying to upgrade cassandra-all dependency from 2.1.20 to 3.11.4 but it does not seem to be compatible with parent janusgraph-cassandra 0.3.1.
Is there a way to check the version compatibility between parent and transitive dependencies?
Or should it be taken as a rule of thumb that only the versions that a maven artifact brings on it's own are compatible?
The maven dependency:tree goal is a means to identify where you may have conflicting dependencies, but establishing compatibility is a more complex question that can't be solved by maven on its own.
Establishing whether there is compatibility between versions is sometimes quite difficult. The primary reason is that there is no enforced rules about what dictates when a library has breaking changes.
A popular way of communicating compatibility is using a predictable versioning strategy. Semantic Versioning is one such popular strategy that mandates:
Given a version number MAJOR.MINOR.PATCH, increment the:
MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards-compatible manner, and
PATCH version when you make backwards-compatible bug fixes.
That being said, cassandra-all does not claim to follow this. Cassandra is a database, and not so much a library. Between minor versions there are known to be breaking API changes, and I bet it has been known to happen between patch versions.
If you are using janusgraph, I would suggest binding yourself to the version of cassandra that it claims to depend on.
However if you are running janusgraph with cassandra using Remote Server Mode, I would anticipate that you could upgrade the Cassandra cluster to 3.11.4 and things should continue to work.
It's likely that only when using Embedded Mode that cassandra-all is used.

How to make antlr 4 runtime as an osgibundle?

I have created a eclipse plugin and converted it to maven,which needs the dependency of antlr but when the plugin execute it says it cant find the required package. Then i came to know anltr is not osgi bundle. any one please tell me how to convert the antlr jar file into an osgi bundle.? The antlr dependency must support my mvenized eclipse plugin
The main ANTLR 4 project doesn't support this (see issue #689). However, I've recently created an independent fork of the project which aims to target a number of issues related to the use of ANTLR 4 in large(r)-scale and/or performance-critical applications. One of the items I'd like to implement is using OSGi for improved runtime versioning instead of the manual mechanism currently in place. I recommend filing an issue with this fork of the project so I can include these changes as part of my initial release.
https://github.com/tunnelvisionlabs/antlr4/issues

Migrating existing GWT project to new GWT version

I have been in charge for the past 5 years of the development and the maintenance of a GWT project which consists of 6 different WebApps. The project is using GWT 1.5 and is built with ant (for either mode dev/war). These webapps are deployed on apache-tomcat, the production site run version 5.5 whereas we run (for testing) version 7.0.
To emphasize user experience, I would like to migrate the GWT version to a more recent one (of which I have no idea so far); I have read many things about migrating, regarding deprecated APIs, improvments made frome one version to another and I have still structural questions dealing with the new project layout itself.
Currently, the layout is the following:
WebXXX
-src
-net.yyy.webxxx
-common
-client
-server
-public
-Common.gwt.xml
-module1
-client
-server
-public
-module1.gwt.xml
-[...]
-test
-build
-build.xml
-buildModule1.xml
-[..]
-Dependencies(SVN_Externals)
-www
-compile-all-modules.xml
-compile-module1.xml
-WebXXXHosted.xml
-[..]
To explicit things a bit, the fodler Dependencies is a place-holder for linking Workspace sources with an external widgets library. This library is built at compile time (when building all modules or just one within an ant task) and the resulting jar is injected into the module WEB-INF/lib directory. That widget library does use gxt.1.1.1 and gwt-incubator 1.5.
Over the years, writing a new ant task for each new WebApp seemed to be the solution but now that we are also using maven, I am wondering if I must convert the project to a maven project before doing the migration or if I can skip, for now, the maven conversion.
Since I guess maven is not absolutely required and since the project includes several customized ant tasks to have it run (in dev mode), I am also wondering if I could (instead) migrate the related GWT jars in a version which is such that I won't have to rewrite all the UI though I know I will have major replacement to do and extensive tests to run.
Feel free to enlighten me about the way I could go (maven or not, the version of gwt I should migrate to, the related gxt version (if it's still relevant) to use) because I am in complete darkness !
Thanks for all,
Cheers !
Go one step at a time.
Always use the latest version (and migrate ASAP when a new version comes out). That being said, there've been reports of 2.5 and 2.5.1 having a few regressions in GWT-RPC, so if it doesn't work, try using 2.4 (but try 2.5.1 first!)
You'll have to update your GXT dependency too (I have no idea how they deal with backwards compatibility at Sencha and how much it will break your code –or not–; and again try to stay up-to-date)
gwt-incubator is deprecated for long, so be prepared to replace some of the widgets, and in the long run you'll want to totally remove that dependency.
don't move to Maven until after you upgraded GWT, unless upgrading breaks your Ant tasks too much (then try moving to Maven and then upgrading GWT; but 1.5 is a really old version so I have no idea how well it works with Maven).
Re. Maven, GWT will soon use Maven too and will provide an official plugin. Alpha versions of that plugin can be found at https://github.com/tbroyer/gwt-maven-plugin (I've received rather positive feedback for now); or you can use the gwt-maven-plugin from CodeHaus, or simply call the GWT Compiler with the exec-maven-plugin (or the antrun-maven-plugin). As for the project layout, see http://blog.ltgt.net/announcing-gwt-maven-archetypes-project, this is the layout the official GWT plugin will be based on (and again, mostly positive feedback so far).
If you are planning to do both migrate to gwt and maven, I would face first to migrate the existing project to maven. You have to be sure that all dependencies are in maven repositories or you know how to deal with local repositories. Once you have everything mavenized in modules and you can import the projects in eclipse (maybe you need an old gwt plugin) and run all tasks I would try to migrate module by module selecting the appropriate dependencies.
I think updating dependencies with maven is pretty easier than dealing with ant, but of course you could select the other way if you feel more conifrtable.
Anyway, the task of migrating a gwt application from 1.5 to 2.5.1 could be hard. First you have to know how the evolution of gwt to know which issues could come to your app (new widgets interfaces, handlers, etc).
You are depending on gwt-incubator which has been discontinued since some years ago, maybe you have a build which could work with gwt-2.5.1, but probably there are many things which dont work any more. There are some features which have been moved from incubator to gwt like cell-lists, date-picker, etc, so you have to rewrite your code using new stuff in gwt.
Your project depends on an old gxt version, they have made many changes in theirs api, and I think you have to deal with a lot of changes in your code as well.
In summary, mavenizing an ant project is not so difficult and you have plenty of information in the web, but porting a gwt app from 1.5 to 2.5.1 is not a trivial task, if you dont have a good suite of tests it could be harder, so be prepared to spend a lot of time figuring out how to replace old things and to fix issues.

Resources