This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Allow to copy static resources on save independently of Compile on Save | ||
---|---|---|---|
Product: | javaee | Reporter: | Petr Jiricka <pjiricka> |
Component: | Maven | Assignee: | Martin Janicek <mjanicek> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ender01, jskrivanek, lallafa, mart_l, mehiel, ninan, verydapeng, viggonavarsete |
Priority: | P3 | ||
Version: | 7.2 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Attachments: |
First sketch of possible solution
Updated sketch of possible solution |
Description
Petr Jiricka
2012-09-14 08:20:19 UTC
*** Bug 220493 has been marked as a duplicate of this bug. *** *** Bug 216517 has been marked as a duplicate of this bug. *** Created attachment 139702 [details]
First sketch of possible solution
Created attachment 139703 [details]
Updated sketch of possible solution
Implemented in web-main #bac5a505ae67 Additional fix: web-main #97f2f753dd44 Integrated into 'main-silver', will be available in build *201310090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/97f2f753dd44 User: Martin Janicek <mjanicek@netbeans.org> Log: #218345 - Apply the same rules for copy on save for static resources for all types of file events Hey, it seems that it will just pick .jsp and .html files: 282 private boolean isStaticResource(String fileExt) { 283 if ("html".equals(fileExt) || "jsp".equals(fileExt) || "xhtml".equals(fileExt)) { 284 return true; 285 } 286 return false; 287 } 288 Why not jsf pages (.xhtml)? And images? Stylesheets? etc. The code you pasted is not valid (not sure what sources you are using). If you check-out Mercurial repository, you will see that xhtml, js, css files are handled as well. You are right that images are missing, I'll add them. Anything else you can think of? I got the code it from an attachment to this issue. Didn't check the repository, I believe you that it's ok there. Ok thanks, changing back to fixed ;) Why restricting CoSsr for some extensions (html, jsp, xhtml, css, js) only? I need it for Freemarker templates (*.ftl) too! I guess there are many more like *.txt, *.properties, *.xml, *.xls, ... To work with .ftl templates (NetBeans 8.0) you should check "Deploy on Save" and "Copy Static Resouces on Save" as a workaround. Reopening as it doesnt' work properly for non-web maven projects. In our case, we are working on a maven javafx app on nb 8.0, we need to copy .css and .fxml file. +1 for a [] Copy Static Resources on Save checkbox above Compile On Save. Copy Static Resources is a great addition to the IDE. But IMHO we can't just hardcode what type of extensions should be considered static resources. There are even cases that an extension may be static resource in one project and dynamic on another. In my case I have .mustache templates that are evaluated client-side and they don't get copied. And .less files are missed too. So we may have a basic set of static resources preconfigured and let the user fine-tune it both globally and per project. I was thinking of just anything under src/main/resources -for maven- (In reply to pablopina from comment #16) > I was thinking of just anything under src/main/resources -for maven- That's another way but I'm not sure if it's better than defining file extensions. And it won't be that simple if we want to follow every maven configuration. The IDE should get all the <resources/>, <warResources/> etc. (ok it does/knows that already for maven projects) and treat everything included in them as static resources, which may not be the case for every project out there. I'll try to find some time to create a patch and see how it goes. The sure thing is that this is crucial for web developers because the case with version 8.0 until this is solved is worse than it was with 7.4. It reduces productivity a lot. Hi guys, thanks for your comments, I understand your issues. I would like to avoid situation where everyone would need to manage their own "list of static resources extension". One possibility we could try is the one from comment 16. Other I have in mind is simply the opposite approach which means put a list of what is not a static resource (that was actually the original purpose, to avoid java/groovy files). Which might be pretty simple for most usual use cases at least. What do you think? (In reply to Martin Janicek from comment #18) > What do you think? If we want to avoid over-configuration, sure what pablopina proposed (on comment 16) could work happily for most cases. But I think we should avoid hardcode paths like "src/main/resources" or "src/main/webapp". We can get them from the project's pom/configuration, can't we? (In reply to mehiel from comment #19) > But I think we should avoid hardcode paths like "src/main/resources" or > "src/main/webapp". We can get them from the project's pom/configuration, > can't we? Ye, that shouldn't be a problem. Any news on that? now it is very broken, i have to depend on an external watcher to sync the changes ... for those who is using linux here is a temp rescue inotifywait -r -m -e attrib -e modify $PROJ_SRC | while read line; do rsync -r --ignore-existing $PROJ_SRC/* $SERVER_DEPLOYMENT done This also seems to ignore .jspf files. Fixed by change-set: web-main #de73823c63e8 (In reply to Martin Janicek from comment #24) > Fixed by change-set: web-main #de73823c63e8 So it's working the other way around now. Instead of whitelisting static resources, it blacklist .java and .groovy files from copying on save. Seems like it solves all the cases mentioned above. Thanks Martin. (In reply to mehiel from comment #25) > So it's working the other way around now. Instead of whitelisting static > resources, it blacklist .java and .groovy files from copying on save. Seems > like it solves all the cases mentioned above. Thanks Martin. Ye, it was the simplest and safest way how to fix it for 8.0.1 ;) Integrated into 'main-silver', will be available in build *201407180001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/de73823c63e8 User: Martin Janicek <mjanicek@netbeans.org> Log: #218345 - Allow to copy static resources on save independently of Compile on Save *** Bug 236485 has been marked as a duplicate of this bug. *** hi. i just saw this issue number on stackoverflow. after i read, i tried it in netbeans 8.0.2 and it works. it is great job. thanks for "copy static resurces on save" check box. before, when i unchecked deploy on save, also netbeans was not copying xhtml files. it was the biggest problem for us in big maven project. thank you again for this fix. |