IT

[Spring boot / Gradle] Project and External Dependencies 실종

월공 2021. 12. 15. 11:34
728x90
300x250

개발환경 : Springboot , Gradle, JDK 1.8 , STS4

Gradle Project 는 build.gradle 이라는 파일에 dependencies 를 쭈욱 작성해서 필요한걸 가져온다

작성하고나서 프로젝트 우클릭하고 "Refresh Gradle Project" 만 실행시켜주면 , 정상이라면

Project and External Dependencies 에 쭉 쌓이는걸 볼 수있다.

 

난 또 오늘 새로운 에러를 겪는다. 환경설정에 왜이리 시간을 허비해야하는걸까? 난 자바가 싫다

 

build.gradle 파일 수정하고 새로고침을 초반엔 잘되다가 갑자기 어느 순간 몇번을 하는데도 얘가 반응이 없어서 이상하다 싶었는데 이상한 에러 발생하면서 갑자기 저 부분이 안보이기 시작했다.

#이런 에러도 나고
gradle 오류: 기본 클래스 을(를) 찾거나 로드할 수 없습니다.
#이런 에러도 나고
could not resolve all dependencies for configuration ':compileclasspath'.

저게 없으면 정상적으로 Gradle Project 가 잘 가동될리가 없다

 

찾아보니 .project 를 수정해주면된다 부터 해서, 이것저것 보긴봤는데 하나도 해결이 되지않았고

STS 프로그램 껏다 켜도 안되고, clean 해도 안되고, cashe 를 날려도 안되고 미칠노릇이었는데

 

마지막으로 혹시나 싶어서 STS 에서 해당 프로젝트 연결 끊고 (물론 다른 디렉토리에 백업은 해둠), 

깔끔하게 만든후 다시 workspace 안에 가져다 놓고 import 시킬때 "Existing Gradle Project" 로 다시 가져와서

Refresh Gradle Project 진행하니 좀 오래걸렸지만 다시 잘되었다

 

진짜 진심으로 존나 싫다

 

혹시 몰라서 지금 현재 잘되고있는 Gradle Project 의 .classpath 와 .project 를 기록해둔다.

나중에 도움이 될수도 있으니 (?)

 

# .classpath

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" output="bin/main" path="src/main/java">
		<attributes>
			<attribute name="gradle_scope" value="main"/>
			<attribute name="gradle_used_by_scope" value="main,test"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" output="bin/main" path="src/main/resources">
		<attributes>
			<attribute name="gradle_scope" value="main"/>
			<attribute name="gradle_used_by_scope" value="main,test"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" output="bin/test" path="src/test/java">
		<attributes>
			<attribute name="gradle_scope" value="test"/>
			<attribute name="gradle_used_by_scope" value="test"/>
			<attribute name="test" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
	<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
	<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer">
		<attributes>
			<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="output" path="bin/default"/>
</classpath>

 

# .project

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>프로젝트이름</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.wst.common.project.facet.core.builder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.wst.validation.validationbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.jdt.core.javanature</nature>
		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
		<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
	</natures>
	<filteredResources>
		<filter>
			<id>1637048526969</id>
			<name></name>
			<type>30</type>
			<matcher>
				<id>org.eclipse.core.resources.regexFilterMatcher</id>
				<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
			</matcher>
		</filter>
	</filteredResources>
</projectDescription>
728x90
300x250