1

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.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Tom Fong
  • 125
  • 8
  • I vote to reopen since I think it is about e.g. automagically adding a maven version info into the resources folder structure. Effective;y being a combination of two questions. One of which is the duplicate and one is some maven resources copy/move action with placeholders – Kukeltje Jun 04 '20 at 12:55
  • I'll try to write an answer over the weekend when I have access to a normal pc again instead of just s mobile phone – Kukeltje Jun 05 '20 at 06:02
  • @Kukeltje any update? Thank you. – Tom Fong Jun 08 '20 at 01:47
  • And in your new question, post the complete structure of the resouces folder hierarchy and how you use it in a [mcve]. Yes, the output is relevant to, but also the server side source. And in the new question, also take https://stackoverflow.com/questions/24472095/jsf-is-unable-to-find-resources-in-sub-folders into account – Kukeltje Jun 23 '20 at 09:08
  • And https://stackoverflow.com/questions/18143383/how-to-use-jsf-versioning-for-resources-in-jar too (are your resources in a separate jar or not?) – Kukeltje Jun 23 '20 at 09:14

1 Answers1

1

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...

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
  • I have deployed versioning successfully. It can adapt the highest-level version resources. However, in html, it doesn't show the link like ".../javax.faces.resource/css/style.css?ln=default&v=2_0" but just ".../javax.faces.resource/css/style.css?ln=default". How can I enable it to show the version number? – Tom Fong Jun 23 '20 at 02:44
  • Great! Maybe you can share the important parts in an additional answer? Regarding the version info missing in the link, I do not really have an idea. Please create a new question for this and we'll see if we can get to the bottom of this (or find a duplicate). – Kukeltje Jun 23 '20 at 06:13
  • I have update the question and see if you can understand it more. – Tom Fong Jun 23 '20 at 07:13
  • I said **new** question... Not edit the existing one ;-) – Kukeltje Jun 23 '20 at 08:41
  • my question quota reached limit – Tom Fong Jun 24 '20 at 01:20
  • anyway my problem solved :) I wrote a custom resourceHandler to solve my issue. Thanks a lot. – Tom Fong Jun 24 '20 at 03:31