IDEA配置插件問題

1.倉庫無法導入jar包

每次從阿里遠程倉庫下載下來的插件都報如下錯誤(clean和install時候)
       could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.2.5.RELEASE from/to nexus-aliyun (https://maven.aliyun.com/nexus/content/groups/public): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

在Maven命令後加入參數“-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true

這樣設置可以跳過證書檢查,然後maven clean,compile,再install就可以解決這個問題了

PS:可以將maven->importing->import maven project automatically勾選上

左下角(或右側)不可以Maven ->點開項目目錄,右鍵項目的pom.xml文件,點擊<Add as Maven Project>

有時項目加載不全,如沒加載父工程,只有子工程。可以先隨便打開個工程,再在裏面file->open 

無法自動導包可以lifecycle裏面clean 再 compile

 

2.新導入項目,提示報 Cannot access org.springframework.context.ConfigurableApplicationContext的錯,

     百度一番,需刪除導入項目自動生成的xxx.iml ,然後刷新下右側maven tab即可,這裏記錄一下。

 

3.IDEA顯示“Cannot resolve symbol XXX”
      菜單 “File” -> “Invalidate Caches / Restart”→ “Invalidate and Restart”

4.maven版本不要太高,請和idea配合查看版本。2017版本idea對應2017以前發佈的maven

4.1 idea不顯示remote repository,可以卸載換個maven

4.2導入後1-2s內關注右下角,add as maven project 和自動添加依賴

4.4 無法加載類,查看右上角的project struct->modules,裏面不應該有main,應該是子項目和父項目,刪掉mian

4.5 查看jar包依賴。在右側的Maven點擊項目,再點上方show dependencies查看關係圖,然後ctrl+f查找自己想看的jar包

4.6 在pom中添加遠程倉庫

<repositories>
	<repository>
		<id>public</id>
		<name>aliyun nexus</name>
		<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
		<releases>
			<enabled>true</enabled>
		</releases>
	</repository>
</repositories>
<pluginRepositories>
	<pluginRepository>
		<id>public</id>
		<name>aliyun nexus</name>
		<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
		<releases>
			<enabled>true</enabled>
		</releases>
		<snapshots>
			<enabled>false</enabled>
		</snapshots>
	</pluginRepository>
</pluginRepositories>

5.啓動項目必須找到主類,然後run

6.iDEA pom.xml依賴了jar但是External Libraries包爲空。

  a 首先進入到.idea/misc.xm文件中,刪除set元素中的全部內容

  b 刪除之後單擊右鍵maven工程 點擊Reimport會自動加入模塊

 

 

 

ctrl+alt+t   補全 try catch,for,if else

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章