IT story

Intellij 아이디어는 Maven에서 아무것도 해결할 수 없습니다.

hot-time 2020. 7. 18. 10:01
반응형

Intellij 아이디어는 Maven에서 아무것도 해결할 수 없습니다.


나는 Intellij Idea를 처음 사용합니다. 방금 프로젝트를 가져 pom.xml오지만 아이디어 는 maven 의존성에서 아무것도 해결하지 못했습니다.

pom.xml코드로 가져올 때 오류가 발생하면 종속성에 정의 된 모든 것cannot resolve symbol xxxxx

하지만 mvn install난에 종속성을 가져보십시오 작동 Project Settings/Libraries.jar다음 작품 파일,하지만 IDE의 해결 라이브러리에 정의 된 수 pom.xml? 나는 매번 그렇게하고 싶지 않습니다.

추가 정보 :

IDEA 버전 : 12.0.3, OS : windows 7, 다시 가져 오기가 작동하지 않음, maven 버전 : 3.0.4, maven 종속성이 Exernal Libraries에 없습니다.

idea.log에는 예외가 없습니다 ...


IntelliJ 12.1.4 Settings --> Maven --> Importing에서 다음을 선택하고 다음을 선택했는지 확인했습니다.

  1. Maven 프로젝트를 자동으로 가져 오기
  2. 어 그리 게이터 프로젝트를위한 IDEA 모듈 생성
  3. 소스 유지 ...
  4. 빌드 디렉토리 제외 ...
  5. Maven 출력 사용 ...
  6. 생성 된 souces 폴더 : "자동 감지"
  7. 단계 ... : "프로세스 자원"
  8. 자동 다운로드 : "소스"및 "문서"
  9. Maven3을 사용하여 프로젝트 가져 오기
    • 수입업자를위한 VM 옵션 : -Xmx512m

이로 인해 해결되지 않은 import 문이 많고 모든 것이 해결되었습니다. 여기서 핵심은 Maven3을 사용하여 프로젝트를 가져 오는 것이라고 생각합니다.


이 문제가 발생했습니다. 아이디어는 maven을 사용하여 모든 종속 jar 패키지를 다운로드 할 수 없습니다. 다음 작업을 시도했습니다.

 mvn -U idea:idea

그런 다음 모든 종속 jar 패키지가 maven 저장소에서 다운로드됩니다.


프로젝트에서 기본 및 테스트 폴더를 모듈로 가져 오기 때문에이 오류가 발생했습니다. 프로젝트-> F4를 누르십시오-> 모듈 설정에서 기본 및 테스트 폴더를 제거하고 프로젝트를 다시 만드십시오. 문제가 해결됩니다.


IntelliJ 14의 번들 Maven 3 인스턴스를 사용할 때이 문제가 발생했습니다.

다음을 통해 자체 로컬 Maven 인스턴스를 사용하도록 전환했습니다.

Settings -> Build, Execution, Deployment -> Build Tools -> Maven -> Maven Home Directory

그런 다음 로컬로 설치된 인스턴스의 경로를 추가했습니다.여기에 이미지 설명을 입력하십시오

이것은 의존성이 마술처럼 나타납니다.

여기에 이미지 설명을 입력하십시오


몇 가지 옵션을 시도했지만 마침내이 문제가 해결되었습니다. 나는 프로젝트를 다시 가져올 인 IntelliJ에서 다음 단계를 수행하여 :

  1. 파일-> 새로 만들기-> 기존 리포지토리의 프로젝트
  2. '가져올 파일 또는 디렉토리 선택'에서 프로젝트를 선택하십시오.

  3. 다음 화면에서 '외부 모델에서 프로젝트 가져 오기'를 선택하고 'Maven.

  4. 다음 단계에서 ' Maven 프로젝트를 자동으로 가져 오기 '확인란을 클릭하십시오 (문제가 해결되었습니다).
  5. 필요한 경우 프로파일을 선택하여 마무리

나를 위해 maven 프로젝트를 다시 가져와도 기존 프로젝트의 문제가 해결되지 않았습니다.


프로젝트가 올바르게 설정되지 않아서이 오류가 발생했습니다. 메인 폴더와 테스트 폴더를 모듈로 가져 왔습니다. 2 개의 모듈을 삭제했지만 소스 및 테스트 폴더로 유지하면 코드가 올바르게 컴파일되기 시작했습니다.


나에게 설정> 메이븐> 가져 오기에서 "자동으로 메이븐 프로젝트 가져 오기"상자를 체크 해야하는 문제


IntelliJ 업데이트 후 동일한 문제가 발생했습니다. 내 수정 : 프로젝트를 마우스 오른쪽 버튼으로 클릭 한 다음 maven-> 다시 가져 오기.


저자와 똑같은 문제가있었습니다!

To solve my issue I had to add Maven Integration Plugin: File | Settings | Plugins

Like this:

메이븐 통합 플러그인

After that Intellij downloaded all the dependencies from pom.xml file.

Now if I want to create a project based on maven model, I just choose Open on the first Intellij window and choose the pom.xml file:

여기에 이미지 설명을 입력하십시오


If you imported your maven project in IntelliJ and there are errors because of maven imports not getting resolved, it maybe because of the custom maven settings.xml you may be using. I tried overriding it in the Intellij default maven settings but it did not help. Finally I had to keep it in ~/.m2/settings.xml and then IntelliJ finally honored it.


I had empty settings.xml file in Users/.../.m2/settings.xml. When i added

<settings xmlns="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.0
                      https://maven.apache.org/xsd/settings-1.0.0.xsd">

</settings>

all dependicies were loaded


  1. close intelliJ
  2. open the same project
  3. when the project loads, at the lower right u can see a pop up saying "non managed pom.xml file found", if u click on it a new pop up will come, saying add maven project, click on it, and done.

In Settings -> Maven -> Repositories only some repositories configured in my settings displayed.

Workaround

It is probably a bug (Idea 13.1.5 Ultimate). It helped me to switch the mirrors. The one that was not showing up to the top.


With intelliJ 16.1.4 I had the same issue. You should have a look at the Event Log, because it told me "Non-managed pom.xml file found:..." I then clicked on it and the problem was solved.


In my case,i expanded the maven projects panel on the right side, clicked + and added the project. Then it worked.


3 Simple Steps: IntelliJ 14:

  1. File>settings>Build,execution,deployment>Build tools

  2. Select Maven

  3. Maven home directory: C:/Program Files/apache-maven-3.3.3 (your equivalent location)


Keep in mind that IntelliJ adds your local Maven installation's classes to its own classpath, so keep it up to date.

In my case IntelliJ tried to call method org.eclipse.aether.util.ConfigUtils.getFloat(). This caused a java.lang.NoSuchMethodError, because my years old Maven version didn't contain this method yet. Due to the exception IntelliJ stopped resolving dependencies.

After updating Maven, you have to change the "Maven home directory" setting in "Build, Execution, Deployment" -> "Maven". After that you must restart IntelliJ, because the classpath of IntelliJ's JVM won't change while running.

It took me some time to solve this problem, as I didn't expect IntelliJ to use the classes of my local Maven installation. I thought it uses it's own bundled JARs. So hopefully this information is helpful for others.


<option name="workOffline" value="true" /> in workspace.xml is not your friend. Advise to check this before deleting your .idea (which has a lot of useful settings you probably don't want to lose)

It's a maven workspace.xml setting


It seems to me that solutions to this problem is plenty and all look a bit like magic. For me, invalidation of caches, re-importing or anything else already mentioned was not working. The only thing that helped was (without re-import) go to Maven settings, uncheck automatic importing and re-check it back.

여기에 이미지 설명을 입력하십시오


there's an issue with the bundled Maven version. as someone previously suggested I switched to my own Maven installation and dependencies magically worked (IntelliJ 2018.3)


I have just had this issue when adding <dependency>...</dependency> elements to a <profile>. I just found that if I add (insert) the unresolved dependency elements to the <dependencies> element, the dependencies are downloaded from the maven repository; I can then remove the dependency element from the dependencies element.


Using default maven (which comes with IntelliJ) also could create this problem. So configure the maven which you have installed.

This can be done from: File -> Settings -> Build, Execution, Deployment -> Maven

Update following settings according to your maven installation:

  1. Maven home directory =
  2. User settings file =
  3. Local repository =

좋아, 며칠 동안이 문제에 직면했다. POI 라이브러리와 Simple JSON 라이브러리를 가져 오려고 시도했지만 제안 된 모든 답변과 솔루션을 시도했지만 아무것도 작동하지 않았습니다. 결국 내 경우의 해결책은 매우 간단했습니다.

POM 파일에 종속성을 넣은 후 module-info.java 파일에 다음을 추가해야했습니다.

 requires poi.ooxml;
 requires poi;
 requires json.simple;

그래서 내 프로젝트가 모듈의 패키지로되어 있기 때문에 가져온 라이브러리가 사용될 것임을 시스템에 알리기 위해이 작업을 수행해야한다고 생각합니다. 그렇게 간단하게 모듈 이름을 module-info.java 파일에 넣은 후 라이브러리 이름을 넣으십시오.

그것이 당신을 위해 작동하기를 바랍니다

참고 URL : https://stackoverflow.com/questions/15727356/intellij-idea-cannot-resolve-anything-in-maven

반응형