Is IntelliJ really this stupid about modules?

I hope I'm missing something, but others have asked about this on the forums without getting any response.

I have a J2EE project (Struts with EJBs) arranged like this:

project/
bin/
build/
deploy.descr/
src/
web/
web_exploded/

All Java code for the EJBs and Struts and shared code is in the src/ dir. This is a pretty typical way to organize a J2EE project.

(As an aside IntelliJ uses bin/ and web_exploded/. Ant uses build/ and web/ for its staging areas. I seperate the IDE's build directories from Ant's build directories so I can tell if build.xml is missing anything or if my IDE project is missing anything. Using seperate directories for the IDE and Ant builds will prevent one from concealing a mistake in the other.)

I need two modules, ejb and web. I need to create the web module in the project/ dir so it can get to the Struts source code in src/. So far so good.

I need to create the ejb module in the project/ dir so it can find the ejb-jar.xml in deploy.descr/ and put its output in bin/. When I try to create the ejb module in the project/ dir the wizzard refuses because the web module uses project/ as its root.

Another is that the wizzard won't let you use a directory parallel to the module root. If I could do this I could put deploy.descr/ in src/ and use src/ as the ejb module root, but then I'dt get the output under src/ instead of parallel to src/ in bin/.

Apparently IntelliJ forces me to create another level with two directories below project/ so it can have two different module roots and then make the ejb module a dependency of the web module. Then I'd have to re-write the Ant script to accomodate this kludge.

I haven't been able to find any documentation on how IntelliJ treats projects and modules except for some pictures of their wizzards. I've asked support and they've sent me more pictures of their wizzards. Is there any documentation on this? Am I just forced to do what I mentioned in the previous paragraph?

If IntelliJ is really this stupid about setting up modules in a project then it is a serious architectural screw up.

7 comments
Comment actions Permalink

I don't know if this counts as a 'best' practice or not, but I would seperate the server from the client .



The source roots could be seperate, named for each module, or a modified 'maven' style

Does your deployment enviornment have the WAR file contained inside the EAR? If not, I would act to decouple the client and server the the greatest possible extent.

0
Comment actions Permalink

I do agree with you that there needs to be more information provided on
how to set-up an EJB project. I eventually had to have a teammate show
me what to do. Thanks Sledge.

If you want I can create a small how-to with screen shots to show you
how to create a project. What is below is what we had to resort to,
given the circumstances.

Here is what we have. Some of this is BS, but that is caused by one
team member using that over-priced, less functional editor (yes, JBuilder).


/dist is a build directory. Throw whatever you want there, it doesn't
matter. Not in CVS or in any project source, etc
/JXFormsApp - contains the /META-INF/ files (application.xml and
jboss-app.xml). This is the J2EE Application module.
/JXFormsWeb - this is the web module. We would normally have a
directory underneath this that contains the web resources, but JBuilder
was too stupid so we had to have the module file with the .jsps and
ignore it later so it does not get deployed.

Here is where it got ugly because of JBuilder.
/src is the single source tree that JBuilder insisted on having.
JBuilder then used filters to separate out the code that will go into
the ejb.jar and code that goes inside the web /WEB-INF/classes
directory. IntelliJ was able to adapt to this also and allow the web
developer to see their code as separate.
/JXFormsEJB is the ejb module. /src is it's source tree. This means
that the content root for the ejb moduel is the project directory. In
the EJB module, I set all directories except the ejb module directory
and /src as ignored.

Everything else is OK.

Dean Schulze wrote:

>I hope I'm missing something, but others have asked about this on the forums without getting any response.
>
>I have a J2EE project (Struts with EJBs) arranged like this:
>
>project/

bin/
build/
deploy.descr/
src/
web/
web_exploded/

>
>All Java code for the EJBs and Struts and shared code is in the src/ dir. This is a pretty typical way to organize a J2EE project.
>
>(As an aside IntelliJ uses bin/ and web_exploded/. Ant uses build/ and web/ for its staging areas. I seperate the IDE's build directories from Ant's build directories so I can tell if build.xml is missing anything or if my IDE project is missing anything. Using seperate directories for the IDE and Ant builds will prevent one from concealing a mistake in the other.)
>
>I need two modules, ejb and web. I need to create the web module in the project/ dir so it can get to the Struts source code in src/. So far so good.
>
>I need to create the ejb module in the project/ dir so it can find the ejb-jar.xml in deploy.descr/ and put its output in bin/. When I try to create the ejb module in the project/ dir the wizzard refuses because the web module uses project/ as its root.
>
>Another is that the wizzard won't let you use a directory parallel to the module root. If I could do this I could put deploy.descr/ in src/ and use src/ as the ejb module root, but then I'dt get the output under src/ instead of parallel to src/ in bin/.
>
>Apparently IntelliJ forces me to create another level with two directories below project/ so it can have two different module roots and then make the ejb module a dependency of the web module. Then I'd have to re-write the Ant script to accomodate this kludge.
>
>I haven't been able to find any documentation on how IntelliJ treats projects and modules except for some pictures of their wizzards. I've asked support and they've sent me more pictures of their wizzards. Is there any documentation on this? Am I just forced to do what I mentioned in the previous paragraph?
>
>If IntelliJ is really this stupid about setting up modules in a project then it is a serious architectural screw up.
>

>



Attachment(s):
moz-screenshot.jpg
0
Comment actions Permalink

I am not sure why you want one source tree. If it's something that
really needs EJB's, like something outside the web module also needs the
code - external daemon, etc, or you really need the multi transaction
support and your JDBC drive doesn't support it, then I would think that
you would want multiple source trees.

With that said, IntelliJ can handle a single source tree. We did it by
having code by having a web package that contains all the web packages,
then ignoring that directory in the source tree in the EJB module and
then setting the web module's source root to the web package. IntelliJ
then does the cool thing and sets it so that the package directory is
appended with the additional packages that were before .web. Super sweet.

Either way, IntelliJ has proven to be much more flexible than the other
editors that we have floating around our hallways.

Dean Schulze wrote:

>I hope I'm missing something, but others have asked about this on the forums without getting any response.
>
>I have a J2EE project (Struts with EJBs) arranged like this:
>
>project/

bin/
build/
deploy.descr/
src/
web/
web_exploded/

>
>All Java code for the EJBs and Struts and shared code is in the src/ dir. This is a pretty typical way to organize a J2EE project.
>
>(As an aside IntelliJ uses bin/ and web_exploded/. Ant uses build/ and web/ for its staging areas. I seperate the IDE's build directories from Ant's build directories so I can tell if build.xml is missing anything or if my IDE project is missing anything. Using seperate directories for the IDE and Ant builds will prevent one from concealing a mistake in the other.)
>
>I need two modules, ejb and web. I need to create the web module in the project/ dir so it can get to the Struts source code in src/. So far so good.
>
>I need to create the ejb module in the project/ dir so it can find the ejb-jar.xml in deploy.descr/ and put its output in bin/. When I try to create the ejb module in the project/ dir the wizzard refuses because the web module uses project/ as its root.
>
>Another is that the wizzard won't let you use a directory parallel to the module root. If I could do this I could put deploy.descr/ in src/ and use src/ as the ejb module root, but then I'dt get the output under src/ instead of parallel to src/ in bin/.
>
>Apparently IntelliJ forces me to create another level with two directories below project/ so it can have two different module roots and then make the ejb module a dependency of the web module. Then I'd have to re-write the Ant script to accomodate this kludge.
>
>I haven't been able to find any documentation on how IntelliJ treats projects and modules except for some pictures of their wizzards. I've asked support and they've sent me more pictures of their wizzards. Is there any documentation on this? Am I just forced to do what I mentioned in the previous paragraph?
>
>If IntelliJ is really this stupid about setting up modules in a project then it is a serious architectural screw up.
>

>

0
Comment actions Permalink


Could you please show me what your directory structure looks like and where you put your module roots?

One reason I put the entire project in a single source tree (project/ dir) is so you can check it out of CVS all at once.

0
Comment actions Permalink

I'm not sure how CVS works, but we have several source trees and, using
Perforce, can "check out" the entire project at once.

"Dean Schulze" <no_mail@jetbrains.com> wrote in message
news:6041035.1125412201251.JavaMail.javamailuser@localhost...
>

Could you please show me what your directory structure looks like and
where you put your module roots?

>

One reason I put the entire project in a single source tree (project/ dir)
is so you can check it out of CVS all at once.

>



0
Comment actions Permalink

I have never used perforce, but this works great in CVS.

/project directory (this is the level that you do the checkout on)
project.ipr
project.iws (do not check in - user specific)
/application module root
appmodule.iml
/meta-inf
application.xml
/ejb module root
ejbmodule.iml
/src
/web module root
webmodule.iml
/src
/resources (this is where your .jsp files go)

Brad wrote:

>I'm not sure how CVS works, but we have several source trees and, using
>Perforce, can "check out" the entire project at once.
>
>"Dean Schulze" <no_mail@jetbrains.com> wrote in message
>news:6041035.1125412201251.JavaMail.javamailuser@localhost...

>
>>Could you please show me what your directory structure looks like and
>>where you put your module roots?
>>
>>One reason I put the entire project in a single source tree (project/ dir)
>>is so you can check it out of CVS all at once.
>>
>>
>>
>>
>
>

>

0
Comment actions Permalink

We have a very similar setup with one source tree. I think this is a fairly common for those of us who deploy into a single ear file. We seperate our source by package names, not by different source roots.

The other responses seem to adhere to a "structure your project to the IDE" philosophy. I'm sure there are advantages to this for other projects, but for ours, the only advantage seems to be to make it fit the "Intellij" way.

As to Intellij being the most flexable of IDE's, I also point to my project with Eclipse without have to restructure my source. Not sure how the others define flexability.

I think this is a problem (call it a feaure or bug, I don't care) that needs a solution within Intellij.

0

Please sign in to leave a comment.