0

im having some trouble with maven. i have a android project with a dependency on a module we wrote which i have source code for and is in my project . something like:

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

problem is, we have autmated release build who increment the snapshot version of that artifact, so the snapshot version on the nexus repo will change over time. IntelliJ then pulls the apklib from nexus instead of using the local source code, this is really hard to work with.

i've tried checking the "Resolve workspace artifacts" check box as described here: http://www.jetbrains.com/idea/webhelp/run-debug-configuration-maven.html#parameters but it still pulls from nexus.

Any suggestions on how to resolve this?

Thanks in advance, Tal

talarari
  • 539
  • 3
  • 7
  • 19
  • 1
    Are you using the maven release plugin? Can you explain what happens to your snapshot versions when you release? Is it a full maven release, promoting snapshots to release versions (e.g. 1.0.0-SNAPSHOT -> 1.1.0) and providing a new development version (e.g. 1.1.0 -> 1.2.0-SNAPSHOT)? And, does your process write the modified poms back to your source code repository? – Software Engineer Jul 01 '14 at 15:09
  • exactly as you described. the build performs a release turning 1.1.0-SNAPSHOT to 1.2.0-SNAPSHOT. and this is what causes the problem with my project dependency since the code i have still has an older snapshot version like 1.1.0-SNAPSHOT. i basically just want to use the source and thats it. – talarari Jul 01 '14 at 15:47
  • You must update from your code repository and reimport your maven project (which should probably be on automatic, otherwise hit the refresh icon in the maven window once the scm update is done). This will bring in the new poms (along with any changes to the source) and intellij will reindex on this basis. If you have a local dependency on the snapshot that wasn't included in the build you'll have to change that to reference the new version, and intellij should reference the source on the disk instead of looking in the repo. – Software Engineer Jul 01 '14 at 16:14
  • Yes, the problem is i do have a dependency that is not included in the build, and i would like to not need to change that manually every time the snapshot version advances... i wish i could somehow tell intellij, dont matter the snapshot versions just use the source code. maybe thats not possible – talarari Jul 01 '14 at 16:37
  • If you're depending on A, and other modules upon which you depend are depending on a different version of A, then maven /must/ pull down the version they depend on from nexus -- they cannot use the source from your version and they cannot use your local copy of the library. – Software Engineer Jul 01 '14 at 19:06
  • Possible duplicate of [Intellij maven dependency prefer local code](http://stackoverflow.com/questions/23523573/intellij-maven-dependency-prefer-local-code) – Esoteric Screen Name Feb 01 '16 at 20:31

0 Answers0