在编码过程中,不小心出现了以下情况,com.maven.test包显示异常:
【问题原因】是由于buildpath中将这个包中的文件给排除了导致的。
【解决方案】需选中项目右键-Properties-Java Build Path-Source,查看对应这个包的Included、Excluded的筛选条件。进行对应的修改即可。若在Excluded中含有java的排除条件,则把该排除项删除掉。也可能是Excluded为None,但Included中未包含,则在Included中添加选中条件(**/*.java)即可。
另外一种可能,是在pom.xml中有对应的include活excluded进行了筛选,如下,需根据实际情况进行修改:
<build> <resources> <resource> <directory>src/test/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> <include>**/*.dic</include> </includes> <filtering>true</filtering> </resource> <resource> <directory>src/test/java</directory> <includes> <include>**/*.java</include> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> </resources> </build>