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.
When you have multiple webResource, for example making Angulars with gulp : <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webResources> <resource> <directory>src/main/webapp</directory> </resource> <resource> <directory>src/main/web</directory> <excludes> <exclude>**/*</exclude> </excludes> </resource> <resource> <directory>target/gulp-dist</directory> </resource> </webResources> </configuration> </plugin> First, in the project view, I can see that the order of the showed webapp directories is not necessary the same than if the pom. Each time I reload the project, the order can change. Second, the beans.xml file is normally in src/main/webapp. BUT it's only detected by netbeans when this directory is the first in the project view. Otherwise, netbeans show me errors where I have @inject and propose to create the beans.xml. And for exemple if the first showed directory is target/gulp-dist, netbeans create the beans.xml inside it....
I don't see p1 here
This is a really annoying bug. That's why I putted P1. The beans.xml could contains specific informations and must be in src/main/webapp, not in the others dierctories. So, I readed the code, that what I thinks, but as I'm not a netbeans RCP specialist, I let other people check : In "Context and Dependency Injection support" (web.beans), we have the WebCdiUtil class. Line 79 we have this : WebModule wm = WebModule.getWebModule(project.getProjectDirectory()); So I understand it could check only one WebModule, the code could be easily modified to give back a WebModule array ? For exempel, in org.netbeans.modules.web.api.webmodule.WebModule, add : public static List<WebModule> getWebModules (FileObject file) { List<WebModule> webModules = new ArrayList<WebModule>(); Parameters.notNull("file", file); // NOI18N Iterator it = implementations.allInstances().iterator(); while (it.hasNext()) { WebModuleProvider impl = (WebModuleProvider)it.next(); WebModule wm = impl.findWebModule (file); if (wm != null) { webModules.add(wm); } } return webModules; } And in org.netbeans.modules.web.beans.WebCdiUtil, change method with public Collection<FileObject> getBeansTargetFolder(boolean create) { Project project = getProject(); if (project == null) { return Collections.emptyList(); } List<WebModule> wmList = WebModule.getWebModules(project.getProjectDirectory()); if (wmList != null && wmList.size() > 0) { Collection<FileObject> fileObjects = new ArrayList<>(); for (WebModule wm : wmList) { if (wm != null && wm.getDocumentBase() != null) { FileObject webInf = wm.getWebInf(); if (webInf == null && create) { try { webInf = FileUtil.createFolder(wm.getDocumentBase(), WEB_INF); } catch (IOException ex) { Logger.getLogger(WebCdiUtil.class.getName()).log( Level.WARNING, null, ex); } } fileObjects.add(webInf); } } if (fileObjects.size() > 0) { return fileObjects; } } return super.getBeansTargetFolder(create); }
yes it may be but if look at category cdi, it's some specific use case is broken rather then cdi itself, and no data loss etc. as it's hard to have a product without issues and the same regarding hints, hints should be configurable i/e/ be able to switch off at least. Anyway I like to try to verify next week what you've suggested.
>p2 to be in view for next week
Exactly the same problem with 8.0.2 and filtering in pom.xml: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.3</version> <configuration> <filters> <filter>src/main/resources/${myProfile}/filters/ejb-jar.properties</filter> </filters> <webResources> <resource> <directory>src/main/webapp/WEB-INF</directory> <filtering>true</filtering> <targetPath>WEB-INF</targetPath> <includes> <include>ejb-jar.xml</include> </includes> </resource> </webResources> </configuration> </plugin>
Ordering problem fixed in web-main a1fe45a117cd.
Fixed in web-main d8081985857b.
Integrated into 'main-silver', will be available in build *201504201004* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/a1fe45a117cd User: Petr Hejl <phejl@netbeans.org> Log: #248687 - Multiple Maven WebResources and beans.xml
tested with 201504290001, and works great! thanx