Intellij Maven依赖于本地代码 [英] Intellij maven dependency prefer local code

查看:196
本文介绍了Intellij Maven依赖于本地代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个项目中,我有一个android应用程序项目,该项目对其他项目具有pom依赖性 像这样的东西:

i'm working on a project in which i have an android application project which has pom dependencies on other projects something like this:

<dependencies>
        <dependency>
            <groupId>some.project/groupId>
            <artifactId>some.artifact<artifactId>
            <version>1.0.0</version>
            <type>apklib</type>
        </dependency>
</dependencies>

在开发过程中,我一直希望Intellij使用项目中我拥有的some.project库中的本地源代码.
问题是它将从服务器中拉出版本1.0.0并使用该版本.
我尝试使用LATEST作为版本,只要我的some.project库版本更新为服务器上的最新版本,此方法就可以正常工作.
因为我们有自动化的构建,当进行更改时,它将为some.project的版本增加版本.我将遇到一个场景,其中我的源代码为1.0.0,但服务器为1.0.1,而intellij将再次拉服务器apklib

while developing i always want Intellij to use the local source code from the some.project library i have in the project.
the problem is it will pull version 1.0.0 from the server and use that.
i tried using LATEST as version, this works fine as long as my some.project library version is updated to the latest version on the server.
since we have automated builds that will increment the version for some.project when changes are made i will have a scenario in which my source says 1.0.0 but the server has 1.0.1 and again intellij will pull the server apklib

任何建议如何实现这一目标?如果我可以使用dev概要文件以某种方式仅用于开发,而prod概要文件使用确切的版本号(应使用的版本号),那将是惊人的.

Any suggestions how to achieve this? if i could use a dev profile to somehow define this for development only and a prod profile to use exact version numbers (which it should) that will be amazing.

谢谢!

推荐答案

您可以在IntelliJ中添加模块依赖项: 在文件"->项目设置"->模块"上,单击模块->单击依赖关系"选项卡,然后单击绿色的"+"号,然后选择"3".模块依赖项...添加要在本地依赖的模块,然后单击蓝色箭头以使该模块位于Maven依赖项之上.

You can add a module dependency in IntelliJ: File->Project Settings->Modules click on the module -> click Dependencies tab and then click the green '+' sign and choose '3. Module dependency'.. add the module on which you want to depend locally and click the blue arrows to bring the module above the Maven dependencies.

这篇关于Intellij Maven依赖于本地代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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