maven jetty plug in mvn:jetty ServletContext.getRealPath(“”) and ServletRequest.getRealPath(“”) to point to target _instead_ of source folders?
-
25-09-2019 - |
문제
SUMMARY: The goal is to find the path to the WEB-INF folder in the target folder for maven-jetty-plugin that is compatible with other servers as well. The ServletContext.getRealPath("") works beautifully for, e.g., Tomcat, or mvn jetty:run-war. Thank you
Misha
Dear All:
This is related to http://tickets.openmrs.org/browse/TRUNK-1760
It can be easily tested with the following commands:
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-light-struts-archetype -DarchetypeVersion=2.1.0-M1 -DgroupId=com.mycompany -DartifactId=myproject
cd myproject
patch -p0 < diff
cd myproject
mvn clean install -DskipTests && mvn jetty:run
Please find the diff file here: http://old.nabble.com/file/p29815681/diff
Now, navigate to http://localhost:8080/ in a browser and this will point to !!! /home/misha/workspace/myproject/src/main/resources
Should this not, instead, point to?
./target/classes
or
./target/myproject-2.1.0-M1/WEB-INF/classes
Is it possible to modify this behavior?
Thank you so much
Yours
Misha Koshelev
해결책
It seems one work around, per Jan Bartel's very helpful post on the user at jetty dot codehaus dot org mailing list, is to use
mvn jetty:run-exploded
I believe one of the disadvantages of this method is the extra time that it will take to first assemble a WAR and then to run it.
Thank you Misha
p.s. Reference to Jan Bartel's post: http://markmail.org/message/445huiwr6vljblxn