How to tell IJ to use XML files in the Classes Output directory

My hibernate xml files are in the same dir as output classes:

AppRoot/WEB-INF/classes/hibernate.cfg.xml
AppRoot/WEB-INF/classes/myapp.hbm.xml

I'm not sure how to tell IJ to
a) read/use those xml files in runtime (getting resource not found errors)
b) include those files in the IDE so I can edit them.

The screenshot shows that the WEB-INF/lib shows up but not WEB-INF/classes. My key hibernate files are in there, and they are being ignored by both the IDE editor and by the debugger/runtime.

Help appreciated.

-


btw, this structure works fine when I run tests from the command line

Edited by: Stephen Boesch on Aug 3, 2008 10:55 AM

Edited by: Stephen Boesch on Aug 3, 2008 10:58 AM

Edited by: Stephen Boesch on Aug 3, 2008 10:07 PM



Attachment(s):
whereAreMyClasses.JPG
10 comments
Comment actions Permalink

Hello Stephen,

The compilation output directory is by default excluded from abalysis by
IntelliJ IDEA. Don't store your source (or configuration) files there.

Strange problem here. my hibernate.cfg.xml

Here is structure of my webapp

AppRoot/WEB-INF/classes/hibernate.cfg.xml
AppRoot/WEB-INF/classes/myapp.hbm.xml
These are editable within Intellij if I navigate to their dir's
directly in the Project Explorer.

However:
a) Find File does not locate them
b) They are not being picked up when I run the application, even
though that directory is the output directory for my compilations.
Most importantly is b) since running tests does not work. How do I
ensure that all files in that directory, not just .class files, are
being picked up by ClassLoader?

thx

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


0
Comment actions Permalink

Hi Dimitry

As part of my (long!) troubleshooting, I had at one point changed the output classes dir to another directory. The AppRoot/WEB-INF/classes never showed up. In fact I just did it again (changed to /tmp/classes): but the AppRoot/WEB-INF/classes still does not show up in the project explorer, or allow me to find the xml files in it.

There may be a bug that IJ is holding on to the old output classes dir, so I can never see the files in it,

Note: it is not acceptable to be forced to move the configuration files out of the WEB-INF/classes dir.

Changing the output classes dir is acceptable, but I have already done that and still the xml configuration files are not found, even after shutting down / restarting IJ.

Please test this yourself and advise a workaround. Thanks.


Edited by: Stephen Boesch on Aug 4, 2008 7:37 AM

Edited by: Stephen Boesch on Aug 4, 2008 7:56 AM

0
Comment actions Permalink

Hello Stephen,

Hi Dimitry

As part of my (long!) troubleshooting, I had at one point changed the
output classes dir to another directory. The AppRoot/WEB-INF/classes
never showed up. In fact I just did it again (changed to
/tmp/classes): but the AppRoot/WEB-INF/classes still does not show up
in the project explorer, or allow me to find the xml files in it.

There may be a bug that IJ is holding on to the old output classes
dir, so I can never see the files in it,

Please test this yourself and advise.

Edited by: Stephen Boesch on Aug 4, 2008 7:37 AM


Is the WEB-INF/classes directory located under any module's content root?
By default WEB-INF/classes is created in exploded directory, out of content
roots. If it does not belong to any module, it cannot be shown anywhere.

Alexander.


0
Comment actions Permalink

Hi Alexander,

The directory AppRoot is included as the web context. The original post mentioned that other directories under AppRoot and even AppRoot/WEB-INF show up in the project explorer and are picked up at runtime. Specifically AppRoot/WEB-INF/lib/* , AppRoot/WEB-INF/tags/, AppRoot/jsp/ AppRoot/* , AppRoot/images/*, etc

It's just the WEB-INF/classes dir that refuses to be picked up . And it's not even the output dir anymore (although I do wish it could be).

0
Comment actions Permalink

Hello Stephen,

Hi Alexander,

The directory AppRoot is included as the web context. The original
post mentioned that other directories under AppRoot and even
AppRoot/WEB-INF show up in the project explorer and are picked up at
runtime. Specifically AppRoot/WEB-INF/lib/* , AppRoot/WEB-INF/tags/*,
AppRoot/jsp/* AppRoot/* , AppRoot/images/*, etc

It's just the WEB-INF/classes dir that refuses to be picked up . And
it's not even the output dir anymore (although I do wish it could be).


Does your directory structure look like one on the screenshot (attached)?

Alexander.



Attachment(s):
WebOutputInSource.JPG
0
Comment actions Permalink

yes, that's what the screenshot is for.

0
Comment actions Permalink

Hello Stephen,

yes, that's what the screenshot is for.


Ah, sorry. Your screenshot was not loaded from forum into the news, what
I am reading.

I will try to reproduce the problem.

Alexander.


0
Comment actions Permalink

Hello Stephen,

yes, that's what the screenshot is for.


I have re-created the similar project structure and can access WEB-INF/classes
with all content.

If you attached your .iml file (sources are not necessary) it could help.

Alexander.


0
Comment actions Permalink

attached the .iws and .iml files



Attachment(s):
myproject.iws
myproject.iml
0
Comment actions Permalink

Hello Stephen,

attached the .iws and .iml files


Thank you. Again, I have re-created the module structure accordingly to the
.iml settings. For me WEB-INF/classes is shown and hibernate configs may
be found by search and "go to file", for example. Both 7757 (7.0.3) and the
latest 7938. I'm giving up. You could try to clean caches and restart.

Alexander.




0

Please sign in to leave a comment.