简体   繁体   中英

Maven Cannot Resolve Local Dependency

I have a maven project with an in-project repository with an external jar file. I used the install command to install the jar file into the in-porject repository and when I checked in the repository the jar file was installed i also added the dependency configuration in the pom file. But when I run the mvn compile file. I get the error that mvn cannot resolve the dependency

this is the Pom snippet:

        <repository>
    <id>repo</id>
    <releases>
        <enabled>true</enabled>
        <checksumPolicy>ignore</checksumPolicy>
    </releases>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
    <url>file://${project.basedir}/repo</url>
</repository>

this is the dependency in POM

<dependency>
      <groupId>Com.RubineEngine.GesturePoints</groupId>
      <artifactId>Com-RubineEngine-GesturePoints</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency> 

this is the error message :

[INFO] Final Memory: 6M/309M

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project com-boundingbox-box: Could not resolve
 dependencies for project com.boundingbox.box:com-boundingbox-box:jar:1.0-SNAPSH
OT: Could not find artifact Com.RubineEngine.GesturePoints:Com-RubineEngine-Gest
urePoints:jar:1.0-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException  

Does anybody have any suggestion about this error.

this is the error message after using the U and X switches

[DEBUG] =======================================================================
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for file://C:\U
sers\FAISAL\Desktop\disaster\com-initialtheta-theta/repo
Downloading: file://C:\Users\FAISAL\Desktop\disaster\com-initialtheta-theta/repo
/Com/RubineEngine/GesturePoints/Com-RubineEngine-GesturePoints/1.0-SNAPSHOT/mave
n-metadata.xml
[DEBUG] Writing resolution tracking file C:\Users\FAISAL\.m2\repository\Com\Rubi
neEngine\GesturePoints\Com-RubineEngine-GesturePoints\1.0-SNAPSHOT\resolver-stat
us.properties
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://repo
.typesafe.com/typesafe/releases/
Downloading: http://repo.typesafe.com/typesafe/releases/Com/RubineEngine/Gesture
Points/Com-RubineEngine-GesturePoints/1.0-SNAPSHOT/maven-metadata.xml
[DEBUG] Writing resolution tracking file C:\Users\FAISAL\.m2\repository\Com\Rubi
neEngine\GesturePoints\Com-RubineEngine-GesturePoints\1.0-SNAPSHOT\resolver-stat
us.properties
[DEBUG] Could not find metadata Com.RubineEngine.GesturePoints:Com-RubineEngine-
GesturePoints:1.0-SNAPSHOT/maven-metadata.xml in typesafe (http://repo.typesafe.
com/typesafe/releases/)
[DEBUG] Could not find metadata Com.RubineEngine.GesturePoints:Com-RubineEngine-
GesturePoints:1.0-SNAPSHOT/maven-metadata.xml in lib (file://C:\Users\FAISAL\Des
ktop\disaster\com-initialtheta-theta/repo)
[DEBUG] Skipped remote update check for Com.RubineEngine.GesturePoints:Com-Rubin
eEngine-GesturePoints:1.0-SNAPSHOT/maven-metadata.xml, already updated during th
is session.
[DEBUG] Failure to find Com.RubineEngine.GesturePoints:Com-RubineEngine-GestureP
oints:1.0-SNAPSHOT/maven-metadata.xml in http://repo.typesafe.com/typesafe/relea
ses/ was cached in the local repository, resolution will not be reattempted unti
l the update interval of typesafe has elapsed or updates are forced
[DEBUG] Skipped remote update check for Com.RubineEngine.GesturePoints:Com-Rubin
eEngine-GesturePoints:1.0-SNAPSHOT/maven-metadata.xml, already updated during th
is session.
[DEBUG] Failure to find Com.RubineEngine.GesturePoints:Com-RubineEngine-GestureP
oints:1.0-SNAPSHOT/maven-metadata.xml in file://C:\Users\FAISAL\Desktop\disaster
\com-initialtheta-theta/repo was cached in the local repository, resolution will
 not be reattempted until the update interval of lib has elapsed or updates are
forced

Looks like the system is getting confuse between two repositories.

  1. Check, if the groupId/artifactId are set correctly in the pom file of the libs in your project's repository (ie ${project.baseDir}\\repo\\Com....\\1.0-SNAPSHOT\\Com-RubineEngine-GesturePoints.pom)
  2. To get rid of "resolution will not be reattempted until the update interval of lib has elapsed or updates are forced" error you need to delete the folders from your local repository (usually ~/.m2), ie ~/.m2/Com/RubineEngine.

Try changing snapshots enabled to true.

<snapshots>
        <enabled>true</enabled>
</snapshots>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM