I'm developing a Spring MVC application and I use Maven. I'm currently trying to create some Java "scripts" (I'm not sure I should call them "scripts", I actually mean "Java classes with a main(String[] args) method" that can be callled on the command line) to do some work using Liquibase.
The "scripts" would load some context files from the Spring MVC application and have access to the properties files from the web application. They will thus be able to use the same database connection settings than the application, etc.
My question is: how to run those scripts?
Locally I'm using Eclipse and running those "scripts" is easy using "Run As / Java Application". But I want to be able to run them on my prod server too, on which I can't use eclipse to start them. What should I do to be able to run them there?
Should I export my application in another format than .war? Should I create an extra .jar from the project to be able to run the scripts using "java -jar"?
Should I create a separate project for those scripts? But then, would the scripts be able to load the required contexts from the Spring MVC application located in the other project?
Maybe there is an easy way to do this that I don't see?
UPDATE : One way I see I could achieve what I want would be by having the web application to expose web services as a door to the tasks to run. Then I could call those using wget or something, on the command line. But I'd prefere to be able to reach the classes directly, without the need to create web services.