Can a source directory be shared by more than one module?

I think I remember seeing someone talk about this and say that it would not be available until 4.1, but I can't seem to find that post anymore.

I have source that is used by my java module and also by the jsps in my web module. I can't seem to get the Java class names to show up as being found for both my JSPs and my .java files.

Let's say that my directory structure is this:
\myapp\source for my .java files
and
\myapp\ear\mywebapp for my web-inf and JSPs

My Java source module has a root of \myapp

My web module root is set to \myapp\ear\mywebapp

but having it set up this way, any .java classes used by my JSPs show up in red and are not found.

If I change my web module root to be \myapp
and put source as one of its source directories, the source directory gets removed from my Java module.

Please advise. I am with the latest build 1138.

Thanks for any help or suggestions that you can provide.

7 comments

Indeed modules cannot share the same content root and if it is the case, the
root is attributed to one of them. If contents of module A is below the
content root of module B, then everything that is below the B content root
of B is excluded from the content of A.
So for your project I would advise the following structure:
1. Java module with the content root \myapp\source and source directory
\myapp\source
2. Web module with the content root \myapp\ear\mywebapp (note that the
directories conteining jsps should be marked as web roots).
Have your web module depend on the java module (set this in Dependencies
tab)
Everything should be visible and compilable now.

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


0

Eugene Zhuravlev wrote:

Indeed modules cannot share the same content root and if it is the case, the
root is attributed to one of them. If contents of module A is below the
content root of module B, then everything that is below the B content root
of B is excluded from the content of A.
So for your project I would advise the following structure:
1. Java module with the content root \myapp\source and source directory
\myapp\source
2. Web module with the content root \myapp\ear\mywebapp (note that the
directories conteining jsps should be marked as web roots).
Have your web module depend on the java module (set this in Dependencies
tab)
Everything should be visible and compilable now.


Ok,

do you have a solution for my problem?

1) Single sorce tree
2) The source tree contains several components (some EJB some POJOs)
3) It is not possible to change the storage structure

How can I define for every component a corresponding module (3 EJB
Modules, 1 JAVA Module). Of course, i want that every module displays
its sources in the project pane.

bye

0

"> do you have a solution for my problem?
>

1) Single sorce tree
2) The source tree contains several components (some EJB some POJOs)
3) It is not possible to change the storage structure

>

How can I define for every component a corresponding module (3 EJB
Modules, 1 JAVA Module). Of course, i want that every module displays
its sources in the project pane.

>

You can define a single EJB module containing all your EJBs and utility
classes.

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


0

Eugene Zhuravlev wrote:

"> do you have a solution for my problem?

>>1) Single sorce tree
>>2) The source tree contains several components (some EJB some POJOs)
>>3) It is not possible to change the storage structure
>>
>>How can I define for every component a corresponding module (3 EJB
>>Modules, 1 JAVA Module). Of course, i want that every module displays
>>its sources in the project pane.
>>


You can define a single EJB module containing all your EJBs and utility
classes.

Ok,

that is for sure a solution, but not as flexsible as I would expect.

Anyhow, thanks for the hint.

bye

0

that is for sure a solution, but not as flexsible as I would expect.

>

But why would you need a separate module per-ejb?

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


0

... because you may have several ejb-jar.xml files in separate directories. Each deployment descriptor file defines the deployment characteristics for at least one EJB - but there is not one ejb-jar.xml file that describes all of the EJBs in the project.

You may have this when you're developing a Weblogic app (as we are) where each bean is in a separate subdirectory of the content root.

If you have this situation, and all of your source files are within the same content root, you will not be able to use the EJB/J2EE capabilities of Aurora (without modifying your directory structure). And, regrettably, you will have to wait until 4.1 is out.

See http://www.intellij.net/tracker/idea/viewSCR?publicId=20491 and
http://www.intellij.net/forums/thread.jsp?forum=22&thread=51598

0

This should be solvable by what some of have been begging for
since long time ago:
Let the source directory have an attribute saying which package
it is (similar what we had in 3.0.x and it disappeared from 4.0).
In that case, your one root may be folder src/com/abc/ejb_one
(marked as package com.abc.ejb_one) and the other may be
src/com/abc/ejb_two.

Plus, all the old reasons why we NEED that feature for plain
Java development.

r.


David Macklem wrote:

.. because you may have several ejb-jar.xml files in separate directories. Each deployment descriptor file defines the deployment characteristics for at least one EJB - but there is not one ejb-jar.xml file that describes all of the EJBs in the project.

You may have this when you're developing a Weblogic app (as we are) where each bean is in a separate subdirectory of the content root.

If you have this situation, and all of your source files are within the same content root, you will not be able to use the EJB/J2EE capabilities of Aurora (without modifying your directory structure). And, regrettably, you will have to wait until 4.1 is out.

See http://www.intellij.net/tracker/idea/viewSCR?publicId=20491 and
http://www.intellij.net/forums/thread.jsp?forum=22&thread=51598

0

Please sign in to leave a comment.