英文:
Compiler error when the folder contains dot (.)
问题
我有一个项目结构如下:
src/main/java
com
company.project.utils
MyClass.java
当我尝试使用以下包时:
package com.company.project.utils;
我在Eclipse中遇到了一个错误,因为它期望结构如下:
src/main/java
com
company
project
utils
MyClass.java
问题是我不能更改这个结构,因为有很多类似这样的项目依赖于它。
如果我在Maven中编译这个项目,是没有问题的,而且我的同事在IntelliJ中也没有编译错误。
有没有办法告诉Eclipse,点号是文件夹名称的一部分,而不是一个新的文件夹?
英文:
I have a project structure like :
src/main/java
com
company.project.utils
MyClass.java
When I try to use the package :
package com.company.project.utils;
I got an error in Eclipse because it expects that the structure was :
src/main/java
com
company
project
utils
MyClass.java
The problem is that I cant change the structure because there are lots of projects like this and depending of that.
If i compile this project in maven it's ok , also my colleages don't have compiler errors in IntelliJ.
Is there a way to say Eclipse that the dots are part of name folder instead of a new folder ??
专注分享java语言的经验与见解,让所有开发者获益!
评论