diff -r 19e5bb3a000a maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java --- a/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java Fri May 03 01:07:05 2013 +0200 +++ b/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java Fri May 03 20:51:23 2013 +0800 @@ -216,7 +216,7 @@ // @PSP's and the like, and PackagingProvider impls, may check project lookup for e.g. NbMavenProject, so init lookup in two stages: basicLookup = createBasicLookup(projectState, auxiliary); //here we always load the MavenProject instance because we need to touch the packaging from pom. - completeLookup = LookupProviderSupport.createCompositeLookup(basicLookup, new PackagingTypeDependentLookup(watcher)); + completeLookup = LookupProviderSupport.createCompositeLookup(LookupProviderSupport.createCompositeLookup(basicLookup, new PackagingTypeDependentLookup(watcher)), new ExcludesIncludesLookup(watcher)); } public File getPOMFile() { @@ -741,6 +741,53 @@ } } } + + private static class ExcludesIncludesLookup extends ProxyLookup implements PropertyChangeListener { + + private final NbMavenProject watcher; + private String[] excludes; + private String[] includes; + + @SuppressWarnings("LeakingThisInConstructor") + ExcludesIncludesLookup(NbMavenProject watcher) { + this.watcher = watcher; + + MavenProject mp = watcher.getMavenProject(); + + excludes = PluginPropertyUtils.getPluginPropertyList(mp, Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_COMPILER, "excludes", "exclude", null); + includes = PluginPropertyUtils.getPluginPropertyList(mp, Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_COMPILER, "includes", "include", null); + + check(); + watcher.addPropertyChangeListener(this); + } + + private void check() { + MavenProject mp = watcher.getMavenProject(); + + String[] excludes = PluginPropertyUtils.getPluginPropertyList(mp, Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_COMPILER, "excludes", "exclude", null); + String[] includes = PluginPropertyUtils.getPluginPropertyList(mp, Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_COMPILER, "includes", "include", null); + + if (!Arrays.equals(this.includes, includes) || !Arrays.equals(this.excludes, excludes)) { + this.includes = includes; + this.excludes = excludes; + + RELOAD_RP.post(new Runnable() { + @Override + public void run() { + FileObject file = FileUtilities.convertStringToFileObject(watcher.getMavenProject().getBuild().getSourceDirectory()); + MavenVisibilityQueryImplementation.visibilityChanged(new FileObject[]{file}); + } + }); + } + } + + public @Override + void propertyChange(PropertyChangeEvent evt) { + if (NbMavenProjectImpl.PROP_PROJECT.equals(evt.getPropertyName())) { + check(); + } + } + } private Lookup createBasicLookup(ProjectState state, M2AuxilaryConfigImpl auxiliary) { return Lookups.fixed(