Is there a Maven plugin or similar tool that can configure a running Tomcat server?
-
05-07-2021 - |
سؤال
My organization wants to put "configuration" of the container (such as JMS resources and datasources) into source control. I'd like haven Maven be able to execute this as a goal. This isn't far from the underlying ideas behind liquibase, where you can update your schema with mvn liquibase:update
.
I'd like something that could be like:
mvn container:config -Pdev
and it would go out to the dev server and perhaps add a datasource to the server.xml. Bonus points if the solution is portable across GlassFish.
Anyone know of a tool like this?
المحلول
No, there does not appear to be a ready-made tool that does this. You probably will have to do something with Maven Antrun Plugin that executes a script to logon to the Tomcat server (i.e. via ssh) and manipulate the server.xml
file directly.
I might use a combination of Ant SCP Task and XML Task
نصائح أخرى
If you want to put run-time configuration under version control consider using tools like:
It's possible to use Maven to run your deployments, but you'd be better advised to deploy your application to a Maven repository (like Nexus) and then download from there during deployment. That way you avoid re-compiling your code everytime you want to install your application.