transactions icon indicating copy to clipboard operation
transactions copied to clipboard

Make the CDI/interceptor dependencies optional in module-info

Open yrodiere opened this issue 2 years ago • 54 comments

Fixes #214

The "static" keyword means "required for compilation of this module, but not at runtime", which is pretty much the current situation.

Those dependencies are only required for the @Transactional and @TransactionScoped annotations, but jakarta.transaction-api can perfectly well be used without CDI, e.g. in Hibernate ORM in a Java SE environment.

Without this change, it's impossible to use jakarta.transaction-api (or anything relying on it, e.g. Hibernate ORM) without CDI in the modulepath.

yrodiere avatar Jan 31 '23 13:01 yrodiere

Can one of the admins verify this patch?

jta-bot avatar Jan 31 '23 13:01 jta-bot

FWIW I'm a Red Hat employee and thus covered by Red Hat's Eclipse Contributor Agreement, and that's visible on my Eclipse profile, so I don't know why the automated check on GitHub fails.

EDIT: The problem was a trailing space in the "First name" field in my Eclipse profile :facepalm:

yrodiere avatar Jan 31 '23 13:01 yrodiere

Is the intention for this to be a service release of the API jar for EE10 or is would it be required to wait for EE11?

tomjenkinson avatar Jan 31 '23 13:01 tomjenkinson

Is the intention for this to be a service release of the API jar for EE10 or is would it be required to wait for EE11?

From my point of view this is essentially a bugfix. As far as I'm concerned, this would need to be included in a bugfix release in EE10 (e.g. jakarta.transaction-api 2.0.2).

In my opinion there's also no need to wait for EE11, because this change shouldn't break any application. As I understand it, users either are not using CDI and then removing the dependency won't affect them negatively, or they are using CDI and then all the related modules are already in their modulepath and will continue to be exposed to users transitively through this module-info.

However, I am not familiar with the Jakarta release process at all. Maybe it's too late for such change in EE10? You probably know better than I do.

yrodiere avatar Jan 31 '23 14:01 yrodiere

Thank you for the clarification

tomjenkinson avatar Jan 31 '23 16:01 tomjenkinson

ok to test

tomjenkinson avatar Jan 31 '23 16:01 tomjenkinson

Hey. It looks like the build got stuck or was aborted for some reason... can anyone restart it?

yrodiere avatar Feb 27 '23 13:02 yrodiere

retest this please

tomjenkinson avatar Feb 27 '23 17:02 tomjenkinson

The testing infra seems to be having problems:

[ERROR] Error executing Maven. [ERROR] The specified user settings file does not exist: /home/jenkins/agent/workspace/eclipse-ee4j_jta-api-pulls-openjdk-jdk11-latest/glassfish/snapshots/settings.xml Build step 'Execute shell' marked build as failure

yrodiere avatar Feb 28 '23 12:02 yrodiere

retest this please

tomjenkinson avatar Mar 01 '23 16:03 tomjenkinson

I have commented out a line of the build config mvn -s ./snapshots/settings.xml clean install -f ./snapshots/pom.xml - snapshots/ folder is not in the current glassfish master branch.

tomjenkinson avatar Mar 01 '23 16:03 tomjenkinson

[ERROR] Rule 0: org.apache.maven.plugins.enforcer.RequireMavenVersion failed with message:
Detected Maven Version: 3.8.5 is not in the allowed range 3.8.6.

:)

yrodiere avatar Mar 01 '23 16:03 yrodiere

retest this please

tomjenkinson avatar Mar 01 '23 17:03 tomjenkinson

Thanks, the job was configured to use apache-maven-latest but maybe this is not updated yet to point to a version that would satisfy the check. I found apache-maven-3.8.6 in the list though and so have configured it to be that

tomjenkinson avatar Mar 01 '23 17:03 tomjenkinson

Thank you for working on this :)

Next one...

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:3.1.0:run (do stuff) on project glassfish: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] /home/jenkins/agent/workspace/eclipse-ee4j_jta-api-pulls-openjdk-jdk11-latest/glassfish/appserver/distributions/glassfish/target/antrun/build-main.xml:9: The archive microprofile-jwt-auth-api.jar doesn't exist
[ERROR] around Ant part ...<jarupdate basedir="/home/jenkins/agent/workspace/eclipse-ee4j_jta-api-pulls-openjdk-jdk11-latest/glassfish/appserver/distributions/glassfish/src/main/patches/microprofile-jwt-auth-api" destfile="/home/jenkins/agent/workspace/eclipse-ee4j_jta-api-pulls-openjdk-jdk11-latest/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/modules/microprofile-jwt-auth-api.jar" includes="META-INF/MANIFEST.MF" />... @ 17:430 in /home/jenkins/agent/workspace/eclipse-ee4j_jta-api-pulls-openjdk-jdk11-latest/glassfish/appserver/distributions/glassfish/target/antrun/build-main.xml

yrodiere avatar Mar 02 '23 07:03 yrodiere

You are welcome :)

I wonder if Glassfish is building fine on their main branch now. I will try to have a look.

The reason we use Glassfish is to run the CTS with changes to make sure nothing is unexpectedly breaking.

tomjenkinson avatar Mar 02 '23 12:03 tomjenkinson

I have a feeling this might affect the current master branch of Glassfish. The most recent weekly build did pass (https://ci.eclipse.org/glassfish/view/GlassFish/job/glassfish_weekly_build/171/) but there are changes in Glassfish since 93176e2555176091c8522e43d1d32a0a30652d4a

tomjenkinson avatar Mar 02 '23 12:03 tomjenkinson

I am not sure why those approvals were just provided from those accounts. I don't think they are committers though: https://projects.eclipse.org/projects/ee4j.jta/who

tomjenkinson avatar May 26 '23 11:05 tomjenkinson

I am not sure why those approvals were just provided from those accounts. I don't think they are committers though: https://projects.eclipse.org/projects/ee4j.jta/who

Sorry Tom. We approved it because our team/project ran into exactly the same issue. Having these requires as static would solve these issues for us. We just upgraded our project from Spring boot 2 > 3 (which requires an javax > jakarta upgrade), but due to that upgrade, we were required to add a dependency on jakarta cdi as well (due to reason Yoann posted here).

We would've prefered a thumbs up / vote as it seemed this PR was a bit forgotten, but that wasn't possible. So we wanted to raise some awareness of this PR again. Although we're not familiar with the Jakarta release process, so this might still have been on the radar though.

NielsBerghenEveresst avatar May 26 '23 11:05 NielsBerghenEveresst

Ah, great - thank you for clarifying!

tomjenkinson avatar May 26 '23 13:05 tomjenkinson

Hello @tomjenkinson! Is there something I can help with to get this merged?

yrodiere avatar Aug 03 '23 10:08 yrodiere

Hey @tomjenkinson , is there any chance to get this merged?

yrodiere avatar Jan 30 '24 16:01 yrodiere

retest this please

tomjenkinson avatar Jan 30 '24 16:01 tomjenkinson

@yrodiere I have requested CI to retest this, thanks

tomjenkinson avatar Jan 30 '24 16:01 tomjenkinson

Looks like it's failing due to some Maven incompatibility:

+ mvn -Pstaging clean install -Djakarta.transaction-api.version=2.0.2-SNAPSHOT -DskipTests
[INFO] Scanning for projects...
[WARNING] Error injecting: org.glassfish.build.GlassFishJarLifecycle
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.NoSuchMethodError: org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping.<init>(Ljava/util/List;)V
  at org.glassfish.build.GlassFishJarLifecycle.<init>(Unknown Source)
  while locating org.glassfish.build.GlassFishJarLifecycle

1 error
    at com.google.inject.internal.InternalProvisionException.toProvisionException (InternalProvisionException.java:226)

FWIW Glassfish's main branch requires Maven 3.9: https://github.com/eclipse-ee4j/glassfish/blob/c6ee22af21e2578f745a516a251c0c662124b178/pom.xml#L78-L90

yrodiere avatar Jan 31 '24 07:01 yrodiere

Thank you, I have changed the configuration to use something that looked like it should expect to be latest. Will retry the build.

tomjenkinson avatar Jan 31 '24 15:01 tomjenkinson

retest this please

tomjenkinson avatar Jan 31 '24 15:01 tomjenkinson

retest this please

tomjenkinson avatar Feb 01 '24 10:02 tomjenkinson

There was something failing in JWT. I found a SHA in CI of something I hope to pass. It might need JDK upgrade though to 17 as the job is currently using JDK 11.

tomjenkinson avatar Feb 01 '24 10:02 tomjenkinson

I am trying a build locally. I tried a few versions of a build earlier but couldn't get the build to fail for a missing microprofile-jwt-auth-api.jar but I am using the same SHA now. Also with 78a3424568a59097da7c6479c74cb7ccc42a749e it does seems to be at least getting the build started with JDK 11

tomjenkinson avatar Feb 01 '24 15:02 tomjenkinson