Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

A Resource Bundle Validator for Maven

DZone's Guide to

A Resource Bundle Validator for Maven

· DevOps Zone
Free Resource

The DevOps Zone is brought to you in partnership with Sonatype Nexus. The Nexus Suite helps scale your DevOps delivery with continuous component intelligence integrated into development tools, including Eclipse, IntelliJ, Jenkins, Bamboo, SonarQube and more. Schedule a demo today

I have implemented a maven plugin (which can be downloaded here  ) that helps you to find out what resource bundle keys are missing in different bundles. 

This can be useful when your web application suppose to support few languages. This plugin will ensure to find the missing keys in a maven compile time.

All you need to do is configure in your pom like below:

            <plugin>
                <groupId>com.maven.plugins</groupId>
                <artifactId>ResourceBundleValidator</artifactId>
                <version>1.0-SNAPSHOT</version>
                <configuration>
                    <resourceBundleDirectory>${basedir}/src/main/webapp/WEB-INF/resources</resourceBundleDirectory>
                    <resourceBundleGroups>
                        <property>
                            <name>labels</name>
                            <value>labels,labels_sv</value>
                        </property>
                        <property>
                            <name>messages</name>
                            <value>messages,messages_sv</value>
                        </property>
                    </resourceBundleGroups>
                </configuration>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>validateBundlesGoal</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

labels or labels_sv are the properties files which need to be in sync, as well as messages and messages_sv.

As soon as you run mvn clean package this plugin will validate the resource bundles and will ensure they are in sync if not the build will fail and the missing keys will be anounced in a the log.



The DevOps Zone is brought to you in partnership with Sonatype Nexus. Use the Nexus Suite to automate your software supply chain and ensure you're using the highest quality open source components at every step of the development lifecycle. Get Nexus today

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}