简体   繁体   English

Maven插件,用于从scm提取内部依赖文件

[英]Maven plugin for extracting internal dependency files from scm

I have a Maven project (A) which depends on some library (B). 我有一个依赖于某些库(B)的Maven项目(A)。

Library uses Maven and has reachable project.scm.developerConnection URL. 库使用Maven并具有可访问的project.scm.developerConnection URL。 Additionally this library contains some SQL scripts (DDL) which is not included into final JAR. 另外,该库包含一些SQL脚本(DDL),这些脚本未包含在最终的JAR中。

Is there any way to obtain those SQL files (ie get library pom of version specified in project A, parse it, extract developerConnection url and checkout from scm using provided URL) using Maven? 有没有办法使用Maven获取那些SQL文件(即,获取项目A中指定版本的库pom,对其进行解析,提取developerConnection URL并使用提供的URL从scm检出)?

I need them: 我需要他们:

  • To run integration tests of project which uses some features of library. 运行使用库的某些功能的项目集成测试。
  • To build a distribution package for project (using maven-assembly-plugin). 为项目构建分发包(使用maven-assembly-plugin)。

Now suppose that this library is also written by me, then what is a best way (maven way?=)) to distribute SQL files? 现在假设该库也是由我编写的,那么分发SQL文件的最佳方法(行家方式?=)是什么?

Include them into JAR? 将它们包含在JAR中?

Note that in this case SQL files will be in JAR exclusively to make Maven build. 请注意,在这种情况下,SQL文件将仅在JAR中进行Maven构建。

If you need these resources to be available for packaging, put them in aa separate artifact that you depend on. 如果您需要这些资源可用于打包,请将它们放在您依赖的单独工件中。

If you just need these resources to be available to your tests, put them in an artifact that you depend on with scope test . 如果您只需要这些资源可用于测试,请将它们放在范围test依赖的工件中。 This may be a test-jar or a separate artifact altogether (if you prefer not to loose transitive dependencies of your test JAR ). 这可能是一个test-jar或一个单独的工件(如果您不希望不松动测试JAR的可传递依赖项 )。

If you just need these resources to be available to Maven, eg for the SQL Maven Plugin , put them in a separate artifact and have the plugin in your maven project ("A") depend on it. 如果您只需要这些资源可供Maven使用(例如,对于SQL Maven插件) ,请将它们放在单独的工件中,并使该插件在您的maven项目(“ A”)中依赖于此。

If you know that these resources are of no reasonable use to the production environment, just don't put them in the final JAR of the library, since that is what goes to production. 如果你知道,这些资源没有合理利用到生产环境中,只是把他们在图书馆的最终JAR,因为这是去生产。

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

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