单个 pom.xml 中的多个 install:install-file [英] Multiple install:install-file in a single pom.xml

查看:31
本文介绍了单个 pom.xml 中的多个 install:install-file的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(请在回答之前至少阅读此内容:这是临时措施!不,我们不想设置本地存储库管理器并手动运行脚本)

(Please read at least this before answering: This is a temporary measure! No, we do not want to set up a local repository manager and manually run a script)

我们有一个带有一些依赖项的遗留项目,我们有一个包含源代码和 javadoc 的本地副本,并且已被证明在生产中运行良好,但在 Central 中无法提供相同的质量.我们想使用我们已经拥有的那些罐子.

We have a legacy project with a few dependencies which we have a local copy of including source and javadoc, and which has been proven to work well in production, but which is not available in the same quality in Central. We want to use those jars we already have.

我发现我可以手动运行一个适当复杂的 mvn install:install-file 命令来将工件注入到本地机器的存储库中,但我想让它像我们各种模块的正常 maven 构建的一部分.

I have found that I can manually run a suitably complex mvn install:install-file command to get the artifacts injected in the repository of the local machine, but I would like to have it work as part of the normal maven build of our various modules.

鉴于我有一个包含多个罐子的空白模块,每个罐子都需要用 install:install-file 插入 我应该如何在我的 pom.xml 中做到这一点才能完全一致使用正常的 Maven 构建?

Given I have an otherwise blank module containing multiple jars which each need to be inserted with an install:install-file how should I do this in my pom.xml to be fully conformant with the normal Maven build?

或者我可以只附加多个 jars 作为模块的输出,并以某种方式附加 javadoc 和源代码?

Or can I just attach multiple jars to be the output of the module and somehow attach javadoc and source too)?

(并且,请不要建议提交到中央或设置本地存储库管理器.这是一个临时解决方案,直到我们有机会升级到更新版本的依赖项)

(and, please, no suggestion about submitting to central or setting up a local repository manager. This is a temporary solution until we have an opportunity to upgrade to a newer version of the dependencies)

推荐答案

我想像这样的东西会起作用(这将在每个构建中安装它):

I would imagine something like this would work (this will install it on every build):

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <executions>
                <execution>
                    <id>inst_1</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <configuration>
                        <!-- config for file 1 -->
                    </configuration>
                </execution>
                <execution>
                    <id>inst_2</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <configuration>
                        <!-- config for file 2 -->
                    </configuration>
                </execution>
                <!-- execution file 3... -->
            </executions>
        </plugin>            
    </plugins>
</build>

这篇关于单个 pom.xml 中的多个 install:install-file的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆