Dealing with projects that have same packages and classes

I've created a project based off an existing eclipse project and the project contains several source directories with duplicate package class structures which obviously causes errors to showup in intellij.
What's the best way to deal with this in version 9?


What exactly do you mean by "duplicate  package class structures"?
Same packages names in different source folders aren't a problem.
Multiple classes with the same fully-qualified name are a problem regardless of your choice of IDE. Maybe some of those classes were excluded in ther Eclipse project setup?

-- Stephen


"Same packages names in different source folders aren't a problem."

It is exactly that, not sure why this would be a problem but it results in compilation errors.
The different src directories each are defined as content roots.


You really need to give more information: What IDEA version? What are the compile errors?
I just tried a very small example project and it works fine (see attachment).


Yeah I'm pretty sure I've done this before as well. Perhaps it is related to using the eclipse project, when I get to work I'll look into it further.


Nope, I have two src directories which are content roots, the package structure is identical in both and both have the same class for example and IntelliJ complains about a duplicate class and fails to compile.
Running the latest build of Maia. The compilation error is duplicate class.


>Multiple classes with the same fully-qualified name are a problem  regardless of your choice of IDE.

As much as I dislike Eclipse it had no problems with this scenario when the classes were in different eclipse projects.
When a similar scenario, with classes in different modules, is present in IntelliJ it becomes impossible to right click on JUnit tests and run them reliably.

Here rae a few that I have filed

1) (IDEA-48222) When right clicking on a Junit my module will be incorrect (IDEA-48222 this is marked as fixed in IJ 9 but is broken)
2) (IDEA-55908)  IJ will try and reuse an existing defined test to avoid creating a new  temporary test but it picks up the wrong test which causes another 40%  of my test failures.


Please sign in to leave a comment.