I've been upgrading a spring boot application to spring boot 3 (3.3.1) and so i need to upgrade the jetty version to 12 so i did. But when i try to upgrade the jetty-maven-plugin also it fails on startup. Here is the error:
[WARNING] Failed startup of context oeje10mp.MavenWebAppContext@19105a87{/artifactId,/artifactId,b=file:///C:/Users/username/git/projectname/web-app/src/main/webapp/,a=STOPPED,h=oeje10s.SessionHandler@83b0d0f{STOPPED}}{./webapps/project-version-project.war}
java.lang.IllegalArgumentException: File not resolvable or incompatible with URLClassloader: file:///C:/Users/username/git/projectname/web-app/./resources/projectArtifactId
at org.eclipse.jetty.ee10.webapp.WebAppClassLoader.addClassPath (WebAppClassLoader.java:260)
at org.eclipse.jetty.ee10.webapp.WebAppClassLoader.<init> (WebAppClassLoader.java:212)
at org.eclipse.jetty.ee10.webapp.WebAppContext.configureClassLoader (WebAppContext.java:469)
at org.eclipse.jetty.ee10.webapp.WebAppContext.preConfigure (WebAppContext.java:442)
at org.eclipse.jetty.ee10.webapp.WebAppContext.doStart (WebAppContext.java:498)
at org.eclipse.jetty.ee10.maven.plugin.MavenWebAppContext.doStart (MavenWebAppContext.java:311)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:169)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:120)
at org.eclipse.jetty.server.Handler$Abstract.doStart (Handler.java:491)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:169)
at org.eclipse.jetty.server.Server.start (Server.java:624)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:120)
at org.eclipse.jetty.server.Handler$Abstract.doStart (Handler.java:491)
at org.eclipse.jetty.server.Server.doStart (Server.java:565)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.maven.AbstractJettyEmbedder.doStart (AbstractJettyEmbedder.java:206)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.ee10.maven.plugin.JettyRunMojo.startJettyEmbedded (JettyRunMojo.java:98)
at org.eclipse.jetty.ee10.maven.plugin.AbstractWebAppMojo.startJetty (AbstractWebAppMojo.java:451)
at org.eclipse.jetty.ee10.maven.plugin.AbstractWebAppMojo.execute (AbstractWebAppMojo.java:429)
at org.eclipse.jetty.ee10.maven.plugin.JettyRunMojo.execute (JettyRunMojo.java:86)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Here is the updated pom.xml (part of it):
<plugin>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-maven-plugin</artifactId>
<version>12.0.10</version>
<configuration>
<testClassesDirectory>${project.basedir}/target/resources</testClassesDirectory>
<!-- <useTestClasspath>true</useTestClasspath>-->
<!-- <webAppXml>${project.build.outputDirectory}/jetty-web.xml</webAppXml>-->
<useTestScope>true</useTestScope>
<contextXml>${project.build.outputDirectory}/jetty-web.xml</contextXml>
<httpConnector>
<port>15600</port>
</httpConnector>
</configuration>
</plugin>
Here is the jetty-web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.ee10.webapp.WebAppContext">
<Set name="contextPath">/${deployable.artifactId}</Set>
<Set name="war">
<SystemProperty name="config.home" default="."/>/webapps/${deployable.artifactId}-${project.version}.war
</Set>
<!--Allow log4j & other properties to be loaded outside of the WAR depending on environment-->
<Set name="extraClasspath">
<SystemProperty name="config.home" default="."/>/resources/${deployable.artifactId}
</Set>
</Configure>
How ever it works if used org.eclipse.jetty:jetty-maven-plugin
version 11.0.14 or with the updated plugin but removing the set extraClasspath property from the xml file. Did the extraClasspath property changed in version 12 or usage of it? I haven't been able found anything.
As @Joakim Erdfelt pointed out in the comment, the new version fails when extraClasspath set to a non-existing path contrary to the older version.