Spring boot 測試 org.springframework.test 無法導入問題

今天碰到一個如果把spring boot 包中 test 目錄 remove from build path 在添加進去後,

SpringRunner 和一些測試的類無法導入了

解決方法:

打開文件目錄 在 .classpath 文件中添加這個。

<classpathentry kind="src" output="target/test-classes" path="src/test/java">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
            <attribute name="test" value="true"/>
        </attributes>
    </classpathentry>

 

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