Andy Jefferson wrote:
I've looked at the template ... and sadly everything useful is obfuscated out elsewhere. In Maven we have goals which do things particular to particular aspects of the software ... in this template it wants to copy blocks of text the same for every goal (why ? all of the common stuff could have gone in a Maven "init" goal and have this as the prereq of the other goals). If I want to modify something for the jdodoclet goal I don't want to change things for the ejbdoclet goal for example. How do I trace back to the individual goal ?

[...]


c). There are inherent dependencies in XDoclet and it should load its own dependencies itself (at the moment users have to put all sorts of seemingly random dependencies of xdoclet jars in their project.xml, which is wrong) ... The plugin does this with lines like setting up the classpath to include
<pathelement path="${plugin.getDependencyPath('xdoclet+xjavadoc')}"/>
however it ignores things like ejbdoclet at the moment. I want to do this differently for each goal (no point loading ejbdoclet in the jdodoclet goal !) ... the template won't currently allow that as it is now.

Hello!


I'm new to both maven and XDoclet. When I encountered problems with
using both, instead of getting bad habits using current version of maven-xdoclet-plugin I've tried to fix some things ;)


If I'm wrong please correct me - as I was saying, I'm a greenhorn :)

Setting XDoclet dependencies was quite frustrating. Especially, that my project doesn't depend on XDoclet. What IS depending on XDoclet is XDoclet plugin. So all dependencies for plugin should be listed in plugin's project.xml. This means, that all xdoclet-some-module.jar must be listed, no matter which task will be called. This is the same problem you mention.

I think, that because different XDoclet tasks are parts of the same plugin it just must stay this way. Single task may depend on only some modules, but plugin just depends on all of them.

I'm not sure why XDoxlet dependicies are set in form:

<id>xdoclet+some-module</id>

Shouldn't it be set like this?

<groupId>xdoclet</groupId>
<artifactId>xdoclet-some-module</artifactId>

I think that this dependencies should also be made available for Ant classloader by using form:

<dependency>
    ...
    <properties>
        <classloader>root</classloader>
    </properties>
</dependency>

Then, the plugin.jelly doesn't need ANY classpath entries in taskdefs.

This produces one problem, the plugins project.xml must also list j2ee dependency, since at least ejb-doclet depends on this. I'm not sure if this is a good approach, maybe this can be changed somehow?

I attach my versions of plugin's project.xml (xdoclet/maven/project.xml) and mavenplugin.xdt (xdoclet/modules/xdoclet/src/xdoclet/modules/maven/resources/mavenplugin.xdt)

Note, that classpath entries were removed and plugin explicitely depends on j2ee-1.4.jar. This plugin after compilation no longer requires any XDoclet dependencies to be set in project descriptor.

Also the jar file for xjavadoc must be now placed in repository under:
.maven/repository/xdoclet/jars/xjavadoc-1.0.1.jar (instead of old location .maven/repository/xdoclet/jars/xdoclet-xjavadoc-1.0.1.jar).


All comments are welcome.

--
_____________________________________________
Lukasz Piestrzeniewicz
Junior System Engineer
Ericpol Telecom sp. z o.o.
Targowa 9A, 90-042 Lodz, Poland
e-mail: [EMAIL PROTECTED]
mobile: +48 504488735
tel: +48 42 6353619
fax: +48 42 6315555
http://www.ericpol.pl/
_____________________________________________
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>

    <pomVersion>3</pomVersion>
    <id>maven-xdoclet-plugin</id>
    <name>Maven XDoclet Plug-in</name>
    <currentVersion>@XDOCLET_VERSION@</currentVersion>
    <organization>
        <name>Apache Software Foundation</name>
        <url>http://jakarta.apache.org/</url>
        <logo>http://jakarta.apache.org/turbine/maven/images/jakarta-logo-blue.gif</logo>
    </organization>
    <inceptionYear>2002</inceptionYear>
    <package>org.apache.maven</package>
    <logo>http://jakarta.apache.org/turbine/maven/images/maven.jpg</logo>

    <description>
    A Maven plugin to run XDoclet from within Maven
    </description>

    <shortDescription>A Maven plugin to run XDoclet from within Maven</shortDescription>

    <url>http://jakarta.apache.org/turbine/maven/reference/plugins/xdoclet/</url>
    <issueTrackingUrl>http://nagoya.apache.org/scarab/servlet/scarab/</issueTrackingUrl>
    <siteAddress>jakarta.apache.org</siteAddress>
    <siteDirectory>/www/jakarta.apache.org/turbine/maven/reference/plugins/xdoclet/</siteDirectory>
    <distributionDirectory>/www/jakarta.apache.org/builds/jakarta-turbine-maven/</distributionDirectory>

    <repository>
        <connection>scm:cvs:pserver:[EMAIL PROTECTED]:/home/cvspublic:jakarta-turbine-maven/src/plugins-build/xdoclet/</connection>
        <url>http://cvs.apache.org/viewcvs/jakarta-turbine-maven/src/plugins-build/xdoclet/</url>
    </repository>

    <developers>
        <developer>
            <name>Ara Abrahamian</name>
            <id>ara_e_w</id>
            <email>[EMAIL PROTECTED]</email>
            <organization></organization>
            <roles>
                <role>Java Developer</role>
            </roles>
        </developer>

        <developer>
            <name>Aslak Helles�y</name>
            <id>rinkrank</id>
            <organization>ThoughtWorks</organization>
            <roles>
                <role>Java Developer</role>
            </roles>
        </developer>
    </developers>

    <dependencies>
        <dependency>
            <artifactId>commons-collections</artifactId>
            <version>2.1</version>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <artifactId>commons-logging</artifactId>
            <version>1.1-dev</version>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <artifactId>log4j</artifactId>
            <version>1.2.8</version>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-apache-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-bea-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-borland-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-caucho-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-ejb-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-exolab-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-hibernate-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-hp-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-ibm-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-java-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-jboss-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-jdo-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-jmx-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-libelis-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-macromedia-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-mockobjects-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-mvcsoft-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-mx4j-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-objectweb-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-oracle-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-orion-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-pramati-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-solarmetric-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-sun-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-sybase-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-tjdo-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-web-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-webwork-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xdoclet-xdoclet-module</artifactId>
            <version>@XDOCLET_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>xdoclet</groupId>
            <artifactId>xjavadoc</artifactId>
            <version>@XJAVADOC_VERSION@</version>
            <url>http://xdoclet.sourceforge.net/</url>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
        <dependency>
            <groupId>j2ee</groupId>
            <artifactId>j2ee</artifactId>
            <version>1.4</version>
            <properties>
                <classloader>root</classloader>
            </properties>
        </dependency>
    </dependencies>

    <build>

        <nagEmailAddress>[EMAIL PROTECTED]</nagEmailAddress>

    </build>
</project>

<?xml version="1.0" encoding="ISO-8859-1"?>

<project
    xmlns:j="jelly:core"
    xmlns:jelxml="jelly:xml"
    xmlns:jelant="jelly:ant"
    xmlns:maven="jelly:maven"
    xmlns:m="maven">

   <XDtMavenplugin:forAllTasks>
    <goal
        description="<XDtMavenplugin:elementName/>"
        name="xdoclet:<XDtMavenplugin:elementName/>">

        <taskdef name="<XDtMavenplugin:elementName/>" classname="<XDtClass:fullClassName/>"/>

        <<XDtMavenplugin:elementName/>>
         <XDtMethod:forAllMethods superclasses="true">
          <XDtMethod:ifIsPublic>
          <XDtMethod:ifIsSetter>
          <XDtMethod:ifDoesntHaveMethodTag tagName="ant.ignore">
            <jelant:setProperty name="<XDtMethod:propertyName/>" value="${maven.xdoclet.<XDtMavenplugin:elementName/>.<XDtMethod:propertyName/>}"/>
          </XDtMethod:ifDoesntHaveMethodTag>
          </XDtMethod:ifIsSetter>
          </XDtMethod:ifIsPublic>
         </XDtMethod:forAllMethods>

		 <XDtMavenplugin:ifHasSubElements>
      <XDtMavenplugin:forAllSubElements>
       <XDtMavenplugin:ifIsASubTask>

            <j:set var="subelement_index" value="0"/>
            <j:forEach begin="0" end="20" indexVar="subelement_index">
              <j:set var="subelement_index_var_name" value="maven.xdoclet.<XDtMavenplugin:elementName/>.<XDtMavenplugin:subElementName/>.${subelement_index}"/>
              <j:if test="${context.getVariable(subelement_index_var_name) == 'true'}">
                <<XDtMavenplugin:subElementName/>>
                 <XDtMethod:forAllMethods superclasses="true">
                  <XDtMethod:ifIsPublic>
                   <XDtMavenplugin:ifIsANestedElement>
                     <XDtClass:setMatchValue value="<XDtMavenplugin:nestedElementName/>">
                     <XDtClass:pushClass value="<XDtMavenplugin:nestedElementType/>">
                     <XDtType:ifIsOfType type="org.apache.tools.ant.types.EnumeratedAttribute">
					<j:set var="prop_name" value="maven.xdoclet.<XDtMavenplugin:elementName/>.<XDtMavenplugin:subElementName/>.${subelement_index}.<XDtClass:matchValue/>"/>
					<jelant:setProperty name="<XDtClass:matchValue/>" value="${context.getVariable(prop_name)}"/>
                     </XDtType:ifIsOfType>
                     <XDtType:ifIsNotOfType type="org.apache.tools.ant.types.EnumeratedAttribute">
                <j:set var="nested_element_index" value="0"/>
                <j:forEach begin="0" end="10" indexVar="nested_element_index">
                    <j:set var="prop_name" value="maven.xdoclet.<XDtMavenplugin:elementName/>.<XDtMavenplugin:subElementName/>.${subelement_index}.<XDtClass:matchValue/>.${nested_element_index}"/>
                    <j:if test="${context.getVariable(prop_name) != null}">
                    <<XDtClass:matchValue/>>
                      <XDtMethod:forAllMethods superclasses="true">
                       <XDtMethod:ifIsPublic>
                       <XDtMethod:ifIsSetter>
                        <j:set var="prop_name" value="maven.xdoclet.<XDtMavenplugin:elementName/>.<XDtMavenplugin:subElementName/>.${subelement_index}.<XDtClass:matchValue/>.${nested_element_index}.<XDtMethod:propertyName/>"/>
                        <jelant:setProperty name="<XDtMethod:propertyName/>" value="${context.getVariable(prop_name)}"/>
                       </XDtMethod:ifIsSetter>
                       </XDtMethod:ifIsPublic>
                      </XDtMethod:forAllMethods>
                    </<XDtClass:matchValue/>>
                    </j:if>
                </j:forEach>
                     </XDtType:ifIsNotOfType>
                     </XDtClass:pushClass>
                     </XDtClass:setMatchValue>

                   </XDtMavenplugin:ifIsANestedElement>
                   <XDtMavenplugin:ifIsNotANestedElement>
                   <XDtMethod:ifIsSetter>
                    <j:set var="prop_name" value="maven.xdoclet.<XDtMavenplugin:elementName/>.<XDtMavenplugin:subElementName/>.${subelement_index}.<XDtMethod:propertyName/>"/>
                    <jelant:setProperty name="<XDtMethod:propertyName/>" value="${context.getVariable(prop_name)}"/>
                   </XDtMethod:ifIsSetter>
                   </XDtMavenplugin:ifIsNotANestedElement>
                  </XDtMethod:ifIsPublic>
                 </XDtMethod:forAllMethods>>
                </<XDtMavenplugin:subElementName/>>
              </j:if>
            </j:forEach>

       </XDtMavenplugin:ifIsASubTask>
       <XDtMavenplugin:ifIsNotASubTask>
        <XDtMavenplugin:ifIsAFileSet>
            <j:set var="fileset_index" value="0"/>
            <j:forEach begin="0" end="10" indexVar="fileset_index">
                <j:set var="fileset_index_var_name" value="maven.xdoclet.<XDtMavenplugin:elementName/>.fileset.${fileset_index}"/>
                <j:if test="${context.getVariable(fileset_index_var_name) != null}">
                    <fileset dir="${pom.build.sourceDirectory}">
                        <j:set var="fileset_index_include_var_name" value="maven.xdoclet.<XDtMavenplugin:elementName/>.fileset.${fileset_index}.include"/>
                        <j:set var="fileset_index_exclude_var_name" value="maven.xdoclet.<XDtMavenplugin:elementName/>.fileset.${fileset_index}.exclude"/>
                        <j:if test="${context.getVariable(fileset_index_include_var_name) != null}">
                            <include name="${context.getVariable(fileset_index_include_var_name)}"/>
                        </j:if>
                        <j:if test="${context.getVariable(fileset_index_exclude_var_name) != null}">
                            <exclude name="${context.getVariable(fileset_index_exclude_var_name)}"/>
                        </j:if>
                    </fileset>
                </j:if>
            </j:forEach>
        </XDtMavenplugin:ifIsAFileSet>
        <XDtMavenplugin:ifIsNotAFileSet>

            <j:set var="subelement_index" value="0"/>
            <j:forEach begin="0" end="20" indexVar="subelement_index">
              <j:set var="subelement_index_var_name" value="maven.xdoclet.<XDtMavenplugin:elementName/>.<XDtMavenplugin:subElementName/>.${subelement_index}"/>
              <j:if test="${context.getVariable(subelement_index_var_name) != null}">
                <<XDtMavenplugin:subElementName/>>
                 <XDtMethod:forAllMethods superclasses="true">
                  <XDtMethod:ifIsPublic>
                       <XDtMethod:ifIsSetter>
                        <j:set var="subelement_index_var_name" value="maven.xdoclet.<XDtMavenplugin:elementName/>.<XDtMavenplugin:subElementName/>.${subelement_index}.<XDtMethod:propertyName/>"/>
                        <jelant:setProperty name="<XDtMethod:propertyName/>" value="${context.getVariable(subelement_index_var_name)}"/>
                       </XDtMethod:ifIsSetter>
                  </XDtMethod:ifIsPublic>
                 </XDtMethod:forAllMethods>
                </<XDtMavenplugin:subElementName/>>
              </j:if>
            </j:forEach>

        </XDtMavenplugin:ifIsNotAFileSet>
       </XDtMavenplugin:ifIsNotASubTask>

      </XDtMavenplugin:forAllSubElements>
     </XDtMavenplugin:ifHasSubElements>

        </<XDtMavenplugin:elementName/>>

        <!--
        In order to make it easier for the user of the XDoclet plugin, we automatically add the
        destination folder to the compile path. This way, people don't have to deal with maven:addPath in their own
        maven.xml scripts. This has been tested with Maven from CVS HEAD on 2002.12.15. (AH)
        -->
        <path id="<XDtMavenplugin:elementName/>.java.compile.src.set" location="${maven.xdoclet.<XDtMavenplugin:elementName/>.destDir}"/>
        <maven:addPath id="maven.compile.src.set" refid="<XDtMavenplugin:elementName/>.java.compile.src.set"/>

    </goal>

   </XDtMavenplugin:forAllTasks>

</project>

Reply via email to