I have a set of ruby files where I have some string of type:
我有一组ruby文件,其中有一些类型的字符串:
@something = [Whatever.new('1rabbit'),
Whatever.new('2rabbit'),
Whatever.new('3rabbit')]
I would like to parse out this information from the ruby file during compilation phase (javac run with maven - but i think it is no difference how javac is run), and create a .class enum of type:
我想在编译阶段从ruby文件中解析出这些信息(使用maven运行javac - 但我认为运行javac没有区别),并创建一个类型的.class枚举:
public enum Something {
1RABBIT,
2RABBIT,
3RABBIT
}
and store it into the target folder. Then, I can use this enum whatever I want (after this initial compilation). I looked into AnnotationProcessors, and bytecode generation, but the first requires annotations, and the second is done during runtime. And I cannot find out how to do it properly.
并将其存储到目标文件夹中。然后,我可以随意使用这个枚举(在这个初始编译之后)。我查看了AnnotationProcessors和字节码生成,但第一个需要注释,第二个是在运行时完成的。我无法找到如何正确地做到这一点。
What is the correct tool to do this, and how?
什么是正确的工具,以及如何做到这一点?
1 个解决方案
#1
2
maven
s life cycle has a generate sources phase. There you cold use the exec-maven-plugin
to run a script generating the enums.
mavens生命周期有一个生成源阶段。在那里你冷使用exec-maven-plugin来运行生成枚举的脚本。
#1
2
maven
s life cycle has a generate sources phase. There you cold use the exec-maven-plugin
to run a script generating the enums.
mavens生命周期有一个生成源阶段。在那里你冷使用exec-maven-plugin来运行生成枚举的脚本。