You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Doug Patterson <do...@gmx.net> on 2003/06/02 23:51:41 UTC

[PATCH] excluding attribute for Eclipse plugin

The Eclipse plugin creates a .classpath file with tags like:

<classpathentry kind="src" path="src/java">

Eclipse also supports an excluding attribute that filters out any files
matching the supplied pattern. I tweaked plugin.jelly (patch below) to check
for a maven.eclipse.exclude property in project.properties and modify
kind="src" entries accordingly. For example:

maven.eclipse.exclude=**/.svn/*    # Stop Eclipse complaining about Subversion files

Hope this is useful to someone!

Doug

Index: plugin.jelly
===================================================================
RCS file: /home/cvspublic/maven/src/plugins-build/eclipse/plugin.jelly,v
retrieving revision 1.16
diff -u -r1.16 plugin.jelly
--- plugin.jelly 9 May 2003 14:03:58 -0000 1.16
+++ plugin.jelly 2 Jun 2003 20:52:13 -0000
@@ -56,7 +56,10 @@
     description="Generate Eclipse .classpath file">

     <ant:echo>Creating ${basedir}/.classpath ...</ant:echo>
-
+
+    <!-- Check for maven.eclipse.exclude property -->
+    <j:set var="excludeX" value="${maven.eclipse.exclude}X"/>
+
     <j:file name="${basedir}/.classpath" prettyPrint="true" xmlns="dummy">
       <classpath>
         <j:if test="${sourcesPresent}">
@@ -70,7 +73,14 @@
               -->
              <j:set var="srcDir" value="${srcDir.substring(1)}"/>
           </j:if>
-          <classpathentry kind="src" path="${srcDir}"/>
+          <j:choose>
+            <j:when test="${excludeX != 'X'}">
+              <classpathentry kind="src" excluding="${maven.eclipse.exclude}" path="${srcDir}"/>
+            </j:when>
+            <j:otherwise>
+              <classpathentry kind="src" path="${srcDir}"/>
+            </j:otherwise>
+          </j:choose>
         </j:if>

         <j:if test="${unitTestSourcesPresent}">
@@ -82,7 +92,14 @@
              <!-- cut off also slash or backslash -->
              <j:set var="testSrcDir" value="${testSrcDir.substring(1)}"/>
           </j:if>
-          <classpathentry kind="src" path="${testSrcDir}"/>
+          <j:choose>
+            <j:when test="${excludeX != 'X'}">
+              <classpathentry kind="src" excluding="${maven.eclipse.exclude}" path="${testSrcDir}"/>
+            </j:when>
+            <j:otherwise>
+              <classpathentry kind="src" path="${testSrcDir}"/>
+            </j:otherwise>
+          </j:choose>
          <!-- Here are the rules:
               If the project has maven.eclipse.junit property, add that ver of junit
               If the project has maven.eclipse.junit property and it is empty, don't add junit


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [PATCH] excluding attribute for Eclipse plugin

Posted by di...@multitask.com.au.
Hi Dave,

it would be sooooo much easier to apply the patch if it was an attachment, 
or filed in jira. I've created MAVEN-457 from this email.

See http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-457
--
dIon Gillard, Multitask Consulting
Blog:      http://www.freeroller.net/page/dion/Weblog
Work:      http://www.multitask.com.au


"Doug Patterson" <do...@gmx.net> wrote on 03/06/2003 07:51:41 AM:

> The Eclipse plugin creates a .classpath file with tags like:
> 
> <classpathentry kind="src" path="src/java">
> 
> Eclipse also supports an excluding attribute that filters out any files
> matching the supplied pattern. I tweaked plugin.jelly (patch below) to 
check
> for a maven.eclipse.exclude property in project.properties and modify
> kind="src" entries accordingly. For example:
> 
> maven.eclipse.exclude=**/.svn/*    # Stop Eclipse complaining about 
> Subversion files
> 
> Hope this is useful to someone!
> 
> Doug
> 
> Index: plugin.jelly
> ===================================================================
> RCS file: /home/cvspublic/maven/src/plugins-build/eclipse/plugin.jelly,v
> retrieving revision 1.16
> diff -u -r1.16 plugin.jelly
> --- plugin.jelly 9 May 2003 14:03:58 -0000 1.16
> +++ plugin.jelly 2 Jun 2003 20:52:13 -0000
> @@ -56,7 +56,10 @@
>      description="Generate Eclipse .classpath file">
> 
>      <ant:echo>Creating ${basedir}/.classpath ...</ant:echo>
> -
> +
> +    <!-- Check for maven.eclipse.exclude property -->
> +    <j:set var="excludeX" value="${maven.eclipse.exclude}X"/>
> +
>      <j:file name="${basedir}/.classpath" prettyPrint="true" 
xmlns="dummy">
>        <classpath>
>          <j:if test="${sourcesPresent}">
> @@ -70,7 +73,14 @@
>                -->
>               <j:set var="srcDir" value="${srcDir.substring(1)}"/>
>            </j:if>
> -          <classpathentry kind="src" path="${srcDir}"/>
> +          <j:choose>
> +            <j:when test="${excludeX != 'X'}">
> +              <classpathentry kind="src" excluding="${maven.eclipse.
> exclude}" path="${srcDir}"/>
> +            </j:when>
> +            <j:otherwise>
> +              <classpathentry kind="src" path="${srcDir}"/>
> +            </j:otherwise>
> +          </j:choose>
>          </j:if>
> 
>          <j:if test="${unitTestSourcesPresent}">
> @@ -82,7 +92,14 @@
>               <!-- cut off also slash or backslash -->
>               <j:set var="testSrcDir" 
value="${testSrcDir.substring(1)}"/>
>            </j:if>
> -          <classpathentry kind="src" path="${testSrcDir}"/>
> +          <j:choose>
> +            <j:when test="${excludeX != 'X'}">
> +              <classpathentry kind="src" excluding="${maven.eclipse.
> exclude}" path="${testSrcDir}"/>
> +            </j:when>
> +            <j:otherwise>
> +              <classpathentry kind="src" path="${testSrcDir}"/>
> +            </j:otherwise>
> +          </j:choose>
>           <!-- Here are the rules:
               If the project has 
> maven.eclipse.junit property, add that ver of junit
               If 
> the project has maven.eclipse.junit property and it is empty, don't 
> add junit



> ---------------------------------------------------------------------

> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For 
> additional commands, e-mail: dev-help@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org