I am trying to modify the xdoc:copy-user-resources in order to take into
account a user supplied filterset.

My maven.xml defines the following:


<preGoal name="xdoc:copy-user-resources">
  <echo message="preGoal: registering xdoc.copy-user-resources.filterset
filterset"/>
  <ant:filterset>
    <ant:filterset refid="xdoc.copy-user-resources.filterset.id"/>
      <ant:filter token="maven.final.name" value="${maven.final.name}"/>
  </ant:filterset>
</preGoal>

and the following patch is applied to
maven-xdocs-plugin-1.6/plugin.jelly. (note that the attached patch is
built on top of the patch I just sent to the list.)



Here's my output:
[EMAIL PROTECTED]> $MAVEN_HOME/bin/maven xdoc:copy-user-resources
 __  __
|  \/  |__ _Apache__ ___
| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
|_|  |_\__,_|\_/\___|_||_|  v. 1.0-rc2

build:start:

xdoc:init:

xdoc:copy-user-resources:
    [echo] preGoal: registering xdoc.copy-user-resources.filterset
filterset
    [echo] filterset for copy-user-resources goal already exists
    [echo] copying user provided resources to docs destination
    [copy] Copying 1 file to
/home/jerome/Dev/Perso/jset/trunk/target/docs

BUILD FAILED
File......
file:/home/jerome/.maven/plugins/maven-xdoc-plugin-1.6/plugin.jelly
Element... copy
Line...... 610
Column.... 40
Reference xdoc.copy-user-resources.filterset.id not found.
Total time: 6 seconds
Finished at: Tue Apr 13 23:46:22 BOT 2004



According to the debugging echoes, it seems like the filterset is found
by the code added to the beginning of copy-user-resources goal.

But then the filterset reference is not found. 

Is there a mistake from my part, or it that a bug.



Note: In a somewhat related issue, I initially tried to put the code
added to the beginning of the copy-user-resources goal into a separate
goal (e.g. xdoc:init-copy-user-resources-filterset), but I then ended up
having an NPE. Maybe that's another issue to look at.

BUILD FAILED
java.lang.NullPointerException
        at
org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:95)
        at com.werken.werkz.Goal.fire(Goal.java:639)
        at com.werken.werkz.Goal.attain(Goal.java:575)
        at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
        at com.werken.werkz.Goal.attain(Goal.java:573)
        at
com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
        at
org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:531)
        at
org.apache.maven.MavenSession.attainGoals(MavenSession.java:265)
        at org.apache.maven.cli.App.doMain(App.java:466)
        at org.apache.maven.cli.App.main(App.java:1117)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at com.werken.forehead.Forehead.run(Forehead.java:551)
        at com.werken.forehead.Forehead.main(Forehead.java:581)
java.lang.NullPointerException

--- maven-xdoc-plugin-1.6/plugin.jelly.orig     2004-04-13 23:22:13.000000000 -0400
+++ maven-xdoc-plugin-1.6/plugin.jelly  2004-04-13 23:49:41.000000000 -0400
@@ -411,6 +411,9 @@
     <mkdir dir="${maven.gen.docs}"/>
     <mkdir dir="${maven.docs.dest}"/>
 
+    <available file="${maven.docs.src}" type="dir"
+      property="maven.docs.src.available"/>
+
   </goal>
 
   <goal
@@ -465,12 +468,9 @@
   <!-- ================================================================== -->
 
   <!-- validate xdocs -->
-  <goal name="xdoc:validate" prereqs="pom:taglib"
+  <goal name="xdoc:validate" prereqs="pom:taglib,xdoc:init"
     description="Validate xdocs match the schema">
 
-    <available file="${maven.docs.src}" type="dir"
-      property="maven.docs.src.available"/>
-
     <j:if test="${maven.docs.src.available}">
       <fileScanner var="navFiles">
         <fileset dir="${maven.docs.src}">
@@ -543,15 +543,36 @@
   <!-- C O P Y  U S E R  S U P P L I E D  R E S O U R C E S               -->
   <!-- ================================================================== -->
 
-  <!-- copy user resources -->
+  <!-- copy user resources. The xdoc.copy-user-resources.filterset.id filter is used 
if defined, to filter the resources-->
   <goal name="xdoc:copy-user-resources"
     prereqs="xdoc:init"
     description="Copy user provided resources to docs destination">
 
-    <j:if test="${maven.docs.src.available}">
+    <j:set var="filterRefid" value="${xdoc.copy-user-resources.filterset.id}"/>
+<!--
+      <j:if test="${empty filterRefid}">
+        <echo message="creating an empty filterset for copy-user-resources goal" />
+        <j:set var="xdoc.copy-user-resources.filterset.id" value="filterSetId"/>
+        <filterset id="${xdoc.copy-user-resources.filterset.id}"/>
+      </j:if>
+-->
+
+    <j:choose>
+      <j:when test="${empty filterRefid}">
+        <echo message="creating an empty filterset for copy-user-resources goal" />
+        <j:set var="xdoc.copy-user-resources.filterset.id" value="filterSetId"/>
+        <filterset id="xdoc.copy-user-resources.filterset.id"/>
+      </j:when>
+      <j:otherwise>
+        <echo message="filterset for copy-user-resources goal already exists" />
+      </j:otherwise>
+    </j:choose>
 
+    
+    <echo message="copying user provided resources to docs destination"/>
+    <j:if test="${maven.docs.src.available}">
       <!-- Copy user supplied resources -->
-      <copy todir="${maven.docs.dest}" filtering="no">
+      <copy todir="${maven.docs.dest}">
         <fileset dir="${maven.docs.src}">
           <exclude name="**/*.xml"/>
           <exclude name="**/CVS/*"/>
@@ -563,14 +584,16 @@
           <exclude name="**/CVS/*"/>
           <exclude name="stylesheets/*"/>
         </fileset>
+        <filterset refid="xdoc.copy-user-resources.filterset.id" />
       </copy>
 
       <util:available file="${maven.docs.src}/stylesheets">
         <!-- Copy user supplied stylesheets, can override maven -->
-        <copy todir="${maven.docs.dest}/style" overwrite="true" filtering="no">
+        <copy todir="${maven.docs.dest}/style" overwrite="true">
           <fileset dir="${maven.docs.src}/stylesheets">
             <include name="**/*.css"/>
           </fileset>
+        <filterset refid="xdoc.copy-user-resources.filterset.id" />
         </copy>
       </util:available>
  
BUILD FAILED
java.lang.NullPointerException
        at 
org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:95)
        at com.werken.werkz.Goal.fire(Goal.java:639)
        at com.werken.werkz.Goal.attain(Goal.java:575)
        at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
        at com.werken.werkz.Goal.attain(Goal.java:573)
        at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
        at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:531)
        at org.apache.maven.MavenSession.attainGoals(MavenSession.java:265)
        at org.apache.maven.cli.App.doMain(App.java:466)
        at org.apache.maven.cli.App.main(App.java:1117)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at com.werken.forehead.Forehead.run(Forehead.java:551)
        at com.werken.forehead.Forehead.main(Forehead.java:581)
java.lang.NullPointerException

rereqs="dist"/>

  <preGoal name="xdoc:copy-user-resources">
<!--    <echo message="registering xdoc.copy-user-resources.filterset filterset"/>-->
    <ant:filterset>
      <ant:filterset refid="xdoc.copy-user-resources.filterset.id"/>
        <ant:filter token="maven.final.name" value="${maven.final.name}"/>
    </ant:filterset>
  </preGoal>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to