IntelliJ 2018.2 does not automatically copy resources that are not the class folder across the WAR
Answered
On upgrade to 2018.2 I found that during build my .properties files were not copied across to WAR folder automatically like it was in the previous IntelliJ IDEA version 2018.1. Only the class files were copied across. I had to downgrade to resolve the issue.
Please sign in to leave a comment.
Hello Paul,
Do you use any build system (Maven, Gradle)? Is it possible to reproduce the issue with new sample project?
Hey Yaroslav,
I am using Maven for dependencies. I have not tried to reproduce it with a sample project, I just noticed and thought I'd make anyone else experiencing the same issue aware.
Thanks,
Paul
Paul,
I couldn't reproduce the issue on my machine. Could you please try to check the issue with new project?
I ran into the same issue.
I am building a project with maven. For testing purposes I build my web application with with an additional maven profile. This profile copies some additional resources with the maven-resources-plugin into my exploded war (target folder) and also replaces the web.xml using the maven-war-plugin inside the exploded war (target folder)
With IDEA ULTIMATE 2018.1 (Build #IU-181.4203.550) I could start my server which triggers a BUILD during start but any copied/overwritten resources remain intact.
With IDEA ULTIMATE 2018.2 (Build #IU-182.4505.22) I am starting the same run configuration, which also triggers a BUILD during start. Now however, the web.xml is replaced with the original one from the sources. Issue: I am losing the web.xml from my maven test profile.
Any idea?
Best
I did more digging by comparing all configuration from IDEA 2018.1 with the failing IDEA 2018.2
Uses the same run configuration, same preferences settings (build/execution/deployment), same project structure (modules, artifacts etc).
I was able to fix this issue by removing the "Before Launch Action" Build action. This action is configured in 2018.1 and triggers the build module command.
The run configuration is configured to update classes and resources on update and on frame deactivation. These updates are working fine. web.xml does not get overwritten.
Is this a bug or did you fix the configuration with 2018.2?
Axel,
There were some changes in artifact configuration between these two versions. Seems that artifact is build differently in different versions. You could try to run "Build | Build Artifact" and check the results. I suppose that web.xml is not included in artifact in 2018.1 that's why it is not overriden.
I see a very similar problem with IDEA no longer copying test resources before running unit tests. I think this was a regression that was introduced around 2018.2.
We need a sample project to investigate this problem.
I encountered this problem with idea v2019.1.3 and some older version before. And I finally solved it by reconfigure `Facets' in Project Structure.
I don't know how I made this corrupted config, but after reconfiguring, everything works fine.
FYI.
I have the same problem with IDEA Community 2019.3.
Please fix it.
@Parsentev please provide a sample project to investigate and describe the expected/actual result.
Andrey Dernov Sorry. It is my faults. It works perfect. I can't repro it.
I have the same problem with IDEA Community 2020.1.2.
@... please provide a sample project to investigate and describe the expected/actual result. You can send the archive here: https://uploads.jetbrains.com/
Konstantin Annikov
2020_07_02_KPGnnnvWxF7LgAV3
Hi guys. When I am building a project with maven., the file ..... / src / main / resources / hibernate.cfg.xml is not automatically copied to the class pack
@... Please configure artifacts under Project Structure (https://i.imgur.com/GSJOY7Q.png). See https://www.jetbrains.com/help/idea/working-with-artifacts.html#artifact_configs
Konstantin Annikov Thanks, it works.