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

Add jakarta.batch API module-info #192

Merged
merged 4 commits into from
Jan 20, 2022
Merged

Conversation

scottkurz
Copy link
Contributor

@scottkurz scottkurz commented Jan 11, 2022

Signed-off-by: Scott Kurz [email protected]

Need to run with -P staging profile.

Fixes #180

Signed-off-by: Scott Kurz <[email protected]>
@scottkurz scottkurz changed the title first module-info draft Add jakarta.batch API module-info Jan 13, 2022
@scottkurz
Copy link
Contributor Author

@chengfang just going to ping you for a review please. This is the last item, I think, for the 2.1 API/spec.


// Optional - note this transitively requires jakarta.inject
requires static jakarta.cdi;

Copy link

@OndroMih OndroMih Jan 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's OK that jakarta.cdi is optional. But shouldn't we also add an explicit dependency on jakarta.inject, since that one is really required all the time to support batch properties injection?

Suggested change
requires jakarta.inject;

Copy link
Contributor Author

@scottkurz scottkurz Jan 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize since though I brought up this issue, I don't think my comments have kept up with the code I pushed here.

I see your point and we could make this change (I'd be OK with that).

One point I started to make: it is possible to have an application that just starts and monitors, etc. jobs via JobOperator that does NOT itself require 'inject'.

So from a purely minimalist point of view I think the case could be made that it's "optional", strictly speaking.

However... jakarta.inject is a small API that doesn't drag in other dependencies while jakarta.cdi is a good bit bigger.

If you think a more reasonable compromise is to include a runtime dependency for jakarta.inject, and keep the jakarta.cdi dependency as static/optional... I'd believe you. I don't have a lot of real-world experience with JPMS to be honest.

@rmannibucau had commented too on this point.

for inject: it is less critical to me since batchproperty hardly depends on it so if we want to make it optional we should split the api in 2 at least so likely not for this time IMHO.
Reading that now, I think he more agreed with you... am I reading that correctly?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's see it one level higher: Scott is right inject is optional for end user but if the end user needs it, it will add it cause its code depends on it so let's ensure it is statically required only maybe? it would also align with the API itself which has both jars as provided (https://github.com/eclipse-ee4j/batch-api/blob/master/api/pom.xml#L33)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking was along what the spec requires from the implementation. And DI support is mandatory, while CDI support is optional, am I wrong? Therefore, since DI needs to be in the impl, it should be mandatory. And also transitive so that it's available to the user even if they only require batch and not jakarta.inject. Now I realize that required modules aren't automatically transitive, so I'd suggest that we add the following:

Suggested change
requires transitive jakarta.inject;

I only suggest it because it seems as the purest solution for me (works like maven - you only need to require batch and you can also use @Inject without any other required module). I don't insist on it, we can leave it to the user to add the dependency on DI or revisit this in a later version of the spec.

Copy link
Contributor Author

@scottkurz scottkurz Jan 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we do:

requires static transitive jakarta.inject;

This way we get a single dependency for the typical application with a batch job implementation (artifacts, etc.), and a user still has the option to build a batch operator/client without using inject or cdi.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good, I agree with that.

@scottkurz scottkurz merged commit f714d4f into jakartaee:master Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add module-info.java
4 participants