简体   繁体   English

Maven构建生成的SQL脚本放在哪里?

[英]Where to put SQL scripts generated by a Maven build?

We're in the process of replacing Ant builds by Maven builds. 我们正在用Maven构建替换Ant构建。 At the moment, we have a project that generates SQL scripts in the Ant build and puts them into our directory structure for artifacts. 目前,我们有一个项目,该项目在Ant构建中生成SQL脚本,并将其放入用于构件的目录结构中。

Now with introducing Maven, we will replace that directory structure by a Nexus repository. 现在,通过介绍Maven,我们将用Nexus存储库替换该目录结构。 I am not sure what to do with the generated SQL scripts. 我不确定如何处理生成的SQL脚本。

Should I zip them and put them as (side) artifact into the repository? 我应该压缩它们并将它们作为(侧面)工件放入存储库中吗?

Or should they be checked into version control? 还是应该将它们检入版本控制?

Or is there another, more elegant way? 还是有另一种更优雅的方式?

This probably applies to other automatically generated scripts, data, etc. as well. 这可能也适用于其他自动生成的脚本,数据等。

If your project needs to read these SQL files, then they can be generated in the src/main/resources folder. 如果您的项目需要读取这些SQL文件,则可以在src/main/resources文件夹中生成它们。 This will include them in the package (jar, war, ear, etc) to be deployed to Nexus. 这会将它们包括在要部署到Nexus的程序包(jar,war,Ear等)中。

By other hand, maybe it would be better to distribute the code that generate the scripts, not the scripts themselves. 另一方面,也许最好分发生成脚本的代码,而不是分发脚本本身。

This link may help you to understand Maven directory structure: 该链接可以帮助您了解Maven目录结构:

https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html

I thing this can be helpfull for you. 我想这可能对您有帮助。

Question: What's the recommended location for SQL (DDL) scripts? 问题: SQL(DDL)脚本的推荐位置是什么?

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

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