How to tell Idea not to copy .java files in WEB-INF/classes during a build?
Hi,
I'm working on an existing web app where .java files are stored in WEB-INF/classes directory. Idea copies those .java files to the output directory when doing a build. Is there any way to tell Idea not to do that?
Regards.
请先登录再写评论。
IDEA doesn't support file filters for files copied to an artifact output directory. Could you please attach your project files (*.iml files and .idea
directory) so I'll be able to suggest a workaround for that?
--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Nikolay, thanks for your help.
The .iml file and .idea directory are in the attached zip file.
By the way, can I ask a question here: this project has more than 12k java files. Ant can compile it, but IntelliJ Idea always runs out of memory while doing that. Any way to fix it?
Regards.
Attachment(s):
V2N_INT_DEV3.zip
Your artifact is indeed configured to copy V2I_INT_DEV3/NETACE/NETACE-WEB directory to the output so its WEB-INF/classes subdirectory is copied as
well. I can suggest two workarounds for the problem. If you don't have web files located directly in 'NETACE-WEB' directory you can remove that
directory from 'Web Resource Directories' table in 'Web' facet configuration (File | 'Project Structure' | Modules) and add all its subdirectories
(except 'WEB-INF') with corresponding relative paths (i.e. a directory NETACE-WEB/xxx should be added with relative path '/xxx') to this table instead.
Another workaround is to create an ant target which removes all *.java files from the output directory and specify it at 'Post-Processing' tab of the
'V2N_INT_DEV3_Web_exploded' artifact configuration (File | 'Project Structure' | Artifacts).
To fix the out of memory error go to File | Settings | Compiler | 'Java Compiler' and increase 'Maximum heap size'.
--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Your artifact is indeed configured to copy V2I_INT_DEV3/NETACE/NETACE-WEB directory to the output so its WEB-INF/classes subdirectory is copied as
well. I can suggest two workarounds for the problem. If you don't have web files located directly in 'NETACE-WEB' directory you can remove that
directory from 'Web Resource Directories' table in 'Web' facet configuration (File | 'Project Structure' | Modules) and add all its subdirectories
(except 'WEB-INF') with corresponding relative paths (i.e. a directory NETACE-WEB/xxx should be added with relative path '/xxx') to this table instead.": this is my project structure:
V2I_INT_DEV3/NETACE/NETACE-WEB/iconic: is mapped to /iconic in the web app
V2I_INT_DEV3/NETACE/NETACE-WEB/WEB-INF/classes/path/to/iconic/class: this package is compiled to /WEB-INF/classes of the web app
V2N_INT_DEV3/NETACE/NETACE-WEB: is mapped to / in the web app
|
|-- there are some directories here which will go under / in the web app
|
|-- WEB-INF
|-- some directories here which will go under /WEB-INF in the web app
|-- classes: has .java files inside
|-- lib
|-- some .xml files (e.g. web.xml, something.xml)
Stuff under V2I doesn't cause any trouble because they can be mapped easily.
If I mapped V2N_INT_DEV3/NETACE/NETACE-WEB to / then .java files will be copied to the web app. But if I map:
V2N_INT_DEV3/NETACE/NETACE-WEB/directory1 to /directory1
V2N_INT_DEV3/NETACE/NETACE-WEB/directory2 to /directory2
....
V2N_INT_DEV3/NETACE/NETACE-WEB/WEB-INF/directory3 to /WEB-INF/directory3
then .java files are not copied but at that time I cannot see / edit files under V2N_INT_DEV3/NETACE/NETACE-WEB/WEB-INF in Idea because it is not included in the project.
So the only option left is using ant to delete those .java files, right?
Regards.
Changes in 'Web Resource Directories' shouldn't affect visibility of files in IDEA, so if V2N_INT_DEV3/NETACE/NETACE-WEB is marked as a content root
at 'Sources' tab of the module editor you still should be able to see and edit files under it.
--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"