I am using Eclipse for developing a Maven project.
I tried to use the externalize Strings wizard in Eclipse. By default, the resulting messages.properties is placed within the "src/main/java" folder. Yet, when packaging my project with Maven, the properties file is thrown out from the created jar file. Therefore I tried to move the message.properties to the "src/main/resources" folder but it seems like Eclipse does not accept that!
I'd rather not modify my pom.xml since it is quite standardized in the enterprise. So is there a way to force Eclipse to accept having the properties file out of the "src/main/java"?
Thanks for your help.
I created bug 369296 at eclipse.org for this, and in the process of doing that, I found a work-around. It turns out that the m2e plugin (which manages maven projects in eclipse) adds an exclusion filter of "**" to any resource directory. This exclusion filter prevents the NLS wizard from using that resource directory as its source folder.
So, to work around this issue, edit your build path in eclipse and remove the ** exclusion from the src/main/resources folder. Then, run the NLS wizard and do all the NLS-y things you want to do. Lastly, have m2e regenerate the project configuration - this will re-add the ** exclusion.
Hope this helps. It looks like they're going to fix my bug.
If you are using spring, make sure that in your application servlet context you have:
<resources mapping="/resources/**" location="/resources/" />
In your JSP:
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:message key="whatever.key.from.message.file" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With