I’m trying to split a Maven WAR project into two modules, so that I can build a separate JAR file with command line tools. The result has the following structure:
pom.xml(packagingpom, has two modules)project-jar/pom.xml(packagingjar)
project-war/pom.xml(packagingwar, depends onproject-jar)
If I run mvn commands from the root, everything works fine. I’d like to keep using mvn jetty:run, but for that I need to execute the command in the WAR subproject. If I do that, fails to find the project-jar subproject, so it won’t run. Even mvn jetty:run-war with a completely assembled WAR file in the target directory fails, because it first tries to “build” the project. I’ve only managed to make it work by installing project-jar into the local Maven repository, which isn’t very nice.
Is there a way to use the Jetty plugin in a multi-module Maven configuration?
There is no magical solution and the only one I know is a bit hacky and rely on the
extraClasspathelement that you can use to declare extra class directories, relatively. Like this (from JETTY-662):