Search code examples
mavenjsf-2

How to setup Maven to enable JSF2 resources versioning?


I have read the following essay: Resources (library) in JSF 2.0

It's about versioning of web resources for JSF2 project.

May I know how could I do when my project is Maven-based? What need to be setup or added in the Maven setting?

Thanks a lot.


Solution

  • Effectively your question is a combination of three existing questions in Stackoverflow.

    One is already superfluous since you already know how JSF versioning works, you just (unfortunately) referred an external site and not the existing question but from this question you need to 'remember' the format of the version number that needs to be used.

    The second part should also not have been to difficult to come up with. JSF is a runtime framework and has no build/deploy time features. But you already use maven, so what is needed to build time copy(move?) the resources to a new location. The source folder can differ, it can be an additional resources folder e.g. src/main/myresources, that you don't treat as a resources (since it would end up in the classes folder then by default) or it can be a folder inside the webcontent and then you need to move (copy/delete). This is all for you to find out.

    The third part is that the destination folder needs the version in the right format

    1_0
    1_1
    1_2_3
    

    Since this differs from the project version format, you need to search/replace this which includes the project version in the right format. There are features for this as well in maven.

    So you see, it all boils down to breaking a problem down into manageable parts...