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.

Bug 245520 - Additional web roots should not be shown in Other Sources
Summary: Additional web roots should not be shown in Other Sources
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.0.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-09 12:59 UTC by Martin Janicek
Modified: 2014-07-16 01:45 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Potential fix (9.86 KB, patch)
2014-07-10 14:09 UTC, Martin Janicek
Details | Diff
Updated fix (11.21 KB, patch)
2014-07-14 11:41 UTC, Martin Janicek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Janicek 2014-07-09 12:59:21 UTC
See desc. When someone define additional Web resources in maven-war-plugin:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <version>2.4</version>
  <configuration>
    <webResources>
      <resource>
        <directory>src/main/resources/production/webapp</directory>
      </resource>
    </webResources>
  </configuration>
</plugin>

Those additional web roots are shown separately in another Web Pages nodes and thus they shouldn't be listed in Other Sources node.

For the proper fix we will need to enhance OtherSourcesExclude from core-maven to allow more than single folder for exclusion.
Comment 1 Martin Janicek 2014-07-10 14:09:04 UTC
Created attachment 147974 [details]
Potential fix

Attaching patch with potential fix. Quick summarization:

- The signature of core Maven OtherSourcesExclude (friend SPI class) has been changed and now it provides a list of Path that should be excluded in Other Sources
- Both current implementation were changed to adapt the interface changes
- NbMavenProjectImpl is implementing FileVisitor to check whole tree of sub-folders, not only direct children of src/main
Comment 2 Martin Janicek 2014-07-10 14:11:06 UTC
CCing TomasS as an owner of the core maven module. Tomasi, could you please check if the changes are fine for you? Thanks in advance!
Comment 3 Tomas Stupka 2014-07-14 09:07:29 UTC
see MavenSourcesImpl.excludedFolders() 
is it guaranteed that 
project().getProjectDirectory().getFileObject("src/main/java")
always returns a FO?
Comment 4 Martin Janicek 2014-07-14 09:08:44 UTC
It is not! Thanks for the catch, I will improve the patch
Comment 5 Martin Janicek 2014-07-14 11:41:36 UTC
Created attachment 148030 [details]
Updated fix

Few updates:
- Excluding both src/main/java and src/test/java
- NPE check for standardly excluded folders (it is common for certain types of Maven projects that e.g. src/main/java might not exist)
- Skipping folders from the same sub-tree to avoid duplication in Other Sources node (I found that issue while testing other changes)


Tomasi if something looks strange to you, feel free to ask. Otherwise I will push the changes tomorrow and ask someone from QA to test basic behavior which might be affected by the fix (I tested most of Maven project types and they seems to be working the same way as before).
Comment 6 Martin Janicek 2014-07-15 08:06:50 UTC
Fixed by change-set: web-main #3efde7ab7fff
Comment 7 Quality Engineering 2014-07-16 01:45:02 UTC
Integrated into 'main-silver', will be available in build *201407160001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/3efde7ab7fff
User: Martin Janicek <mjanicek@netbeans.org>
Log: #245520 - Additional web roots should not be shown in Other Sources