Community
Participate
Working Groups
Build Identifier: I20110613-1736 Hi, Since m2e-wtp 0.13.0, a typical maven-powered dynamic web project defines 2 folders its .component : 1 - target/m2e/web-resources/ : contains generated files 2 - src/main/webapp/ : contains user resources under SCM Both folders are deployed via the WTP server adapter. The target folder is put in first position because we sometimes need to override user resources (ex. dynamically replacing placeholders in configuration files) and WTP deploys the first resource it finds. When you add the JSF Facet to such project, and ask to add the faces servlet to the web.xml, the JSFFacetInstallDelegate pretty much does the following : - looks for the first folder found in .component (finds target/*) - finds no web.xml so generates an empty webxml model - serialize the new model to the web.xml it finds in src/main/webapp => the user web.xml is then totally overwritten. This is a MAJOR issue for m2eclipse-wtp and JBoss Tools users, where the JSF Facet is automatically installed if a JSF dependency is detected in the project classpath. So : 1 - The process should be consistent : Find a web.xml in a directory and stick to it when it writes updates 2 - We should be able to pass an IPath or an IFolder output directory property to the Delegate. It would allow adopters to point the Delegate to the correct generation location, the right web.xml would be changed, faces-config.xml would be added alongside. Reproducible: Always Steps to Reproduce: This can be reproduced using stock WTP projects. You can import the Web project attached to this issue. Check the content of WebContent/WEB-INF/web.xml 1. open the project properties 2. In project facets, choose JSF 1.2 3. Click on the "Further configuration Available" link 4. JSF Implem. Library : Make sure disable library configuration is selected 5. Make sure "Configure JSF Servlet in DD" is checked 6. Click on OK, then OK to complete the facet change 7. Check the web.xml has been totally overwritten in WebContent/WEB-INF/
Created attachment 200868 [details] Sample project to reproduce the issue
Note that I'm aware of model.setBooleanProperty(IJSFFacetInstallDataModelProperties.CONFIGURE_SERVLET,false) which prevents messing with web.xml updates. The problem occurs when it's set to true.
I have logged the blocking bug 355150 against jst.jee, since we rely on their ModelProviderManager to get the web model, and it is being provided without content of the web.xml in the second web root. Note the "Deployment Descriptor" explorer node on opening the project (even before adding the JSF facet) - it shows no content, implying there are issues with the provider understanding multiple web roots.
Fix committed to 3.2.5 stream at 2011/08/24 11:36AM PDT. See bug 355150 (and the bug it refers to) to understand the recent change made by the jst.jee team so that their subsystem more accurately tracks the "default" web root folder. In a nutshell, along with the changes made to the JSF facet install delegate, your project needs to have its .component file tweaked slightly; on the web root you consider default (i.e. where you have your existing web.xml file), you need to add the attribute "tag", with the value "defaultRootSource". That is, your .component file needs to change from what is in the attached sample project to the following: <?xml version="1.0" encoding="UTF-8"?> <project-modules id="moduleCoreId" project-version="1.5.0"> <wb-module deploy-name="foo"> <wb-resource deploy-path="/" source-path="/Empty"/> <wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/> <property name="context-root" value="foo"/> <property name="java-output-path" value="/foo/build/classes"/> </wb-module> </project-modules> The JSF Facet install delegate will then be handed a populated (instead of empty) model, and will be able to recognize this and act appropriately.
Fix committed to HEAD (3.3.1 and 3.4.0) stream at 2011/08/24 12:18PM PDT.
Fix released to 3.2.5, 3.3.1 and 3.4.0 streams.