-1

I am using a package.properties file in my eclipse project (struts2). When running the application from eclipse, formatting date and time works fine but when I am deploying this project with maven to tomcat7, it seems that this file is not being included in war file and thus the formatting doesn't work. Can anyone please help?

Saro
  • 810
  • 2
  • 12
  • 22

1 Answers1

3

Try placing the package.properties file at path src/main/resources of your maven project, Maven picks the files in resources directory.

Refer to this link to understand where to place the properties file:

Struts 2 – Resource bundle example

Alternatively if you don't want to place the files in resources directory then you can refer to this below link to understand how to pick properties file from src/main/java :

In maven how can I include non-java src files in the same place in the output jar?

Community
  • 1
  • 1
Chaitanya
  • 15,403
  • 35
  • 96
  • 137
  • Thanks for the reply. But then the struts doesn't see the package.properties. – Saro Sep 05 '14 at 16:00
  • Check your WAR/EAR and see if the properties file is going to correct place, if the file is present and still struts is not recognizing means then it is not a Maven issue, it will be some other issue with struts configuration. – Chaitanya Sep 05 '14 at 16:02
  • According to struts2 documentation, one must place the package.properties file in the action folder. Doing this in eclipse works. But when deploying this application by maven, this property file is not being deployed to the action package in target folder. – Saro Sep 05 '14 at 16:12
  • Yes, you can place that in action folder, I have updated my answer and provided a link, please refer to that to understand how to place it. Also given another link on how to access non-java files present in `src/main/java` – Chaitanya Sep 05 '14 at 16:16
  • There is no need to hack around maven. Just place resource files into appropriate package inside resource folder. – Aleksandr M Sep 05 '14 at 17:18