We have a web application (Java + Tomcat + Spring + Maven) that depends on resources. So the app-1.0.1.war depends on the resources-1.0.3.jar. When we need to fix a bug in the resources, we need
- release a new resources jar => 1.0.4
- update the dependency in the maven pom of the web app
- release a new war => 1.0.2
- deploy the web app
In our team some people think that it’s a not an efficient way to do. They would prefer to
- release a new jar
- upload the jar on the server
So basically no redeployment of the app. It seems easier but I can see several problems with this approach:
- You need to hard code the name of the jar that contains the resources.
- You don’t know the version of the resources the app is using.
What is the common practice to update static resources of a web application?
We follow a similar approach with our projects as well.
There are a number of reason to do this, these are some of the ones that stick out for me:
If none of these apply to you, consider reading Dependency Version Ranges in the Maven documentation. Something like this should accomplish what you’re trying to do:
Edit:
This is untrue, the resources would only be updated each time
mvn installis run – every time you build a war.So yes, you will always have the most updated jar during development but an older war would not suddenly be bundled with freshly released jars on the fly. And trust me, you definitely do not want that.
You are only cutting out one step:
You’re adding a lot of risk to remove one step. Check out the link I posted above, it might give you some more fitting alternatives.
LATESTis probably not what you’re looking for.