The question is what is the best solution of the two? If the correct is 2, what is the best way to copy it to target folder? Is there any other solution better and more common than those two?
因为你希望该文件被复制到目标/ classes文件夹,它以某种方式被认为是一个资源(所以放在src / main / resources或声明src / main / conf作为资源目录)。如果你不想在最终的jar中,请配置Maven JAR Plugin来排除它:
...
...
org.apache.maven.plugins
maven-jar-plugin
2.3.1
**/conf/*
...
...
对于汇编部分,汇编描述符非常灵活,因此应该可以实现您想要的,而不管选择。我建议使用最简单的设置。