0
main-project/
    module1/
    commonmodule2/
    module3/
    localRepo

Above is my project structure. In my localRepo folder I have my unmanaged dependency which I installed via this command:

mvn deploy:deploy-file -Durl=file:///C:/Users/IdeaProjects/forceCI/localRepo/ -Dfile=force-tooling-api.jar -DgroupId=com.toolingapi -DartifactId=toolingapi -Dpackaging=jar -Dversion=1.0

And using that in my parent pom as below.

<repositories>
    <repository>
        <id>project.local</id>
        <name>project</name>
        <url>file:${project.basedir}/localRepo</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.toolingapi</groupId>
    <artifactId>toolingapi</artifactId>
    <version>1.0</version>
</dependency>

But when I try to use the same localRepo in my commonmodule2 like below, it is not able to resolve it.

<repositories>
    <!--other repositories if any-->
    <repository>
        <id>project.local</id>
        <name>project</name>
        <url>file:${project.parent.baseDir}/localRepo</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.toolingapi</groupId>
    <artifactId>toolingapi</artifactId>
    <scope>provided</scope>
</dependency>

And its thrwong below issue when running clean install on root pom.

[INFO] forceCI ............................................ SUCCESS [  0.610 s]
[INFO] commons ............................................ FAILURE [  0.452 s]
[INFO] webworker .......................................... SKIPPED
[INFO] backgroundworker ................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.642 s
[INFO] Finished at: 2020-05-01T21:00:14+05:30
[INFO] Final Memory: 19M/307M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project commons: Could not resolve dependencies for project com.forceCI:commons:jar:0.0.1-SNAPSHOT: Failure to find com.toolingapi:toolingapi:jar:1.0 in file:${project.parent.baseDir}/localRepo was cached in the local repository, resolution will not be reattempted until the update interval of project.local has elapsed or updates are forced -> [Help 1]

enter image description here

enter image description here

Nagendra Singh
  • 577
  • 1
  • 7
  • 24
  • This should work. It is probably just a typo in artifactId, groupId or something similar. – J Fabian Meier May 01 '20 at 15:55
  • Yes, also the artifact id and the group id I have given above is like random, because I only had jar file. That shouldn't create issue? Right? – Nagendra Singh May 01 '20 at 16:31
  • The names themselves don't matter. I just suspect that you have a typo somewhere in the dependency or in the `deploy:deploy-file` command because otherwise everything looks all right. – J Fabian Meier May 01 '20 at 16:38
  • Oh, I just found out that clean install is not creating jar in my local maven repository, I just updated my question with an image. I think that is why it might be failing. Any idea, why is it now adding the jar, I also have my jar and all required pom in my localrepo folder. – Nagendra Singh May 01 '20 at 17:49

0 Answers0