lettuce icon indicating copy to clipboard operation
lettuce copied to clipboard

Jakarta EE 10 support

Open Bozzzo opened this issue 9 months ago • 2 comments

Bug Report

io.lettuce lettuce-core-6.5.5.RELEASE is using some "javax.enterprise..." (EE 8) namespaces that are incompatible with jakarta (EE 10) containers

Environment

  • Lettuce version(s): lettuce-core-6.5.5.RELEASE
  • EE 10 container (like Tomcat 10)

Possible Solution

Modify you build system to publish a transformed artifact with "jakarta" classifier along with normal artifact.

Additional information

My aplication migrated to EE 10 was failing to access redis content.

I could work around by producing in my local maven repository a transformed "lettuce-core-6.5.5.RELEASE-jakarta.jar"

This can be done with the help of an extra pom.xml ( using org.eclipse.transformer:transformer-maven-plugin ).

Now my main module can consume EE 10 compatible variant by simply adding the dependency a <classifier>jakarta</classifier> This fixed my application that can now access redis again.

This work around is however quite cumbersome and requires that the extra transformer pom.xml is tightly coupled with original source pom.xml it would be much better if this transformation was done once for all by publisher itself.

Best regards, Eager consumer.

Bozzzo avatar Mar 21 '25 17:03 Bozzzo

Hey @Bozzzo

Thanks for the detailed report!

Are you interested in contributing a solution?

tishun avatar Jun 03 '25 06:06 tishun

Thank you, but,

  1. I am not sure the company I work for allows this.
  2. I do not feel qualified - I know nothing of real publication into maven central, even less for handling publication of multi-artifact - and I do know that I lack experience on the subject... notably I could realize - on another package that require similar adjustment - that my dirty work around trick has some limitations and bad side effects that I did not initially forsee:
    • it overwrites and completely replaces the normal pom.xml in local maven repository (which can have negative side effect for other apps not using the jakarta version and dependency scanners)
    • I believe it cannot be applied if the two artifacts (normal/jakarta) need to have different dependencies (ex: javax.ws.rs:javax.ws.rs-api that would need to be replaced with jakarta.ws.rs:jakarta.ws.rs-api for a jakarta version)

NOTE: I do not think dependencies need to be different in your case. NOTE: My dirty work around for the other package that required such adjustment and unfortunately depended on javax.ws.rs-api was to simply omit the dependency and rely on consuming application(s) to provide it! NOTE: The other way to handle Jakarta support I know of is to maintain version(s) in parallel - which I feel is far too heavy for most cases - like for ex spring framework for which

   Spring Framework 7.0.x: Jakarta EE 11    (jakarta namespace)
   Spring Framework 6.2.x: Jakarta EE 9-10  (jakarta namespace - OpenSource Variant - for Tomcat 10 )
   Spring Framework 6.1.x: Jakarta EE 9-10  (jakarta namespace - OpenSource Variant - for Tomcat 10 )
   Spring Framework 6.0.x: Jakarta EE 9-10  (jakarta namespace - Enterprise Variant - for Tomcat 10 )
   Spring Framework 5.3.x: Java EE 7-8      ( javax  namespace - Enterprise Variant - for Tomcat 9/8 )

I can however - just in case it would help - give you the portion of pom.xml that is responsible for producing the jakarta artifact from the normal artifact in the hack pom.xml I am using... . Beware however that It certainly would require some adjustments in the context of multi-artifact publication... In particular I guess

  • <id>default-jar</id> is not appropriate as it may collide with normal artifact production
  • <phase> and <goals> may need to be changed to ensure normal artifact is ready before plugin gets called.

Here it is:

	<build>
		<plugins>
			<plugin>
				<!-- Transform ehcache from EE to Jakarta targeting "jakarta" classifier -->
				<groupId>org.eclipse.transformer</groupId>
				<artifactId>transformer-maven-plugin</artifactId>
				<version>1.0.0</version>
				<extensions>true</extensions>
				<configuration>
					<rules>
						<jakartaDefaults>true</jakartaDefaults>
					</rules>
				</configuration>
				<executions>
					<execution>
						<id>default-jar</id>
						<phase>package</phase>
						<goals>
							<goal>jar</goal>
						</goals>
						<configuration>
							<artifact>
								<groupId>io.lettuce</groupId>
								<artifactId>lettuce-core</artifactId>
								<version>${project.version}</version>
							</artifact>
							<classifier>jakarta</classifier>
							<attach>true</attach>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

Best regards, and Good luck with this...

Bozzzo avatar Jun 03 '25 08:06 Bozzzo