Skip to content

Compile to Java 11 with module-info#21

Closed
rbygrave wants to merge 3 commits intojakartaee:masterfrom
rbygrave:feature/java9-module-info
Closed

Compile to Java 11 with module-info#21
rbygrave wants to merge 3 commits intojakartaee:masterfrom
rbygrave:feature/java9-module-info

Conversation

@rbygrave
Copy link
Copy Markdown
Contributor

Removes Automatic-Module-Name manifest entry and replaces it with module-info

Removes Automatic-Module-Name manifest entry and replaces it with module-info
@rbygrave rbygrave mentioned this pull request Sep 27, 2021
Copy link
Copy Markdown

@overheadhunter overheadhunter left a comment

Choose a reason for hiding this comment

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

When no longer targeting Java 8, maven.compiler.release performs stricter validation. See this SO answer explaining the differences

Comment thread pom.xml Outdated
Comment on lines +77 to +78
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>9</maven.compiler.source>
<maven.compiler.target>9</maven.compiler.target>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When moving to newer Java, I'd suggest to also move to using <maven.compiler.release>.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That is fine. I need to bump the maven-compiler-plugin version to do that but no problem.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, changed to use maven.compiler.release and pushed that commit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not target Java 11 instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have no problem with Java 11. Shall I change it to 11?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, I have changed it to compile to java 11 @Emily-Jiang

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Emily-Jiang @overheadhunter @Ladicek , are you guys happy with this PR now? Ok to approve it? Anything else to adjust on it?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm happy, but since I have no say in jakarta my approval doesn't really make a difference 😉

@Ladicek
Copy link
Copy Markdown
Member

Ladicek commented Sep 27, 2021

I'm looking at https://eclipse-ee4j.github.io/jakartaee-platform/jakartaee10/JakartaEE10ReleasePlan, specifically this part:

If a component Specification is planning a Major or Minor version update for Jakarta EE 10, then the recommendation would be to recompile and distribute the specification’s APIs at the Java SE 11 source and target levels. This is not a requirement since there may be reasons to continue compiling and distributing the APIs at an earlier Java source or target level.

There was also a discussion about this on the jakartaee-platform-dev list (which I don't follow), see e.g. https://www.eclipse.org/lists/jakartaee-platform-dev/msg02723.html

My understanding is that we don't intend to do any changes in Jakarta Inject, so I guess it would be best to stay on 8 and just add a generated module-info.class. I'm not sure if the JAR needs to become a MR JAR (as proposed by #20) -- I think Moditect can add the module-info.class directly to the root of the JAR.

Would that make sense? (Genuine question. There's too many things I don't really understand here :-) )

@rbygrave
Copy link
Copy Markdown
Contributor Author

I think Moditect can add the module-info.class directly to the root of the JAR.

You are correct, it can. I have modified #20 such that it isn't a multi-version jar.

recommendation ... at the Java SE 11 ... so I guess it would be best to stay on 8

I don't mind (or don't get a vote per say) but I'd also suggest we could do both? That is, release a version 2.0.1 that compiles using Java 8 (with module-info via moditech) and then additionally release a 3.0.0 version using Java 11? In that I think it's going to be nicer longer term to maintain Java 11 without the moditech plugin etc and anyone stuck on java 8 would have the 2.0.0 and 2.0.1 artifacts available to them.

Note that we need to use a recent version of maven-compiler-plugin for this.
@rbygrave rbygrave changed the title Compile to Java 9 with module-info Compile to Java 11 with module-info Sep 27, 2021
Copy link
Copy Markdown
Contributor

@Emily-Jiang Emily-Jiang left a comment

Choose a reason for hiding this comment

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

LGTM

@Emily-Jiang
Copy link
Copy Markdown
Contributor

I had a second thought on this. Since CDI depends on this, if CDI wants to support Java 8, this spec should compile on Java 8 as well. Otherwise, this will force CDI to move up to Java 11. We should discuss this at CDI spec @Ladicek before we can merge this PR.

Copy link
Copy Markdown
Contributor

@Emily-Jiang Emily-Jiang left a comment

Choose a reason for hiding this comment

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

Please don't merge this as yet until we discuss the mininum supported Java version in the CDI spec.

@overheadhunter
Copy link
Copy Markdown

I had a second thought on this. Since CDI depends on this, if CDI wants to support Java 8, this spec should compile on Java 8 as well. Otherwise, this will force CDI to move up to Java 11. We should discuss this at CDI spec @Ladicek before we can merge this PR.

hence merge & release #20 before this one, as proposed by @rbygrave in #19

@Ladicek
Copy link
Copy Markdown
Member

Ladicek commented Sep 29, 2021

Personally, I'd just merge #20, which lets us do a micro release, have a module-info.class, and still target Java 8. I see exactly zero reason to release a major whose only change is the bump to 11.

@Emily-Jiang
Copy link
Copy Markdown
Contributor

I guess this PR is not needed. Shall we close this PR for now?

@rbygrave
Copy link
Copy Markdown
Contributor Author

rbygrave commented Oct 4, 2021

Yes, I think we can close this for now. I am happy to submit another PR if we want to release a java 11 based artifact.

@rbygrave rbygrave closed this Oct 4, 2021
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.

4 participants