Modifying Configuration Template "Application Context" default format for WAR?
Answered
When I create a Run/Debug Configuration for Tomcat Server and use the Deployment to add deployables, the application context for a module abc-def gets generated by IDEA as abc_def_war.
Unfortunately, the real context in Tomcat is indeed abc-def (dashes, not underscores and no _war at the end). I always modify the Application Context manually for each included module, but it is tedious and error-prone. Is there a way to modify the default format for the template?
I looked in Edit Configuration Templates and found no option to do so. I also looked in the global settings but could not find it.
Any suggestions would be greatly welcome.
Please sign in to leave a comment.
IntelliJ IDEA instructs Tomcat to use the context specified in this field. It should work with any text specified there by default, including
abc_def_war
.There is no way to change the default context name.
Related issues:
https://youtrack.jetbrains.com/issue/IDEA-109843/Default-run-debug-config-for-webapps
https://youtrack.jetbrains.com/issue/IDEA-222248/Default-Application-context-name-in-Server-run-Config-for-tomcat-should-be-definable-by-module-source
Bummer on no way to change it. This is why:
And you may close this ticket.
You can use external source artifact if you build it with Maven and the context will be correct automatically from the war file name.
Right, deploying from the artifact is no problem, as it is generated correctly by Maven. It is running the artifact in the IDE that is a royal pain in the rear and requires editing every single artifact Context value in the IDE, since the IDE generates a Context that doesn't execute.
But if that is the code - no matter how inadequate - that is the code. Go ahead and close the ticket.