This content has been marked as final. 
    
Show                 1 reply
    
- 
        1. Re: Updating application.xml within earveitg Mar 30, 2012 7:21 AM (in response to veitg)Ok, I'll figured it out. For everyone who's interested - that works for me: {code} ... ... ear.addAsModule(archive); 
 Node node = ear.get("META-INF/application.xml");
 DescriptorImporter importer = Descriptors.importAs(ApplicationDescriptor.class, "test");
 ApplicationDescriptor desc = (ApplicationDescriptor) importer.from(node.getAsset().openStream());
 // seems that ejbModule/javaModule simply appends. that violates the xsd. so removing probably existing library-directory
 // and adding it later on
 String xml = desc.exportAsString();
 xml = xml.replaceAll("<library-directory>lib<\\/library-directory>", "");
 desc = (ApplicationDescriptor) importer.from(xml);
 desc.javaModule("tests.jar");
 desc.libraryDirectory("lib");
 Asset asset = new StringAsset(desc.exportAsString());
 ear.delete(node.getPath());
 ear.setApplicationXML(asset);
 return ear;{code} BTW: I HATE this editor. 
