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 99588

Summary: Honor maven-compiler-plugin excludes
Product: projects Reporter: Milos Kleint <mkleint>
Component: MavenAssignee: Tomas Stupka <tstupka>
Status: RESOLVED WONTFIX    
Severity: blocker CC: jstiepel, windli
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 195928, 201235    
Bug Blocks: 49026    
Attachments: Patch to filter java files according to maven-compiler-plugin excludes/includes
Patch to filter java files according to maven-compiler-plugin excludes/includes
Add property change listener
Patch to filter java files according to maven-compiler-plugin excludes/includes, updated to run on Windows

Description Milos Kleint 2007-03-30 21:48:01 UTC
the maven plugin ignores the list of exclude in the compiler setting of the
pom.xml still showing the files in the editor while they are in many ways not
part of the project.
Comment 1 Jesse Glick 2007-03-31 00:30:31 UTC
I guess this is a facet of issue #49026?
Comment 2 Milos Kleint 2007-04-02 09:19:27 UTC
6.0 for the backbone project support, future for the UI to set it. Not a
mainstream maven project setup
Comment 3 Milos Kleint 2007-10-30 14:42:22 UTC
unfortunately ->future
Comment 4 Jaroslav Pospisil 2009-06-11 12:53:48 UTC
Milos, could you please evaluate, if this issue is still valid or it was already fixed? 
Comment 5 Milos Kleint 2009-06-11 13:09:54 UTC
still valid, however unlikely to be worked on in 6.8. Rather complex coding for a clear corner case.
Comment 6 Antonin Nebuzelsky 2010-04-08 12:05:50 UTC
Change of the default owner.
Comment 7 Jesse Glick 2010-08-16 20:29:01 UTC
Hard to find any uses: http://google.com/codesearch?q=file%3Apom.xml+%3Cexcludes%3E

I did come across one by accident: https://jsp.dev.java.net/svn/jsp/tags/jsp-impl-2.2.1/pom.xml

<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <excludes>
            <exclude>
                org/apache/jasper/compiler/JDTJavaCompiler.java
            </exclude>
            <exclude>
                org/apache/jasper/compiler/AntJavaCompiler.java
            </exclude>
        </excludes>
    </configuration>
</plugin>

The two source files are uncompilable unless you uncomment a couple of dependencies in the POM. Not clear it is worth the trouble of supporting this.
Comment 8 Quality Engineering 2010-08-18 03:22:08 UTC
Integrated into 'main-golden', will be available in build *201008180001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/338e0996e774
User: Jesse Glick <jglick@netbeans.org>
Log: Cleaning up some dead code apparently intended to support #99588 (excludes) but likely unworkable as written.
Comment 9 Jesse Glick 2011-05-06 11:29:55 UTC
*** Bug 198363 has been marked as a duplicate of this bug. ***
Comment 10 Miko95 2012-03-21 10:58:32 UTC
Is the issue resolved? Is there a workaround to let Netbeans exclude certain files?
Comment 11 Jesse Glick 2012-03-26 23:22:10 UTC
(In reply to comment #10)
> Is the issue resolved?

No.

> Is there a workaround to let Netbeans exclude certain files?

No, other than to move them out of src/{main,test}/java/ into (say) another project.
Comment 12 ky6uHETc 2012-06-03 12:03:13 UTC
when do you plan to fix this bug?
Comment 13 Jesse Glick 2012-06-04 19:34:45 UTC
Not in 7.2. Worth trying for the subsequent release; TBD if it would cause regressions for people using excludes for other purposes.
Comment 14 windli 2013-05-03 02:36:21 UTC
Created attachment 134068 [details]
Patch to filter java files according to maven-compiler-plugin excludes/includes

I create a patch to MavenVisibilityQueryImplementation to support filter java files for a big project. We create different pom files for different developers who works on different part of the code. Each have a working version for their components. They can build and deploy they components. This save a lot of time we wasting in building and deploying.

Known issue: I don't know how to handle to change listener yet, so that you need to close and reopen the pom if you change excludes/includes.

Regards
Wind
Comment 15 Milos Kleint 2013-05-03 07:28:46 UTC
windli: thanks for the patch, unfortunately it's not a complete solution. The visibility query will only make the java file nodes disappear from the UI. But as can be seen in the revert referenced from Comment 8, the hard part is excluding/including on project's classpath.


> Known issue: I don't know how to handle to change listener yet, so that you
> need to close and reopen the pom if you change excludes/includes.

should be fairly easy, add a PropertyChangeListener to NbMavenProject (as looked up from project's lookup) and fire ChangeEvent if includes/excludes change after project reload.
Comment 16 Milos Kleint 2013-05-03 07:31:19 UTC
the reason why it's not implemented yet is that excludes are fairly rare in maven world, it's more or less an anti-pattern. If you use them, you most likely have a problem with multi-project structuring.
Comment 17 windli 2013-05-03 12:50:00 UTC
Created attachment 134082 [details]
Patch to filter java files according to maven-compiler-plugin excludes/includes
Comment 18 windli 2013-05-03 12:53:15 UTC
Created attachment 134083 [details]
Add property change listener

Add property change listener to refresh project after excludes/includes changed.
Comment 19 windli 2013-05-03 13:01:20 UTC
(In reply to comment #15)
> windli: thanks for the patch, unfortunately it's not a complete solution. The
> visibility query will only make the java file nodes disappear from the UI. But
> as can be seen in the revert referenced from Comment 8, the hard part is
> excluding/including on project's classpath.
The files will be excluded/included in the project's classpath if you correctly set the excludes/includes configuration for maven-compiler-plugin.


(In reply to comment #16)
> the reason why it's not implemented yet is that excludes are fairly rare in
> maven world, it's more or less an anti-pattern. If you use them, you most
> likely have a problem with multi-project structuring.
It's one of really helpful features in maven to support complex projects in real world.
In my case, we are working on a big project. Compile and deploy the whole project will take up to 20 minutes. But using this features, we can create different set of maven pom files for developers working on different part of the project. They can compile and deploy only the subset of the project. This can result in 2 minutes compile and deploy, save up to 90%.
Comment 20 Milos Kleint 2013-05-05 09:30:45 UTC
(In reply to comment #19)
> (In reply to comment #15)
> > windli: thanks for the patch, unfortunately it's not a complete solution. The
> > visibility query will only make the java file nodes disappear from the UI. But
> > as can be seen in the revert referenced from Comment 8, the hard part is
> > excluding/including on project's classpath.
> The files will be excluded/included in the project's classpath if you correctly
> set the excludes/includes configuration for maven-compiler-plugin.
> 

For maven yes, but not for the IDE itself, so you will see all the excluded classes in code completion, refactorings and elsewhere.
Comment 21 windli 2013-05-06 02:46:20 UTC
(In reply to comment #20)
> (In reply to comment #19)
> > (In reply to comment #15)
> > > windli: thanks for the patch, unfortunately it's not a complete solution. The
> > > visibility query will only make the java file nodes disappear from the UI. But
> > > as can be seen in the revert referenced from Comment 8, the hard part is
> > > excluding/including on project's classpath.
> > The files will be excluded/included in the project's classpath if you correctly
> > set the excludes/includes configuration for maven-compiler-plugin.
> > 
> 
> For maven yes, but not for the IDE itself, so you will see all the excluded
> classes in code completion, refactorings and elsewhere.

For IDE itself, per my test, I can only see the excluded classes in code completion. But not in Find usages, refactorings and even search.
Comment 22 windli 2013-05-07 12:56:37 UTC
Created attachment 134185 [details]
Patch to filter java files according to maven-compiler-plugin excludes/includes, updated to run on Windows
Comment 23 Milos Kleint 2013-05-13 14:18:50 UTC
(In reply to comment #22)
> Created attachment 134185 [details]
> Patch to filter java files according to maven-compiler-plugin
> excludes/includes, updated to run on Windows

The patch looks ok, but I'm not willing to integrate it as is, without the classpath filtering (that's the correct way of dealing with project's Classpath). At least not as default behaviour. We could hide the VisibilityQueryImplementation behing a system property that you and your team could set.
Comment 24 windli 2013-05-15 05:25:56 UTC
(In reply to comment #23)
> (In reply to comment #22)
> > Created attachment 134185 [details]
> > Patch to filter java files according to maven-compiler-plugin
> > excludes/includes, updated to run on Windows
> 
> The patch looks ok, but I'm not willing to integrate it as is, without the
> classpath filtering (that's the correct way of dealing with project's
> Classpath). At least not as default behaviour. We could hide the
> VisibilityQueryImplementation behing a system property that you and your team
> could set.

Thank you. That will be great.
Is it possible to add an option to the maven setting?
Comment 25 Martin Balin 2016-07-07 08:37:49 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss