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

Adding module-info.java to non-tests Jetty modules #3120

Merged
merged 81 commits into from
Nov 22, 2018

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Nov 16, 2018

Fixes #2978, adding module-info.java to non-tests Jetty modules.

Added module-info to jetty-util.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-util-ajax.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-io.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-jmx.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-http.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-server.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-xml.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-alpn-client.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-alpn-server.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-alpn-conscrypt-client.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-alpn-conscrypt-server.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-alpn-java-client.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-alpn-java-server.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-client.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to http2-hpack.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-common.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to http2-server.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-servlets.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to http2-client.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to http2-http-client-transport.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-security.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-servlet.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-webapp.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-jndi.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added module-info to jetty-plus.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@joakime
Copy link
Contributor

joakime commented Nov 16, 2018

Looks like this branch could use a rebase against jetty-10.0.x (to eliminate the noise of merges)

apache-jsp/src/main/java/module-info.java Outdated Show resolved Hide resolved
Reformatted module-info.java files (braces on new line).

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
<properties>
<bundle-symbolic-name>${project.groupId}.server</bundle-symbolic-name>
<jetty-http-tests-jar>${settings.localRepository}/org/eclipse/jetty/jetty-http/${project.version}/jetty-http-${project.version}-tests.jar</jetty-http-tests-jar>
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems awkward.
@olamy got any ideas on how to do this more clearly? and not via the local repository?

Copy link
Member

@olamy olamy Nov 17, 2018

Choose a reason for hiding this comment

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

sadly no...... I would prefer using the directory within reactor (--patch-module can accept directories as well as file but I don't any to say use project.build.outputDirectory of those modules...) well you need to install first to get this working with ide... (not ideal...) Definitely something to add in maven-compiler-plugin

Copy link
Member

Choose a reason for hiding this comment

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

I would even prefer using <goal>copy-dependencies</goal> to copy the jar in the target directory. So at least IDE can deal with that. Otherwise before running test with your IDE you need to first install the jars

Moved jetty-http test utility classes to new module "jetty-http-test".
This simplifies the dependencies and the configuration for JPMS.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet
Copy link
Contributor Author

sbordet commented Nov 19, 2018

@joakime @olamy I have split the test utility classes of jetty-http into a new module jetty-http-test.
This should resolve your concerns (and it's way simpler for JPMS too).

Copy link
Member

@olamy olamy left a comment

Choose a reason for hiding this comment

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

Yeah. and first part of #3080

<build>
<plugins>
<!--TODO: do we need this test-jar?-->
Copy link
Member

Choose a reason for hiding this comment

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

I don't think so. But maybe leave it temporary until we finish fixing #3080 . Well this will change the jars we publish to Maven central. But is there anyone using http://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-server/9.4.14.v20181114/jetty-server-9.4.14.v20181114-tests.jar ?

Removed test-jar generation from jetty-http.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Removed generation of test-jar from websocket-core.
Reorganized code to not depend on a tests jar to simplify dependencies
and configuration of JPMS.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Removed usage of test-jar.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet
Copy link
Contributor Author

sbordet commented Nov 20, 2018

@joakime @olamy I have removed the usages of tests jars from jetty-http and websocket-core.

The only other place I reference ${settings.localRepository} for JPMS is https://github.com/eclipse/jetty.project/blob/jetty-10.0.x-2978-add_module_info/jetty-quickstart/pom.xml.

I need to patch servlet-api.jar with jetty-schemas.jar to make the jetty-quickstart tests working fine.

Any better idea on how can this be done?

@joakime
Copy link
Contributor

joakime commented Nov 20, 2018

Perhaps it's time to bring back the custom servlet-api Jar.

We could start with https://github.com/eclipse/jetty.toolchain/blob/master/jetty-osgi-servlet-api/pom.xml
Then rename it to be something like jetty-servlet-api.
Followed by appropriate changes for OSGi (the original purpose), and then JPMS (like a reference to jetty-schemas)?
WDYT?

@sbordet
Copy link
Contributor Author

sbordet commented Nov 20, 2018

@gregw is filing an issue to the Servlet Spec to have the standard jar include the schemas.

@janbartel also says that using the toolchain "jetty-osgi-servlet-api" jar may be the way to go: drop "osgi" from the jar name and just call the toolchain jar "jetty-servlet-api".
@joakime can you do what @janbartel suggests?

@joakime
Copy link
Contributor

joakime commented Nov 20, 2018

@sbordet yup, can do.
Created jetty/jetty-toolchain#20 to work on these tasks.
Should have a PR ready at eclipse/jetty.toolchain ready today.

@joakime
Copy link
Contributor

joakime commented Nov 20, 2018

Do we need to update our schemas from the https://github.com/javaee/schemas ?
(Found this github reference at jakartaee/servlet#1 (comment))

Removed generation of test-jar from websocket-core.
Reorganized code to not depend on a tests jar to simplify dependencies
and configuration of JPMS.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet
Copy link
Contributor Author

sbordet commented Nov 20, 2018

@joakime regarding the jetty-schemas jar included in the servlet-api jar, here is the story.

Jetty loads the XML schemas resources using the context classloader; the JVM finds that no JMPS module defines javax.servlet.resources, so it looks in all the JPMS modules, cracking open their jars and looking for the resource.
If jetty-schemas.jar had a Automatic-Module-Name, it would find these resources.

However, the same resources are loaded also by org.apache.tomcat.util.descriptor.DigesterFactory which tries to load the schema resources using ServletContext.class.getResource(), which loads resources only from the module that exports the class, so in this case the Servlet API jar.

Tomcat does not get warnings (about not being able to find schema resources) because they have their own Servlet API jar that includes the schema resources.

Jetty has the warning because it uses DigesterFactory with the official Servlet API jar that does not have the schema resources in it.

Removed leftover references to jetty-http test-jar.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Removed generation of test-jar from websocket-core.
Reorganized code to not depend on a tests jar to simplify dependencies
and configuration of JPMS.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>jetty-http-test</artifactId>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think jetty-http-tools is a better name
Something called jetty-http-test should test jetty-http
Something called jetty-http-tools contains tools built from jetty-http

Renamed module jetty-http-test to jetty-http-tools.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet merged commit 5f972b4 into jetty-10.0.x Nov 22, 2018
@sbordet sbordet deleted the jetty-10.0.x-2978-add_module_info branch November 22, 2018 11:38
@joakime joakime changed the title Jetty 10.0.x 2978 add module info Adding module-info.java to non-tests Jetty modules Dec 5, 2020
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 to relevant Jetty modules
5 participants