简体   繁体   English

shell或groovy脚本在maven编译期间创建Java类

[英]shell or groovy script to create Java class during maven compile

i am planning to execute a script file during maven compilation of my project. 我计划在我的项目的Maven编译期间执行脚本文件。 The script shall look at a properties file and using the values in there, it should create a Java class (with static final Strings which have the values from properties files as values) which can be used later on within the project. 该脚本应查看一个属性文件,并使用其中的值,它应创建一个Java类(带有静态最终String,这些字符串具有来自属性文件的值作为值),该Java类稍后可在项目中使用。

what would be the best way to do this? 最好的方法是什么?

Once compiled the Java file should be visible from within the IDE. 编译后,Java文件应在IDE中可见。 I was thinking about using gmaven plugin , but i am not sure whether it is possible to create files with it. 我当时正在考虑使用gmaven插件 ,但不确定是否可以使用它创建文件。 Otherwise i will have to use bash script or similar to create Java file. 否则,我将不得不使用bash脚本或类似工具来创建Java文件。

thanks for any advice or opinion 感谢您的任何建议或意见

我最终使用gmaven插件运行groovy脚本,然后使用maven build helper插件将生成的源代码包括在编译中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM