Community
Participate
Working Groups
Build Identifier: Helios, WTP 3.1.2 Hi, while trying to fix https://issues.sonatype.org/browse/MNGECLIPSE-2357 in m2eclipse-wtp, I've found an inconsistent behavior between export and deployment of linked files in org.eclipse.wst.common.component. Having : <wb-resource deploy-path="/META-INF/web.xml" source-path="/etc/resources/custom-web.xml"/> when exporting the web project as a war file, /etc/resources/custom-web.xml is correctly exported as /META-INF/web.xml. However, when deploying the workspace project to a Tomcat (6/7) or JBoss 5.1 server, the file is deployed as /META-INF/custom-web.xml This is not restricted to web projects, doing the same thing for connector projects and ra.xml yields the same outcome. I would understand that mapping files to a deploy-path that is not a directory may not be supported right now (the fact that export works would be a bug rather than a feature), but I believe export and deployment behaviors should be consistent, especially after all the refactoring Rob's done the last few months. Reproducible: Always Steps to Reproduce: 1.Create a web project (create the deployment descriptor) 2.Move WebContent/WEB-INF/web.xml to /etc/resources/custom-web.xml 3.Add <wb-resource deploy-path="/META-INF/web.xml" source-path="/etc/resources/custom-web.xml"/> to org.eclipse.wst.common.component (after the other <wb-resource> nodes) 4. deploy the project to a tomcat instance (or any other server) 5. Check the existence of /META-INF/web.xml under the deployed project. Its content should correspond to custom-web.xml
Created attachment 179236 [details] Test project - Import the CustomWebXml project, - deploy it to a server, - check the deployment descriptor is wrongly deployed.
(In reply to comment #0) > Build Identifier: Helios, WTP 3.1.2 Oops, read WTP 3.2.1 instead.
Assigning to Rob for initial investigation.
As far as I know, there are no unit tests demonstrating this as a feature. I personally have never seen that usage before and so was not aware it was a feature. This explains why it is not functioning in the deployment model. I am not sure if it ever worked before, but it'd be interesting to see it tested on previous versions to see if the syntax worked then. Anyway, I'd like to see some discussion as to whether this would be a new feature or fixing a regression. It obviously applies.
Rob, I never tried that before either, just trying to implement a new feature in m2eclipse-wtp. I'm pretty sure the fact that export is working is an accident -good for me-, I just want to emphasize the behavior discrepancy between export and deployment. I thought that was not supposed to happen anymore. Now I really don't care if this issue is turned into a feature request. I don't see anything blocking here, m2eclipse users will still be able to deploy custom web.xml files, as long as they're named web.xml
fred: I'm trying in the 3.2.x codebase and I can't get the file to be included at all in this fashion ;) I notice you're using WTP 3.1.2. In WTP 3.1.2, the flattened virtual component model doesn't exist. I believe this was added in wtp 3.2.0. So unified behaviour should be more observable in wtp 3.2.0. However, as I said, in wtp 3.2.0, I don't see the file deployed at all so far (though it may just be a side-effect of some paths I'm using. I haven't figured it out yet despite spending a while tracing.) Give it a go on wtp 3.2 and let me know what you find.
(In reply to comment #6) > I notice you're using WTP 3.1.2. see my 2nd comment (https://bugs.eclipse.org/bugs/show_bug.cgi?id=325733#c2) Eclipse Web Developer Tools Version: 3.2.1.v201007071800-7O7CFbBEMf84nSIGRvUy2Pq4fbXf Build id: 20100615235519 Works for me . Have you tried cleaning the server and publishing again?
Sorry, but I somehow mixed up META-INF and WEB-INF. Please read/test with : <wb-resource deploy-path="/WEB-INF/web.xml" source-path="/etc/resources/custom-web.xml"/> One facepalm for Fred.
retargeting to 3.3
Forcing to 3.3.1 due to schedule. Sorry.
Created attachment 209608 [details] Patch for this change
The test for this will go in EarProjectCreationOperationTest. The patch looks like this. Avoiding a .patch file right now since multiple new uncommitted tests are in the file. public void testEAR_HardDeploymentMapping() throws Exception { IDataModel dm = getEARDataModel("hardEAR", "ourContent", null, null, JavaEEFacetConstants.EAR_5, false); OperationTestCase.runAndVerify(dm); IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("hardEAR"); IFolder f = p.getFolder("test"); f.create(true, true, new NullProgressMonitor()); IFile file = f.getFile("silly.txt"); file.create(new ByteArrayInputStream("Silly String".getBytes()), true, new NullProgressMonitor()); IVirtualComponent earComp = ComponentCore.createComponent(p); IVirtualFolder rootFolder = earComp.getRootFolder(); IVirtualFile vfile = rootFolder.getFile(new Path("out/notsilly.txt")); vfile.createLink(new Path("test/silly.txt"), 0, new NullProgressMonitor()); IModule module = ServerUtil.getModule(p); assertNotNull(module); ModuleDelegate md = (ModuleDelegate)module.loadAdapter(ModuleDelegate.class, new NullProgressMonitor()); IModuleResource[] resources = md.members(); assertTrue(resources.length == 1); assertTrue(resources[0].getName().equals("out")); IModuleFolder mf = (IModuleFolder)resources[0]; IModuleResource[] children = mf.members(); assertTrue(children.length == 1); assertTrue(children[0].getName().equals("notsilly.txt")); }
This change looks good go ahead, and add the test please
Created attachment 209658 [details] An additional patch on top of the previous After running a fuller test suite, I found some other untested test cases failed. The issues were two: 1) Sometimes, the IVirtualResource is null. This should be guarded against 2) Behaviour when the path is "/" (as opposed to an empty path) caused incorrect behaviour and NPEs. Item 1) is clearly caused by this bug's patch. Item 2 may be a long-standing issue that's been overlooked (?). Either way, I'm committing the test case with this additional fix to guard against these issues.
Committed and released to 3.3.2 and head