Web Facet Configuration keeps resetting after every Maven project import
Answered
Hi all. I'm working on a GWT project deployed using Maven. The project is correctly recognized as GWT, and so both the GWT and Web facets gets configured automatically by Intellij. However, my Web Resource Directory entry is set to `<project_home>/src/main/webapp` when instead it should be `<project_home>/target/<project_name>`. Of course I change it, but as soon as the Maven project is reimported (and this is very often, since I use Maven auto importing), the value is resetted to `<project_home>/src/main/webapp`.
Is this a bug, and I should open an issue for it, or am I missing some values in my pom.xml?
Please sign in to leave a comment.
Does it help if you override the default via Maven configuration?
http://stackoverflow.com/a/13406135/104891
No, I just added the following to my pom.xml:
But nothing changed; it keeps resetting to <project_home>/src/main/webapp.
Web Resource Directory could be configured using "maven-war-plugin", we use its "warSourceDirectory" configuration value while importing.
So your configuration might look like this:
Such thing will work for "<packaging>war</packaging>" only.
This one fixed it. Thanks Ivan!
I have a follow up on this issue. While the comment above technically fix it, I later realized that now maven-gwt-plugin (who internally uses maven-war-plugin to build the war file, and uses warSourceDirectory to see which files to copy from files from sources to target) won't copy my sources file to the target folder, since I'm basically telling him that my sources are in target console, which is not true. I didn't realize that before because I wasn't cleaning target before packaging.
I think I need to explain my case better: as said, my sources are in src/main/webapp, but the final application needs also some web dependencies (gxt, openlayer) that I fetch from maven at build time; then I copy these dependencies in target/console and in the end maven-war-plugin, invoked by maven-gwt-plugin, copies sources from src/main/webapp to target/console; in this way everyrhing gets merged to target/console. Here's why I need to run the site from targrt/console rather than src/main/webapp.
I was reading maven-war-plugin documentation in order to understand better; shouldn't IntelliJ copy the value from https://maven.apache.org/components/plugins/maven-war-plugin/war-mojo.html#webappDirectory instead of copying it from https://maven.apache.org/components/plugins/maven-war-plugin/war-mojo.html#warSourceDirectory ? I'd rather want to serve the final, compiled version of my site, instead of non-processed content, wouldn't I? Or, at least, should I be able to choose which one of the two?
Sorry for the inconvenience, please use further configuration instead. In this case configured path will be present in facet configuration along with "src/main/webapp".
Despite the warning for the duplicate source root (both the paths are served by the "/" URL), it seems everything is ok now.
Thanks again!
Shouldn't this be something that is fixed in Intellij though? When you set that from File -> Project Structure -> Modules -> Web -> Web Resource Directory
shouldn't it save the information, at least from build to build, instead of resetting it