简体   繁体   English

以编程方式将Maven工件安装到本地存储库

[英]Installing Maven artifacts to local repo programmatically

What I have is the need to use a Groovy script or Maven plugin to generate a jar before compile time and then install it to the local repository so it can be used in the compile process (ie the depend will be satisfied by the build process and not downloaded through any external repos). 我需要使用Groovy脚本或Maven插件在编译时生成jar然后将其安装到本地存储库,以便可以在编译过程中使用(即依赖将由构建过程满足,并且不通过任何外部回购下载)。 I have got as far as using a groovy script to create this jar before the compiling / dependency resolution begins. 在编译/依赖关系解析开始之前,我已经使用了一个groovy脚本来创建这个jar。

As the API documentation for working with Maven outside of creating a Mojo is very slim, I would like some pointers to getting this jar into the local repository. 由于在创建Mojo之外使用Maven的API文档很小,我想要一些指向将这个jar放到本地存储库中。

Thanks in advance, md_5. 在此先感谢,md_5。

EDIT: I would also like to have a way of knowing if the artifact is in the maven repo beforehand. 编辑:我也希望有一种方法可以预先知道神器是否在maven repo中。

我认为您需要使用maven-invoker-plugin ,它启动一个新的Maven实例,您可以使用本机Maven插件生成工件,构建它并安装到本地存储库中。

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

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