Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij maven dependency prefer local code

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>

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

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.

Thanks!

like image 273
talarari Avatar asked May 07 '14 16:05

talarari


People also ask

How do I change the Maven home directory in IntelliJ?

From the main menu select File | Settings/Preferences | Build, Execution, Deployment |Build Tools | Maven. On the Maven settings page, in the Maven home directory field, specify the location of the Maven custom version installation.

How do I manually add dependencies in IntelliJ?

Press Alt+Insert to open the Generate context menu. From the context menu, select Add dependency. In the Dependencies tool window, in the search field, start typing the name of your dependency. In the list of results select the one you need and click Add.


1 Answers

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.

like image 115
dmossakowski Avatar answered Oct 04 '22 09:10

dmossakowski