idea中的Maven导包失败问题如何解决(idea,maven,开发技术)

时间:2024-04-29 14:10:13 作者 : 石家庄SEO 分类 : 开发技术
  • TAG :

idea中的Maven导包失败问题解决总结

1.先确定idea和Maven 的配置文件settings 没有问题
找到我们本地的maven仓库,默认的maven仓库路径是在\C:\Users\用户名.m2下
有两个文件夹,repositotry是放具体jar包的,根据报错包的名,找对应文件夹就能找到对应jar包的位置

idea中的Maven导包失败问题如何解决

wrapper 是放maven 安装文件的,在所有安装文件中找到conf 文件下的settings.xml 文件,确保文件正确,比如有阿里云镜像源

idea中的Maven导包失败问题如何解决

idea中的Maven导包失败问题如何解决

将settings文件加入阿里云镜像源,对应的jdk版本 等
正确的setings.xml,可直接复制内容替换掉原来的文件

<?xmlversion="1.0"encoding="UTF-8"?><!--LicensedtotheApacheSoftwareFoundation(ASF)underoneormorecontributorlicenseagreements.SeetheNOTICEfiledistributedwiththisworkforadditionalinformationregardingcopyrightownership.TheASFlicensesthisfiletoyouundertheApacheLicense,Version2.0(the"License");youmaynotusethisfileexceptincompliancewiththeLicense.YoumayobtainacopyoftheLicenseathttp://www.apache.org/licenses/LICENSE-2.0Unlessrequiredbyapplicablelaworagreedtoinwriting,softwaredistributedundertheLicenseisdistributedonan"ASIS"BASIS,WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.SeetheLicenseforthespecificlanguagegoverningpermissionsandlimitationsundertheLicense.--><!--|ThisistheconfigurationfileforMaven.Itcanbespecifiedattwolevels:||1.UserLevel.Thissettings.xmlfileprovidesconfigurationforasingleuser,|andisnormallyprovidedin${user.home}/.m2/settings.xml.||NOTE:ThislocationcanbeoverriddenwiththeCLIoption:||-s/path/to/user/settings.xml||2.GlobalLevel.Thissettings.xmlfileprovidesconfigurationforallMaven|usersonamachine(assumingthey'reallusingthesameMaven|installation).It'snormallyprovidedin|${maven.conf}/settings.xml.||NOTE:ThislocationcanbeoverriddenwiththeCLIoption:||-gs/path/to/global/settings.xml||Thesectionsinthissamplefileareintendedtogiveyouarunningstartat|gettingthemostoutofyourMaveninstallation.Whereappropriate,thedefault|values(valuesusedwhenthesettingisnotspecified)areprovided.||--><settingsxmlns="http://maven.apache.org/SETTINGS/1.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0http://maven.apache.org/xsd/settings-1.0.0.xsd"><!--localRepository|Thepathtothelocalrepositorymavenwillusetostoreartifacts.||Default:${user.home}/.m2/repository<localRepository>/path/to/local/repo</localRepository>--> <localRepository>D:\repository</localRepository><!--interactiveMode|Thiswilldeterminewhethermavenpromptsyouwhenitneedsinput.Ifsettofalse,|mavenwilluseasensibledefaultvalue,perhapsbasedonsomeothersetting,for|theparameterinquestion.||Default:true<interactiveMode>true</interactiveMode>--><!--offline|Determineswhethermavenshouldattempttoconnecttothenetworkwhenexecutingabuild.|Thiswillhaveaneffectonartifactdownloads,artifactdeployment,andothers.||Default:false<offline>false</offline>--><!--pluginGroups|Thisisalistofadditionalgroupidentifiersthatwillbesearchedwhenresolvingpluginsbytheirprefix,i.e.|wheninvokingacommandlinelike"mvnprefix:goal".Mavenwillautomaticallyaddthegroupidentifiers|"org.apache.maven.plugins"and"org.codehaus.mojo"ifthesearenotalreadycontainedinthelist.|--><pluginGroups><!--pluginGroup|Specifiesafurthergroupidentifiertouseforpluginlookup.<pluginGroup>com.your.plugins</pluginGroup>--></pluginGroups><!--proxies|Thisisalistofproxieswhichcanbeusedonthismachinetoconnecttothenetwork.|Unlessotherwisespecified(bysystempropertyorcommand-lineswitch),thefirstproxy|specificationinthislistmarkedasactivewillbeused.|--><proxies><!--proxy|Specificationforoneproxy,tobeusedinconnectingtothenetwork.|<proxy><id>optional</id><active>true</active><protocol>http</protocol><username>proxyuser</username><password>proxypass</password><host>proxy.host.net</host><port>80</port><nonProxyHosts>local.net|some.host.com</nonProxyHosts></proxy>--></proxies><!--servers|Thisisalistofauthenticationprofiles,keyedbytheserver-idusedwithinthesystem.|Authenticationprofilescanbeusedwhenevermavenmustmakeaconnectiontoaremoteserver.|--><servers><!--server|Specifiestheauthenticationinformationtousewhenconnectingtoaparticularserver,identifiedby|auniquenamewithinthesystem(referredtobythe'id'attributebelow).||NOTE:Youshouldeitherspecifyusername/passwordORprivateKey/passphrase,sincethesepairingsare|usedtogether.|<server><id>deploymentRepo</id><username>repouser</username><password>repopwd</password></server>--><!--Anothersample,usingkeystoauthenticate.<server><id>siteServer</id><privateKey>/path/to/private/key</privateKey><passphrase>optional;leaveemptyifnotused.</passphrase></server>--></servers><!--mirrors|Thisisalistofmirrorstobeusedindownloadingartifactsfromremoterepositories.||Itworkslikethis:aPOMmaydeclarearepositorytouseinresolvingcertainartifacts.|However,thisrepositorymayhaveproblemswithheavytrafficattimes,sopeoplehavemirrored|ittoseveralplaces.||Thatrepositorydefinitionwillhaveauniqueid,sowecancreateamirrorreferenceforthat|repository,tobeusedasanalternatedownloadsite.Themirrorsitewillbethepreferred|serverforthatrepository.|--><mirrors><!--mirror|Specifiesarepositorymirrorsitetouseinsteadofagivenrepository.Therepositorythat|thismirrorserveshasanIDthatmatchesthemirrorOfelementofthismirror.IDsareused|forinheritanceanddirectlookuppurposes,andmustbeuniqueacrossthesetofmirrors.|<mirror><id>mirrorId</id><mirrorOf>repositoryId</mirrorOf><name>HumanReadableNameforthisMirror.</name><url>http://my.repository.com/repo/path</url></mirror>--> <!--阿里云仓库--><mirror><id>alimaven</id><mirrorOf>central</mirrorOf><name>aliyunmaven</name><url>http://maven.aliyun.com/nexus/content/repositories/central/</url></mirror><!--中央仓库1--><mirror><id>repo1</id><mirrorOf>central</mirrorOf><name>HumanReadableNameforthisMirror.</name><url>http://repo1.maven.org/maven2/</url></mirror><!--中央仓库2--><mirror><id>repo2</id><mirrorOf>central</mirrorOf><name>HumanReadableNameforthisMirror.</name><url>http://repo2.maven.org/maven2/</url></mirror></mirrors><!--profiles|Thisisalistofprofileswhichcanbeactivatedinavarietyofways,andwhichcanmodify|thebuildprocess.Profilesprovidedinthesettings.xmlareintendedtoprovidelocalmachine-|specificpathsandrepositorylocationswhichallowthebuildtoworkinthelocalenvironment.||Forexample,ifyouhaveanintegrationtestingplugin-likecactus-thatneedstoknowwhere|yourTomcatinstanceisinstalled,youcanprovideavariableheresuchthatthevariableis|dereferencedduringthebuildprocesstoconfigurethecactusplugin.||Asnotedabove,profilescanbeactivatedinavarietyofways.Oneway-theactiveProfiles|sectionofthisdocument(settings.xml)-willbediscussedlater.Anotherwayessentially|reliesonthedetectionofasystemproperty,eithermatchingaparticularvaluefortheproperty,|ormerelytestingitsexistence.ProfilescanalsobeactivatedbyJDKversionprefix,wherea|valueof'1.4'mightactivateaprofilewhenthebuildisexecutedonaJDKversionof'1.4.2_07'.|Finally,thelistofactiveprofilescanbespecifieddirectlyfromthecommandline.||NOTE:Forprofilesdefinedinthesettings.xml,youarerestrictedtospecifyingonlyartifact|repositories,pluginrepositories,andfree-formpropertiestobeusedasconfiguration|variablesforpluginsinthePOM.||--><profiles><!--profile|Specifiesasetofintroductionstothebuildprocess,tobeactivatedusingoneormoreofthe|mechanismsdescribedabove.Forinheritancepurposes,andtoactivateprofilesvia<activatedProfiles/>|orthecommandline,profileshavetohaveanIDthatisunique.||Anencouragedbestpracticeforprofileidentificationistouseaconsistentnamingconvention|forprofiles,suchas'env-dev','env-test','env-production','user-jdcasey','user-brett',etc.|Thiswillmakeitmoreintuitivetounderstandwhatthesetofintroducedprofilesisattempting|toaccomplish,particularlywhenyouonlyhavealistofprofileid'sfordebug.||ThisprofileexampleusestheJDKversiontotriggeractivation,andprovidesaJDK-specificrepo.<profile><id>jdk-1.4</id><activation><jdk>1.4</jdk></activation><repositories><repository><id>jdk14</id><name>RepositoryforJDK1.4builds</name><url>http://www.myhost.com/maven/jdk14</url><layout>default</layout><snapshotPolicy>always</snapshotPolicy></repository></repositories></profile>--><!--|Hereisanotherprofile,activatedbythesystemproperty'target-env'withavalueof'dev',|whichprovidesaspecificpathtotheTomcatinstance.Tousethis,yourpluginconfiguration|mighthypotheticallylooklike:||...|<plugin>|<groupId>org.myco.myplugins</groupId>|<artifactId>myplugin</artifactId>||<configuration>|<tomcatLocation>${tomcatPath}</tomcatLocation>|</configuration>|</plugin>|...||NOTE:Ifyoujustwantedtoinjectthisconfigurationwheneversomeoneset'target-env'to|anything,youcouldjustleaveoffthe<value/>insidetheactivation-property.|<profile><id>env-dev</id><activation><property><name>target-env</name><value>dev</value></property></activation><properties><tomcatPath>/path/to/tomcat/instance</tomcatPath></properties></profile>--> <profile><id>JDK-1.8</id><activation><activeByDefault>true</activeByDefault><jdk>1.8</jdk></activation><properties><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target><maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion></properties></profile></profiles><!--activeProfiles|Listofprofilesthatareactiveforallbuilds.|<activeProfiles><activeProfile>alwaysActiveProfile</activeProfile><activeProfile>anotherAlwaysActiveProfile</activeProfile></activeProfiles>--></settings>

同样还有idea 安装目录下的maven文件加下的配置文件settings.xml

idea中的Maven导包失败问题如何解决

idea中的Maven导包失败问题如何解决

2. 解决settings.xml配置文件问题,就找到报错对应的jar包文件夹,将其中的删除 _remote.repositories 文件和以Lastupdated结尾的文件,
以Lastupdated结尾的文件必须删除, _remote.repositories 文件选择性删除,可把 _remote.repositories 文件中的 nexus= 改成 central=,还是有问题就删除掉 _remote.repositories 文件。
可以直接在repositotry文件夹中搜索以Lastupdated结尾的文件,然后全部删除

idea中的Maven导包失败问题如何解决

3. 在 Settings - Maven - Runner - VM Options 中添加 -DarchetypeCatalog=internal,优先从本地仓库读取,添加-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true,忽略证书检查

idea中的Maven导包失败问题如何解决

命令

-DarchetypeCatalog=internal-Dmaven.wagon.http.ssl.insecure=true-Dmaven.wagon.http.ssl.allowall=true

4.idea点击重新导包

idea中的Maven导包失败问题如何解决

 </div> <div class="zixun-tj-product adv-bottom"></div> </div> </div> <div class="prve-next-news">
本文:idea中的Maven导包失败问题如何解决的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:Vue3.x+Element Plus如何实现分页器组件下一篇:

6 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18