Jahia Dev Forum > Add the project...

0 (0 Good)
0 (0 Bad)

Add the project build version to the Footer

by  nabil.benabdallah@outlook.com »  2016/07/25 14:39

Hi, I want to display the version of my project in the Footer but I couldn't find how to do it.

I tried this but it doesn't work: 

1. In the pom.xml of the module, I added :

     <plugin>  
        <groupId>com.google.code.maven-replacer-plugin</groupId>  
        <artifactId>maven-replacer-plugin</artifactId>  
        <version>1.3.2</version>  
        <executions>  
         <execution>  
          <!-- the replace should happen before the app is packaged -->  
          <phase>prepare-package</phase>  
          <goals>  
           <goal>replace</goal>  
          </goals>  
         </execution>  
        </executions>  
      
        <configuration>  
         <includes>  
          <!-- replace the token in this file -->  
          <include>/ppb-parent-project/ppb-module/src/main/resources/bpnt_blockFooter/html/blockFooter.jsp</include>  
         </includes>  
         <regex>false</regex>  
         <!-- the name of the token to replace -->  
         <token>PROJECT_VERSION</token>  
         <!-- replace it with the maven project version -->  
         <value>${project.version}</value>  
        </configuration>  
       </plugin>  

2. In the blockFooter.jsp

Project version is <i>PROJECT_VERSION</i>

 

 

 

 

 

  (nabil.benabdallah@outlook.com)

Number of messages  9
Registration date
0 (0 Good)
0 (0 Bad)

Re : Add the project build version to the Footer

by  dgigon@jahia.com »  2016/07/25 15:16

Hello Nabil,

 

Please consider to use filter instead.

http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

 

Best regards,

Dominique

  (dgigon@jahia.com)

Number of messages  6
Registration date
0 (0 Good)
0 (0 Bad)

Re : Re : Add the project build version to the Footer

by  nabil.benabdallah@outlook.com »  2016/07/25 16:56

Hello Dominique,

Thank you for the response, I used the filter plugin and now I have the build version but only under   \target\classes\bpnt_blockFooter\html\blockFooter.jsp.

How can I display this value please ?

Best regards.

  (nabil.benabdallah@outlook.com)

Number of messages  9
Registration date
0 (0 Good)
0 (0 Bad)

Re : Re : Re : Add the project build version to the Footer

by  dgigon@jahia.com »  2016/07/26 08:57

Hello, 

I am not sure to understand your question.

The replace is done in the place specified in the directory tag.

Example:

<resources>
  <resource>
    <directory>src/main/resources/resources</directory>
    <filtering>true</filtering>
  </resource>
</resources>

Best regards,

Dominique

  (dgigon@jahia.com)

Number of messages  6
Registration date
0 (0 Good)
0 (0 Bad)

Re : Re : Re : Re : Add the project build version to the Footer

by  nabil.benabdallah@outlook.com »  2016/07/26 09:29

Hello Dominique,

Actually, that's what I did, this is my code :

<resources>
    <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
            <include>**/bpnt_blockFooter/html/blockFooter.jsp</include>
        </includes>
    </resource>
    <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
        <excludes>
            <exclude>**/bpnt_blockFooter/html/blockFooter.jsp</exclude>
        </excludes>
    </resource>
</resources>

Now when editing the file Workspace\MyModule\target\classes\bpnt_blockFooter\html\blockFooter.jsp I can find the value "1.0-SNAPSHOT" but in my browser it displays nothing.

Best regards.

 

  (nabil.benabdallah@outlook.com)

Number of messages  9
Registration date
Contact
Share
Feedback

Get in touch

Whether you are a current user or if you are just evaluating Jahia, we are here to help.

Contact us

Share this page