programing tip

Maven을 사용하여 릴리스 종속성을 강제로 다시 다운로드

itbloger 2020. 7. 19. 10:42
반응형

Maven을 사용하여 릴리스 종속성을 강제로 다시 다운로드


X가 의존하는 프로젝트를 진행하고 있습니다. X는 Y에 의존합니다.

프로젝트의 폼폼에 Y를 명시 적으로 포함 시켰습니다. 그러나 그것은 사용되지 않고 물건을 더 깨끗하게하기 위해 대신 X의 pom에 종속성으로 추가했습니다. X는 릴리스 종속성으로 표시됩니다.

문제는 프로젝트의 pom에서 Y를 제거하고 X의 pom에 추가 한 후에 프로젝트가 선택하지 않는다는 것입니다 mvn -U clean package. -U 업데이트 스냅 샷은 알고 있지만 릴리스는 아닙니다.

따라서 ~ / .m2 / repository 디렉토리를 삭제하지 않고 어떻게 X의 pom을 다시 다운로드 할 수 있습니까? 또한 달리기를 시도했지만 작동 dependency:purge-local-repository하지 않았습니다.


Maven을 다시 다운로드하여 종속성을 만들 수는 없지만 대신 사용할 수있는 것은 잘못 사용하여 다운로드 한 종속성을 제거하는 것입니다 mvn dependency:purge-local-repository

참조 : http://maven.apache.org/plugins/maven-dependency-plugin/purge-local-repository-mojo.html


방금 ~ / .m2 / repository를 삭제했으며 다시 다운로드해야했습니다.)


다음 명령이 도움이 될 것입니다!


mvn -U clean install

Ali Tokmen의 답변에 감사드립니다. 다음 명령을 사용하여 특정 로컬 종속성을 강제로 삭제했습니다.

mvn dependency:purge-local-repository -DmanualInclude=com.skyfish:utils

이를 통해 utils.m2 / repository에서 제거 되고 utils실행할 때 항상 JAR 종속성을 다시 다운로드합니다 mvn clean install.


프로젝트를 마우스 오른쪽 버튼으로 클릭-> Maven-> 프로젝트 업데이트하고 스크린 샷과 같이 확인란을 선택하십시오. 그것은뿐만 아니라 릴리스를 업데이트합니다 :)

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


mvn clean install -U

-U는 종속성의 강제 업데이트를 의미합니다.

정리 또는 -U없이 단일 종속성을 업데이트하려면 로컬 리포지토리에서 해당 종속성을 제거한 다음 빌드하면됩니다.


When you added it to X, you should have incremented X's version number i.e X-1.2
Then X-1.2 should have been installed/deployed and you should have changed your projects dependency on X to be dependent on the new version X-1.2


If you really want to force-download all dependencies, you can try to re-initialise the entire maven repository. Like in this article already described, you could use:

mvn -Dmaven.repo.local=$HOME/.my/other/repository clean install

Just delete ~/.m2/repository...../actual_path where the invalid LOC is coming as it forces to re-download the deleted jar files. Dont delete the whole repository folder instead delete the specific folder from where the error is coming.


If you know the group id of X, you can use this command to redownload all of X and it's dependencies

mvn clean dependency:purge-local-repository -DresolutionFuzziness=org.id.of.x

It does the same thing as the other answers that propose using dependency:purge-local-repository, but it only deletes and redownloads everything related to X.


Most answers provided above would solve the problem.

But if you use IntelliJ and want it to just fix it for you automatically, go to Maven Settings.

Build,Execution, Deployment -> Build Tools -> Maven

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

Disable Work Offline

Enable Always update snapshots (Switch when required)


Go to build path... delete existing maven library u added... click add library ... click maven managed dependencies... then click maven project settings... check resolve maven dependencies check box..it'll download all maven dependencies

참고URL : https://stackoverflow.com/questions/7959499/force-re-download-of-release-dependency-using-maven

반응형