Maven 2.x Eclipse Plugin

Add the ability to specify source inclusions/exclusions

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.7
  • Component/s: None
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    4

Description

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

Issue Links

Activity

Hide
Cameron Fieber added a comment -

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

Show
Cameron Fieber added a comment - 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
Hide
James Mitchell added a comment -

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!

Show
James Mitchell added a comment - 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!
Hide
Cameron Fieber added a comment -

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.

Show
Cameron Fieber added a comment - 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.
Hide
Richard van der Hoff added a comment -

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!

Show
Richard van der Hoff added a comment - 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!
Hide
Barrie Treloar added a comment - - 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.

Show
Barrie Treloar added a comment - - 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.
Hide
Richard van der Hoff added a comment -

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.

Show
Richard van der Hoff added a comment - 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.
Hide
Richard van der Hoff added a comment -

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

Show
Richard van der Hoff added a comment - Here is yet another version of this patch, updated to trunk as of 2009-03-26.
Hide
Barrie Treloar added a comment -

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.

Show
Barrie Treloar added a comment - 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.
Hide
Richard van der Hoff added a comment -

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.

Show
Richard van der Hoff added a comment - 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.
Hide
Barrie Treloar added a comment -

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.

Show
Barrie Treloar added a comment - 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.
Hide
Barrie Treloar added a comment -

Still need to add documentation before I close this.

Show
Barrie Treloar added a comment - Still need to add documentation before I close this.
Hide
Barrie Treloar added a comment -

Site documentation added

Show
Barrie Treloar added a comment - Site documentation added

People

Vote (3)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: