dependency resolution - Maven fails to find local artifact
文章推薦指數: 80 %
This means that there's no local repository used when resolving dependencies (though your installed artifacts do still get put in the default location).
Home
Public
Questions
Tags
Users
Companies
Collectives
ExploreCollectives
Teams
StackOverflowforTeams
–Startcollaboratingandsharingorganizationalknowledge.
CreateafreeTeam
WhyTeams?
Teams
CreatefreeTeam
Collectives™onStackOverflow
Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost.
Learnmore
Teams
Q&Aforwork
Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch.
Learnmore
Mavenfailstofindlocalartifact
AskQuestion
Asked
9years,9monthsago
Modified
9monthsago
Viewed
216ktimes
132
26
Occasionallymavencomplainsthataparticulardependency,whichisbuiltandpackagedlocally,cannotbefoundinthelocalrepositorywhilebuildinganotherprojectthathasitasadependency.Wegetanerrorlike:
FailedtoexecutegoalonprojectX:CouldnotresolvedependenciesforprojectX:FailuretofindYin[archivarepository]wascachedinthelocalrepository,resolutionwillnotbereattempteduntiltheupdateintervalofinternalhaselapsedorupdatesareforced->
WhereXistheprojectbeingbuilt,andYisthesupposedlymissingartifact.Ifyoulookinthelocalrepository,theartifactisthere.Thisartifactisneverinstalledinourarchivarepository,sotheproblemispurelybasedinthelocalrepository.
Wehavetriedvariousprofilesinsettings.xml,andofcourse"mvn-U".Neitherdoanygood,norshouldtheybecausethisartifactnevergoesanyfurtherthanthelocalrepository.
Theonlytwothingsthatseemtoworkaretowaitaverylongtimeuntilmavensmartensup,ortocompletelydeletethelocalrepository.Presumablythewaitingoptionisrelatedtotheaforementionedupdateinterval.
Wehaveexperiencedthisproblemwithmaven3.0.2and3.0.3.WeareusingArchiva1.0.3(butagainthisshouldn'tbeafactor).Anyhelpwouldbegreatlyappreciated.
mavendependency-resolution
Share
Improvethisquestion
Follow
editedFeb3,2020at14:49
mzjn
45.8k1111goldbadges120120silverbadges232232bronzebadges
askedSep20,2012at16:44
user1686620user1686620
2,54144goldbadges1616silverbadges1717bronzebadges
7
1
IsMavenlogginganythingwhileorjustbeforethe"waiting?"I.e.isitattemptingtoconnecttoanunreachablerepository?Also,aretheproblematicartifacts"-SNAPSHOT"?
– noahlz
Sep20,2012at16:53
Mavendoesn'tloganythingotherthantheerrorImentionedabove.Andyesthisisasnapshotdependency.
– user1686620
Sep20,2012at17:02
1
Seestackoverflow.com/questions/1348603/…
– noahlz
Sep20,2012at17:05
1
Haveyouinstalledthebuildpackagebeforeyoutrytobuildthesecondproject?
– khmarbaise
Sep21,2012at7:15
3
Ilikehowtheerrormessageisarun-on,notagrammaticallycorrectsentence.Thisway,wedon'tknowforsureifitcannotfindYorifYwascachedlocally,orboth.Anyway,Ihaveasimilarproblem.Iwasabletoresolveitwiththe-Uoptionbecausemydependenciesareinmycompany'sinternalrepo.Whyaren'ttheartifactsyouneeddeployedtoyourcompany'sinternalrepository?
– jyoungdev
Feb18,2013at17:22
|
Show2morecomments
17Answers
17
Sortedby:
Resettodefault
Highestscore(default)
Datemodified(newestfirst)
Datecreated(oldestfirst)
103
ThelocalMavenrepotrackswhereartifactsoriginallycamefromusingafilenamed"_maven.repositories"intheartifactdirectory.Afterremovingit,thebuildworked.Thisanswerfixedtheproblemforme.
Share
Improvethisanswer
Follow
editedMay23,2017at11:55
CommunityBot
111silverbadge
answeredJan22,2014at12:52
jhansonjhanson
1,08411goldbadge88silverbadges66bronzebadges
8
36
Formeitwasafilenamed"_remote.repositories".Iremoveditanditworked!Thankforthetricks!
– perbellinio
Apr27,2015at13:02
2
Thxthefilenamed_remote.repositorieswasalsopresent.ithappenedtomewhenournexusstophavingnetworkconnectionsoitcantobtainthedependencies
– cabaji99
Feb2,2018at13:10
2
Theprovidedsolutiondoeswork.However,Iaminterestedinwhythisproblemoccurrsatall.Couldanybodyprovidemewithaquickexplanation?DoIhavetodosomethingdifferently?
– Janothan
Feb26,2019at13:44
Ifyouwanttobypassthisorigincheckonce(withoutdeletingthemetafiles),trypassingaether.enhancedLocalRepository.trackingFilename=some_dummy_file_nametothedependencyresolutionprocess;easiestwayistoadda-Dsystempropertytotheinvocationcommand.
– JanakaBandara
Apr22,2019at3:48
1
@JanothanIMOthelinkintheanswerprovidesaprettygoodexplanation:)
– JanakaBandara
Apr22,2019at3:50
|
Show3morecomments
53
Astheoptionsheredidn'tworkforme,I'msharinghowIsolvedit:
Myprojecthasaparentproject(withitsownpom.xml)thathasmanychildrenmodules,oneofwhich(A)hasadependencytoanotherchild(B).WhenItriedmvnpackageinA,itdidn'tworkbecauseBcouldnotberesolved.
Executingmvninstallintheparentdirectorydidthejob.Afterthat,IcoulddomvnpackageinsideofAandonlythenitcouldfindB.
Share
Improvethisanswer
Follow
editedJan14,2019at13:34
Sampath
1,02911goldbadge2020silverbadges3838bronzebadges
answeredJul13,2017at5:56
FlorianPfistererFlorianPfisterer
1,1451111silverbadges2121bronzebadges
2
3
THANKYOU!thiswasdrivingmecrazy.mvncleanpackagejboss-as:deploywasworkingwhenIexecutedonasingleline,butnotwhenIdidthemseparately.
– PMorganCA
Nov7,2017at20:10
Thanks,thissolutionsavedmefromwastingtime
– Skywarp
Jun2at15:23
Addacomment
|
24
Eveninofflinemode,mavenwillcheckremoterepositoriesifthereisa_remote.repositoriesmarkerforthedependency.Ifyouneedtooperateinofflinemode,youmayneedtodeletethesefiles.
Thesimpleshellcommandbelowdeletesthesemarkerfiles.Thisissafetodoifyouonlyuseofflinemodeforthemachine.IwouldNOTdothisonamachinethatneedstopullfilesdownfromtheweb.
Ihaveusedthisstrategyonabuildserverthatisdisconnectedfromtheweb.Wehavetotransfertherepositorytoit,deletethemarkerfilesandthenruninofflinemode.
OnLinux/Unixyoucandeletetheremoterepositorymarkerfilesthisway:
cd~/.m2
find.-name"_remote.repositories"-typef-delete
Share
Improvethisanswer
Follow
editedNov7,2018at20:00
DrB
27411goldbadge33silverbadges1414bronzebadges
answeredNov16,2017at19:51
JonJon
3,0122727silverbadges3535bronzebadges
3
1
Thissolutionworkedforme,foradependencyIcopiedoverfromanothercomputerwhichisnotavailableinacentralrepository.Thecommandthoughmissesafewcharacters.Hereisthefullcommand:find.-name"_remote.repositories"-type-f-delete
– HansDeragon
Aug11,2018at9:19
2
Or,insteadofdeleting,youshouldbeableto"misguide"Maventonotlookatthe_remote.repositoriesfilebypassing-Daether.enhancedLocalRepository.trackingFilename=some_dummy_file_nametotheprocess.(Didn'ttryonanactualMavenbuild,butworkswheninvokingMavenprogrammatically;sotheformershouldalsowork)
– JanakaBandara
Apr22,2019at3:53
1
Ididthisfindinganddeletingspecificdependencies(jars)notfoundbyMaven,sincetheywerelistedandmanageabletoto(<10).ThiswasduetoamisconfigpointingtoaremoteNexusnotcurrentlyavailable(asIunderstood..).Sonoactualneedtosweepallrepofordeletion.Anywaythissolutionsavedtheday.Itworkforme.
– Diego1974
May10,2019at12:33
Addacomment
|
12
Whenthishappenedtome,itwasbecauseI'dblindlycopiedmysettings.xmlfromatemplateanditstillhadtheblank
延伸文章資訊
- 1dependency resolution - Maven fails to find local artifact
This means that there's no local repository used when resolving dependencies (though your install...
- 2How to Fix Maven Artifacts Could not be Resolved Error ...
I executed below command to install it in my localhost maven repo and everything worked. ... Coul...
- 3Force Repository Update with Maven - Baeldung
Therefore, the download into our local repository is necessary to access all needed code at ... C...
- 4maven系列--Could not resolve dependencies问题的解决
mvn compile 编译问题 Could not resolve dependencies for project xxxxxx Failed to collect dependencies...
- 5Working with Maven dependencies not found in public ...
Use a corporate repository manager such as Nexus or Artifactory · Use a dependency with system sc...