2016-11-29 48 views
0

在我的Java Spring应用程序,我用了一个data-set.sql文件来填充数据测试文件无法打开,因为它不存在

@RunWith(SpringJUnit4ClassRunner.class) 
@SpringApplicationConfiguration(classes = ConsultationWebApplication.class) 
@Sql(scripts="requests-dataset.sql") 
@DirtiesContext(classMode= ClassMode.AFTER_EACH_TEST_METHOD) 
@ActiveProfiles("test") 
public class StatisticsTest { 

//bla 
//bla 
//bla 
}' 

但是,当我把我的代码库中,特拉维斯持续集成 抱怨有:

org.springframework.jdbc.datasource.init.CannotReadScriptException: Cannot read SQL script from class path resource [ee/avok/consultation/service/requests-dataset.sql]; nested exception is java.io.FileNotFoundException: class path resource [ee/avok/consultation/service/requests-dataset.sql] cannot be opened because it does not exist 

的一点是,的测试运行,并通过在本地主机,但它失败的CI

似乎CI找不到该文件,但该文件位于测试包中。

回答

0

以我的经验,当您在Windows下开发并且CI服务器在Unix下工作时会发生此类错误。

我的猜测是,你已经在Windows中用大写字母在你的SQL文件路径中命名了一些文件夹。 Windows不关心大写或小写,并在任何情况下找到该文件。 Unix区分大写和小写,因此没有找到文件。

在SQL文件路径的某处搜索大写字符。

相关问题