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

Maven plugin add support for jar projects in :effective-web-xml #9497

Closed
mvysny opened this issue Mar 14, 2023 · 6 comments · Fixed by #9503
Closed

Maven plugin add support for jar projects in :effective-web-xml #9497

mvysny opened this issue Mar 14, 2023 · 6 comments · Fixed by #9503

Comments

@mvysny
Copy link

mvysny commented Mar 14, 2023

I'm building an app as a simple jar project, with embedded Jetty included as a dependency. I've found out that Jetty supports the quickstart mode, thus vastly speeding up boot time (and possibly even enabling native mode with GraalVM).

Unfortunately, mvn jetty:effective-web-xml fails with Packaging type [jar] is unsupported which leads me to believe that only the WAR-type projects are supported at the moment.

However, the jar-type project has a classpath very similar to the war-type project, and so this ticket could perhaps be fixed simply by removing the limitation in the Jetty Maven Plugin.

Thanks again for your great work :)

I'm using Jetty 11.0.14.

@janbartel
Copy link
Contributor

@mvysny can you link to an example maven project?

@mvysny
Copy link
Author

mvysny commented Mar 14, 2023

@janbartel thank you for your reply, please try out https://github.com/mvysny/vaadin-boot-example-maven . Requires JDK 17+. There's Main.java which you can simply run.

@janbartel
Copy link
Contributor

@mvysny and you tried setting the supportedPackagings configuration param for the plugin to include jar? See https://www.eclipse.org/jetty/documentation/jetty-10/programming-guide/index.html#common-configuration

@mvysny
Copy link
Author

mvysny commented Mar 14, 2023

@janbartel thank you, I haven't realized that there's such a configuration parameter. Adding the parameter indeed helped, thank you :)

For future reference, this is what helped:

            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>11.0.14</version>
                <configuration>
                    <supportedPackagings><packaging>jar</packaging></supportedPackagings>
                </configuration>
            </plugin>

@mvysny mvysny closed this as completed Mar 14, 2023
@mvysny
Copy link
Author

mvysny commented Mar 14, 2023

Unfortunately, the plugin fails with:

Caused by: java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.getName(int)" because "path" is null
    at org.eclipse.jetty.maven.plugin.JettyEffectiveWebXml.configureWebApp (JettyEffectiveWebXml.java:66)
    at org.eclipse.jetty.maven.plugin.AbstractWebAppMojo.startJetty (AbstractWebAppMojo.java:430)
    at org.eclipse.jetty.maven.plugin.AbstractWebAppMojo.execute (AbstractWebAppMojo.java:419)

Indeed, path is null since war is most probably null since we're not having a war app: https://github.com/eclipse/jetty.project/blob/jetty-11.0.x/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEffectiveWebXml.java#L66

@janbartel
Copy link
Contributor

@mvysny try using the branch in this PR #9503. It should fix your problem. If not, post the config in the pom.xml that you're using so I have a better test case.

joakime added a commit that referenced this issue Mar 20, 2023
…-xml

Issue #9497 allow jetty:effective-web-xml for jar projects
@joakime joakime changed the title Maven plugin effective web xml: add support for jar projects Maven plugin add support for jar projects in :effective-web-xml Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants