2021년 5월 4일 화요일

maven resource 파일 지정.

 legacy 프로젝트를 maven으로 바꾸면서 properties 파일이나 mybatis xml 파일을 찾지 못하는 현상이 있었다.


Caused by: java.io.FileNotFoundException: class path resource [applicationResources.properties] cannot be opened because it does not exist


기존 프로젝트는 resourse 디렉토리가 따로 있는 게 아니라, 여기 저기 중구난방으로 되어 있다.

maven에서 아래의 설정을 추가하면 된다.

        <resources>
            <resource>
                <directory>src</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
            </resource>
        </resources>