Issue Details (XML | Word | Printable)

Key: MECLIPSE-104
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Barrie Treloar
Reporter: James Mitchell
Votes: 3
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Maven 2.x Eclipse Plugin

Add the ability to specify source inclusions/exclusions

Created: 29/Apr/06 12:37 PM   Updated: 15/Apr/09 04:23 PM   Resolved: 30/Mar/09 08:04 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: 2.7

Time Tracking:
Not Specified

File Attachments: 1. File fix-eclipse-classpaths.sh (0.2 kB)
2. Text File MECLIPSE-104.patch (5 kB)
3. Text File MECLIPSE-104.patch (5 kB)
4. Zip Archive srcExclusions-patch.zip (7 kB)

Issue Links:
Supercedes
 

Testcase included: yes


 Description  « Hide

When source files contain scm information (*/.svn/* or */CVS/*), which is pretty much a given, there's currently no way to specify that those directories be excluded except through the GUI. This isn't so much of a problem except that the next time a change is needed and this plugin is ran, it will overwrite this exclusion and will force me to exclude it, by hand, again.

The above case is the driving reason why I decided to get involved and help out. So, I have written everything (I think) that is needed for this enhancement including, adding to the javadoc, creating a new test that verifies this enhancement, and fully testing this with my own projects (many of them @ Struts). If there is anything else I need to do as far as site documentation, please tell me where it is and I'll add it.

This is my first patch to Maven. If this sucks, please don't ignore it, just say 'it sucks, no thanks" and I'll go about working on something else.

Thanks so much for your attention.


James Mitchell



Lukas Theussl made changes - 02/May/06 07:06 PM
Field Original Value New Value
Project maven-eclipse-plugin [ 10352 ] Maven 2.x Eclipse Plugin [ 11133 ]
Key MPECLIPSE-117 MECLIPSE-104
Workflow jira [ 56391 ] Maven New [ 56490 ]
Cameron Fieber added a comment - 22/Nov/06 01:39 PM

I wouldn't mind seeing this one fixed if it's easy.

In the meantime I'm attaching a simple shell script I use to add the exclusion for the .svn directory to the generated .classpath files. It should be easy enough to modify if you use CVS


Cameron Fieber made changes - 22/Nov/06 01:39 PM
Attachment fix-eclipse-classpaths.sh [ 24237 ]
James Mitchell added a comment - 22/Nov/06 08:56 PM

The patch I provided is probably useless at this point, there's been so much refactoring since I did this.

Oh well, can't say I didn't try.

BTW – Thanks for the script!


Cameron Fieber added a comment - 16/Feb/07 12:00 PM

Two things:

1) the script I provided will bork your .classpath files by adding an extra excluding= attribute on the classpathentry elements for resource directories. I could fix that but..

2) Under Window/Preferences... Java>Compiler>Building there is an Output folder expandable section. Under there there is an entry for Filtered resources. Just add the appropriate filter for your SCM.


Richard van der Hoff added a comment - 21/Apr/08 09:05 AM

An updated version of the patch.

It's pretty trivial, so it would be nice if it could be applied before it bitrots this time!


Richard van der Hoff made changes - 21/Apr/08 09:05 AM
Attachment MECLIPSE-104.patch [ 34024 ]
Arnaud Heritier made changes - 21/Apr/08 09:13 AM
Assignee Arnaud Heritier [ aheritier ]
Fix Version/s 2.5.2 [ 14163 ]
Barrie Treloar added a comment - 15/Dec/08 09:44 PM - edited

Can you try the latest snapshot please?

Source exclusions can be specified with the excludes tag in the configuration section for the eclipse plugin.
Correction source exclusions are still not possible EclipsePlugin.extractSourceDirs() does not pass through any values for includes/excludes.

Resource exclusions are specified via normal pom syntax for resources.

However the default behavior of the classpath writer is to specify an includes of */.java for source directories and therefore your .svn and CVS directories will never match this.

I would need to know more details about the problem you are facing, but I think the current behavior should be acceptable and we can mark this as already fixed.


Barrie Treloar made changes - 18/Dec/08 02:17 AM
Fix Version/s 2.6 [ 14163 ]
Fix Version/s 2.7 [ 14813 ]
Richard van der Hoff added a comment - 25/Mar/09 07:24 PM

The problem I am facing is that some of the .java files in my source tree won't build against the dependency versions maven chooses for me.

Unfortunately fixing this isn't an option. It would require moving lots of stuff around in CVS which I really don't have time for.

The compiler plugin allows me to exclude classes with the <excludes> tag. It therefore seems to make sense for the eclipse plugin to do so as well.


Richard van der Hoff added a comment - 25/Mar/09 08:13 PM

Here is yet another version of this patch, updated to trunk as of 2009-03-26.


Richard van der Hoff made changes - 25/Mar/09 08:13 PM
Attachment MECLIPSE-104.patch [ 40941 ]
Barrie Treloar added a comment - 25/Mar/09 08:26 PM

Have you tried 2.6-SNAPSHOT, or the proposed release 2.6?

MECLIPSE-443 has added includes ="***.java" to the classpath entry - which will do a similar thing, i.e constrain the source folder to only use .java files.


Richard van der Hoff added a comment - 26/Mar/09 10:29 AM

Yes - just before patching the proposed 2.6 to fix the problem and uploading the patch here.

As I mentioned before, I need to exclude some .java files from my build; including only "*/.java" is therefore insufficient to resolve the issue.


Barrie Treloar made changes - 29/Mar/09 08:35 PM
Assignee Arnaud Heritier [ aheritier ] Barrie Treloar [ baerrach ]
Barrie Treloar made changes - 30/Mar/09 01:19 AM
Status Open [ 1 ] In Progress [ 3 ]
Barrie Treloar made changes - 30/Mar/09 01:21 AM
Summary Add the ability to specify source exclusions Add the ability to specify source inclusions/exclusions
Barrie Treloar added a comment - 30/Mar/09 01:26 AM

Committed to trunk for 2.6.1

The configuration for EclipsePlugin now accepts
<sourceInclusions>
<sourceInclusion>XXX</sourceInclusion>
<sourceInclusions>
(same for sourceExclusions)

to modifiy the classpath entries for source directories.

*/.java is always added if it is a java (or pde) project
*/.aj is always added if it is an ajdt project.


Barrie Treloar made changes - 30/Mar/09 01:26 AM
Fix Version/s 2.7 [ 14813 ]
Fix Version/s 2.6.1 [ 15130 ]
Barrie Treloar added a comment - 30/Mar/09 01:27 AM

Still need to add documentation before I close this.


Barrie Treloar added a comment - 30/Mar/09 08:04 PM

Site documentation added


Barrie Treloar made changes - 30/Mar/09 08:04 PM
Resolution Fixed [ 1 ]
Status In Progress [ 3 ] Closed [ 6 ]
Arnaud Heritier made changes - 15/Apr/09 04:23 PM
Link This issue supercedes MECLIPSE-538 [ MECLIPSE-538 ]