EJB module and Java module sharing source path
Hi all!
What I want to do is creating a Java module with all my sources and packages, then create an (some) EJB module(s) which get their sources from the Java module.
This doesn't seem to work, when I assign the "src" directory (where my packages and sources reside) to the EJB module as source directory (via adding it as a content root and assigning it as "Sources") it is gone from the Java module (in the package view).
As a workaround I tried to create the EJB classes manually in the Java module (cumbersome...) but then IDEA won't add an EJB to the EJB module (although it adds it to the DD).
Any ideas/comments/workarounds/solutions?
Using build#2139, currently upgrading to 2192... will this solve my problem? Don't think so, it seems intentionally that a directory can only be one module's source path...
kind regards,
Messi
请先登录再写评论。
I would like to be able to do this as well.
Our current workaround is to use Ant for the build, with 'includes' for specific packages, and a matching 'destdir' attribute. [and multiple ]]> elements to include module/generated source code as well as the revision controlled files in module/src]
The current Idea filter simply includes / excludes directories - what would be needed are sub-module 'affinity' labels as well.
I needed to do exactly what you want. What I found is that Idea does not like the sources for a module to overlap with the source path of other modules. But it has no problem with each modules source being rooted in one or more packages (rather than just 'src') if they do not overlap.
So if you have say an EJB module, a Web module and some common java module which may have exceptions or VO's or something, then the way you do it is to have just one 'src' directory but each module you reference the specific nonoverlapping package in the source tree; so for the common java module you have content root like:
'...com.yourcompany.project.common' as the source root, and in the module for EJB's it would have a root of '...com.yourcompany.project.ejbs' and the WEB one would be 'com.yourcompany.project.web'. As long as tey do not overlap Idea will do the right thing. So now in each module you should see in the left hand box a "Source Folders" line and underneath it a line like "src/com.yourcompany.project.ejbs" not just "src"
And of course you can have (and will probably need) another folder with your module specific resources as an additional content root in each module.
Hope this helps.
r.
This is still not working. It does work if you have only one ejb module, but as soon as you add some other ejb modules the dependencies do not work for the new ones.
Maybe its a very simple configuration issue we don't know about but we would appreciate any tips from JetBrains' guys.
Thanks.
I usually specify the shared Java module as a +dependency +for each EJB module, not as part of the content root. This way, the ejb code always compiles fine, and I can easily step through the code in the debugger (attached to a remote process) even although I generally use an ant script to build the project and deploy. But you should be able to deploy your ejbs this way as well (see Project Settings/EJB Module Settings/"Modules and Libraries to Package" pane.) Hope this helps...
Well, the problem is not deployment. I also have have an ant script that does the job of deployment and packaging. The problem is when coding its not easy to navigate to remote interface and the bean back and forth and of course hard to refactor when this dependency is not working. I have also set the dependency between my ejb module and Java Module which actually contains all the source files. The funniest thing is that it worked for the first EJB module but not for the second one. Strange...
Content roots are exclusive - no file can be in 2 content roots
simultaneously. This is by design and isn't going to be changed.
Do you mean, like if I my EJB module has nothing in the source dir and I set the dependency to my java module which contains the EJB sources will IDEA recognize the dependecies? I have tried this many times and can't get it working. The funnies part is that it works for the first EJB module and if I add more it does not recognize the Home/Remote/Bean classes.
Is there any workaround for this out there?
Thanks in advance.
Naimdjon