Module Root Question

LEt's say I have a project:

/vobs/psip

In it I have a number of directories:

/vobs/psip/src
/vobs/psip/bin

I've created a chunk of common code that I wish to share among different variations of the base code: For example:

/vobs/psip/src/proj1
/vobs/psip/src/proj2
/vobs/psip/src/common

When I compile, I compile to separate bin directories:

/vobs/psip/bin/proj1
/vobs/psip/bin/proj2
/vobs/psip/bin/common

So it appears that modules is the way to go. unfortunately, I can't specify this in modules because they end up with a common root:

/vobs/psip

It seems that the "correct" way to do this is:

/vobs/psip/proj1
/vobs/psip/proj2
/vobs/psip/common

with separate bin/src/etc directories there.

But. For reasons having to do with history, we can't do that.

I know what I want isn't illegal with javac. Any chance there is a way to get this is IDEA?

Thanks,
Mike

0
8 comments
Avatar
Permanently deleted user

Hi Michael,

Actually I'm in similar situation. Right now I'm solving it this way:

Our directory structure looks this (don't ask)

/vobs/psip/src/proj1
/vobs/psip/src/proj2
/vobs/psip/src/common
/vobs/psip/src/test/proj1
/vobs/psip/src/test/proj2
/vobs/psip/src/test/common
/vobs/psip/junit/proj1
/vobs/psip/junit/proj2
/vobs/psip/junit/common

And modules like this:

-



Module Proj 1:
- root1: /vobs/psip/src/proj1 (marked as source, package prefix 'proj1')
- root2: /vobs/psip/junit/proj1 (marked as test, package prefix 'proj1')

(Same for proj 2 and common)

Then I have:

Module Spaghetti-Tests:
- root: /vobs/psip/src/test (marked as test, package prefix 'test')
- dependencies - all other modules

Module Resources, catching the resource directories as separate roots

Module Catch-all:
- root: /vobs (marked as source)
- exclude the roots of all other modules
- no dependencies

-



The catch-all module is marked as source, so I can know when somebody
adds some code which is not part of the other modules. Since it has no
dependencies, any attempt to use code from the other module would lead
to compilation failure and I can take measures.

Any hints and suggestions appreciated.

Dimitar

0
Avatar
Permanently deleted user

You can setup three modules for each chunk of code with the following content roots each:
/vobs/psip/src/proj1
/vobs/psip/src/proj2
/vobs/psip/src/common

Then mark each content root as a source directory.
Output directories are not required to be located under the module content root, so you can set them to point to your 'bin'
directoiries
Also you may want to set up a 'master' module with the content root /vobs/psip if you want to get easy access to the contents of
the directories 'psip' and 'src' and you store there some files that should be included in the project, but this is not neccesary.


--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

"Michael Kirby" <kirby@ess.mc.xerox.com> wrote in message news:21921047.1118761547397.JavaMail.itn@is.intellij.net...

LEt's say I have a project:

>

/vobs/psip

>

In it I have a number of directories:

>

/vobs/psip/src
/vobs/psip/bin

>

I've created a chunk of common code that I wish to share among different variations of the base code: For example:

>

/vobs/psip/src/proj1
/vobs/psip/src/proj2
/vobs/psip/src/common

>

When I compile, I compile to separate bin directories:

>

/vobs/psip/bin/proj1
/vobs/psip/bin/proj2
/vobs/psip/bin/common

>

So it appears that modules is the way to go. unfortunately, I can't specify this in modules because they end up with a common
root:

>

/vobs/psip

>

It seems that the "correct" way to do this is:

>

/vobs/psip/proj1
/vobs/psip/proj2
/vobs/psip/common

>

with separate bin/src/etc directories there.

>

But. For reasons having to do with history, we can't do that.

>

I know what I want isn't illegal with javac. Any chance there is a way to get this is IDEA?

>

Thanks,
Mike



0
Avatar
Permanently deleted user

Eugene Zhuravlev (JetBrains) wrote:

You can setup three modules for each chunk of code with the following content roots each:
/vobs/psip/src/proj1
/vobs/psip/src/proj2
/vobs/psip/src/common
...
Also you may want to set up a 'master' module with the content root /vobs/psip ...


Isn't that invalid?

Last I knew, if one module has a content root that contains other modules content roots,
IDEA displays an error message.

0
Avatar
Permanently deleted user

Last I knew, if one module has a content root that contains other modules content roots, IDEA displays an error message.


A content root of one module cannot be at the same time the content root in another module. However, a content root of module A
(e.g. /projects/myproj) may contain a content root of module B (e.g. /projects/myproj/subModule). In this case everything under the
B's content root (/projects/myproj/subModule) will be attributed to module B, not A.

--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0
Avatar
Permanently deleted user

Will this work with unit test?

I forgot to mention:

/vobs/psip/utest_shadow/proj1
/vobs/psip/utest_shadow/proj2
/vobs/psip/utest_shadow/common

Mike

0
Avatar
Permanently deleted user

Will this work with unit test?


Why not?

--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0
Avatar
Permanently deleted user

Okay.

I got it working (mostly).

I have the following projects w/ dependencies:

common -> root
data -> common, moduleA
moduleA -> common, root
ModuleAUnitTest -> common, ModuleA
root -> noone

My directory structure looks like:

common -> /vobs/psip/src/common
data -> /vobs/psip/config/classes
moduleA -> /vobs/psip/src/moduleA
ModuleAUnitTest -> /vobs/psip/utest_shadow/ModuleA
root -> /vobs/psip

And all is working well...

Except...

I have duplicate src files in the ctrl-n selection list. They are showing up for both root and common

But things in the unit test, and the module directories are only showing up once.

It's some kind of strange dependency issue I beleive, but I haven't figured it out.

Any ideas?

I tried clearing the cache, and I'm on 3378

Mike

0
Avatar
Permanently deleted user

I have duplicate src files in the ctrl-n selection
list. They are showing up for both root and common

But things in the unit test, and the module
directories are only showing up once.


I figured out why it is happening, but not what to do about it.

I have the following output paths set up:

root -> /vobs/psip/bin/moduleA
moduleA -> /vobs/psip/bin/moduleA
common -> /vobs/psip/bin/common
moduleAUnitTest -> /vobs/psip/bin/moduleA
data -> /vobs/psip/bin/moduleA

The problem, is that root points at moduleA, and thus, any duplication is removed because duplicate entries generate to thesame output location.

Common goes to a different output location, and so root and common conflict (thus then entries show up twice.)

If I change root to point to /vobs/psip/bin/common, common is no longer duplicate, but everything in moduleA is.

Should I file a bug report?

Or is this user error?

Mike

0

Please sign in to leave a comment.