Multimodule project

I have next problem:
i have 3 modules: app, main, physics;

app depends on main and physics.
physics depend on main

So i add main into app and physics.

As a result: after compiling i've got error about some classes, that was alredy added.

How i should add this modules correctly ?

8 comments
Comment actions Permalink

Hello Dmitry,

What do you mean by "add main into app and physics"? You need to add module
dependencies between modules.

I have next problem:
i have 3 modules: app, main, physics;
app depends on main and physics.
physics depend on main
So i add main into app and physics.

As a result: after compiling i've got error about some classes, that
was alredy added.

How i should add this modules correctly ?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

it mean that i add main as dependency in app and physics.  That is why i can't compile project.

How should i add module dependencies between modules ?

0
Comment actions Permalink

Hello Dmitry,

How is your project structured? Normally in a multimodule project each class
is compiled only once.

it mean that i add main as dependency in app and physics.  That is why
i can't compile project.

How should i add module dependencies between modules ?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

one more time:
i have app module which is depended on main module;
Also app module depende on physics module;
In this time physics module depended on app module;

So i do next:
app -> proj settings -> dependencies -> add main module

app -> proj settings -> dependencies -> add physics module

physics -> proj settings -> dependencies -> add main module

In this case i add main module twice. But i can't do otherwise, because i will get some error in physics module which will cause by unknown classes from main.

0
Comment actions Permalink

Hello Dmitry,

Please describe your project structure on disk (which files are located where).
Also please provide the exact error message that you get.

one more time:
i have app module which is depended on main module;
Also app module depende on physics module;
In this time physics module depended on app module;
So i do next:
app -> proj settings -> dependencies -> add main module
app -> proj settings -> dependencies -> add physics module

physics -> proj settings -> dependencies -> add main module

In this case i add main module twice. But i can't do otherwise,
because i will get some error in physics module which will cause by
unknown classes from main.


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

project structure:


/--folder
|
|----- /  folder
|               |
|               |----/ main module
|               |
|               |----/ physics module
|
|-----/ app module

Error:
classes was alredy added(something like that)

0
Comment actions Permalink

Hi Dmitry,

Could you provide minimal but comlpete standalone project that illustrates the problem?

The thing is that the structure you described is perfectly valid and doesn't show any error at my local environment.

Also provide information about your OS, target IJ and JDK versions.

Denis

0
Comment actions Permalink

i just create test project with the same structure and it works!

then i go to my main project and it work too)

so strange. i will test this again and if any - i will say you

0

Please sign in to leave a comment.