Maven Eclipse Plugin
  1. Maven Eclipse Plugin
  2. MECLIPSE-104

Add the ability to specify source inclusions/exclusions

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.7
    • Component/s: None
    • Labels:
      None

      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

      1. fix-eclipse-classpaths.sh
        0.2 kB
        Cameron Fieber
      2. MECLIPSE-104.patch
        5 kB
        Richard van der Hoff
      3. MECLIPSE-104.patch
        5 kB
        Richard van der Hoff
      4. srcExclusions-patch.zip
        7 kB
        James L. Mitchell

        Issue Links

          Activity

          James Mitchell created issue -
          Lukas Theussl made changes -
          Field Original Value New Value
          Project maven-eclipse-plugin [ 10352 ] Maven 2.x Eclipse Plugin [ 11133 ]
          Workflow jira [ 56391 ] Maven New [ 56490 ]
          Key MPECLIPSE-117 MECLIPSE-104
          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
          Cameron Fieber made changes -
          Attachment fix-eclipse-classpaths.sh [ 24237 ]
          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!
          Richard van der Hoff made changes -
          Attachment MECLIPSE-104.patch [ 34024 ]
          Arnaud HERITIER made changes -
          Assignee Arnaud Heritier [ aheritier ]
          Fix Version/s 2.5.2 [ 14163 ]
          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.
          Barrie Treloar made changes -
          Fix Version/s 2.6 [ 14163 ]
          Fix Version/s 2.7 [ 14813 ]
          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.
          Richard van der Hoff made changes -
          Attachment MECLIPSE-104.patch [ 40941 ]
          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.
          Barrie Treloar made changes -
          Assignee Arnaud Heritier [ aheritier ] Barrie Treloar [ baerrach ]
          Barrie Treloar made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Barrie Treloar made changes -
          Summary Add the ability to specify source exclusions Add the ability to specify source inclusions/exclusions
          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.
          Barrie Treloar made changes -
          Fix Version/s 2.6.1 [ 15130 ]
          Fix Version/s 2.7 [ 14813 ]
          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
          Barrie Treloar made changes -
          Status In Progress [ 3 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Arnaud HERITIER made changes -
          Link This issue supercedes MECLIPSE-538 [ MECLIPSE-538 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 10:00:37 UTC 2015 [ 1428228037919 ]
          Mark Thomas made changes -
          Workflow jira [ 12720524 ] Default workflow, editable Closed status [ 12750915 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 23:47:18 UTC 2015 [ 1428277638729 ]
          Mark Thomas made changes -
          Workflow jira [ 12958046 ] Default workflow, editable Closed status [ 12994879 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open In Progress In Progress
          1065d 12h 42m 1 Barrie Treloar 30/Mar/09 02:19
          In Progress In Progress Closed Closed
          18h 44m 1 Barrie Treloar 30/Mar/09 21:04

            People

            • Assignee:
              Barrie Treloar
              Reporter:
              James Mitchell
            • Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development