I have a java enum that is used in my web application. I also have a lot of javascript code that refers to the values of the enum. It would be ideal If I could generate a javascript file from the enum as part of the maven build process. Does anyone know of a project that solves this problem or of an elegant way to tackle it ?
Thanks!
I have a java enum that is used in my web application. I also
Share
It turns out that there is a great way to do it using a groovy maven plugin as a “prepare-package” phase.
This is the code :
In your pom.xml add this entry :
This is how the groovy script, GenerateJavaScriptEnum.groovy, looks like :