Hi Andrew,
> That is strange. What do the Ant script and directory structure look
> like now? All I can think of is that it must be picking up a second
> copy of the class somewhere (possibly the compiled version, which
> wouldn't contain any javadoc tags?)
Deleting the classes directory before running the ant task did not
change the result.
i am still getting the two portlet definitions. The definitions is
get look like :
<portlet>
<description>Amites Portlet Test Struts</description>
<portlet-name>amites_struts</portlet-name>
<display-name>Amites Portlet Test Struts</display-name>
<portlet-class>de.amites.web.TestStrutsPortlet</portlet-class>
.......
</portlet>
<portlet>
<portlet-name></portlet-name>
<portlet-class>de.amites.web.TestStrutsPortlet</portlet-class>
.....
</portlet>
The second (incomplete is missing the description and the
display-name tag. The
portlet-name tag is empty. everything else is the same.
The directory structory looks like :
ROOT
+ amitesPortlet
+ WEB-INF
+ classes
+ lib
+ src
+ java
+ de
......
+ resources
+ xdoclet-merge
The build file is contained in the ROOT directory
The ant task that is used :
<target name="prepare">
<property name="src.dir" value="." />
<property name="xdoclet.jar"
value="${src.dir}/resources/xdoclet-1.2.2.jar" />
<property name="xdoclet.portlet.jar"
value="${src.dir}/resources/xdoclet-portlet-module-1.2.2.jar" />
<property name="xjavadoc.jar"
value="${src.dir}/resources/xjavadoc-1.1.jar" />
<property name="commons-collections.jar"
value="${src.dir}/resources/commons-collections-2.0.jar" />
<property name="commons-logging.jar"
value="${src.dir}/resources/commons-logging.jar" />
<property name="portlet.jar"
value="${src.dir}/resources/portlet.jar" />
<property name="portal-ejb.jar"
value="${src.dir}/resources/portal-ejb.jar" />
</target>
<target name="portletdoclet" depends="prepare" >
<property name="dest.dir" value="amitesPortlet/WEB-INF" />
<property name="java.src.dir" value="${dest.dir}/src/java" />
<property name="merge.dir" value="xdoclet-merge" />
<taskdef name="portletdoclet"
classname="xdoclet.modules.portlet.PortletDocletTask"
classpath="${xdoclet.jar}:${xdoclet.portlet.jar}:${xjavadoc.jar}:${commons-collections.jar}:${commons-logging.jar}:${portlet.jar}:${portal-ejb.jar}"/>
<portletdoclet destdir="${dest.dir}" verbose="true"
mergedir="${merge.dir}" force="true">
<fileset dir="${java.src.dir}">
<include name="**/*Portlet.java"/>
</fileset>
<portletxml validateXML="true" />
</portletdoclet> </target>
Finally the TestStrutsPortlet file :
package de.amites.web;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import com.liferay.portlet.RenderRequestImpl;
import com.liferay.portlet.StrutsPortlet;
import com.liferay.util.servlet.DynamicServletRequest;
/**
* Portal Dependent Class that calls the Portal independent
implementation
* of the Portlet implementaion.
*
* Struts Portlet for the Liferay Portal.
*
* @portlet.portlet name="amites_struts"
* description="Amites Portlet Test Struts"
* display-name="Amites Portlet Test Struts"
*
*
* @portlet.portlet-init-param
* description=""
* name="edit-action"
* value="/amites_struts/edit"
*
* @portlet.portlet-init-param
* description=""
* name="view-action"
* value="/amites_struts/view"
*
* @portlet.portlet-init-param
* description=""
* name="help-action"
* value="/amites_struts/help"
*
* @portlet.portlet-init-param
* description=""
* name="use-default-template"
* value="true"
*
* @portlet.portlet expiration-cache="0"
*
* @portlet.supports
* mime-type="text/html" modes="edit,view,help"
*
* @portlet.portlet-info
* title="Amites Struts"
* short-title="Amites Struts"
* keywords="Amites Struts"
* @portlet.preference
* name="company" value="amites"
*
* @portlet.preference
* name="location" value="ostfildern"
* * @portlet.preferences-validator
* class="de.amites.web.CustomPreferencesValidator"
*
* @portlet.portlet-info
* title="Amites Struts"
*
* @portlet.security-role-ref
* role-name="Guest"
*
* @portlet.security-role-ref
* role-name="Power User"
*
* @portlet.security-role-ref
* role-name="User"
*
* @portlet.security-role-ref
* role-name="AmitesUser"
*
*/
public class TestStrutsPortlet extends StrutsPortlet {
private PortletImpl portletImpl = new PortletImpl();
public void doView(RenderRequest req, RenderResponse res) throws
IOException, PortletException {
portletImpl.doView(req, res, getPortletConfig());
System.out.println("window state : " + req.getWindowState());
RenderRequestImpl renderRequestImpl = (RenderRequestImpl) req;
System.out.println("state : " + ((DynamicServletRequest)
renderRequestImpl.getHttpServletRequest()).getRequest().getParameter("p_p_state"));
// get.getParameter("p_p_state"));
super.doView(req, res);
}
public void doEdit(RenderRequest request, RenderResponse response)
throws IOException, PortletException {
portletImpl.doEdit(request, response);
super.doEdit(request, response);
}
public void processAction(ActionRequest request, ActionResponse
response)
throws IOException, PortletException {
portletImpl.processAction(request, response);
super.processAction(request, response);
}
}
> Make sure you include liferay's StrutsPortlet in the classpath for the
> XDoclet task. Otherwise, it can't know that your class actually
extends
> GenericPortlet and will skip it.
Adding the liferay portal-ejb.jar to the classpath solved that
problem. Thanks.
Any more ideas, concerning the first problem ???
thanks,
Andreas
Hi Andrew,
thanks a lot for that tip. After changing the fileset the task
finally created the portlet definitions in the portlet.xml.
Unfortunately, now i have two other problems :
1. For some reason the task creates two portlet definitions in the
portlet.xml for the one portlet i have.
The first definition is complete. The second one misses some
attributes. very strange.
2. The task only allows me to create portlet definitions for files
that directly extend the GenericPortlet.
As soon as i change that (my portlet extends the
com.liferay.portlet.StrutsPortlet of the Liferay Portal,
which itself extends the GenericPortlet), no portlet definition
at all is created. Is there a way to tell
the task, to create the definition for Portlets that do not
extend the GenericPortlet directly ???
Looks like the task requires the portlets to extend the
GenericPortlet.
Thanks in advance,
Andreas
On Wed, 2005-02-09 at 10:15, AndreasWuest wrote:
i have some major problems getting the portletdoclet to work.
Seems like
i am the first one using that feature. Searching the net did not
return
many results :(
My problem is that the portletdoclet task does not generate a
portlet.xml
with my portlet definition. THe portlet.xml file is generated, but
it is empty.
...
<property name="java.src.dir"
value="${dest.dir}/src/java/de/amites/web" />
...
<fileset dir="C:/">
<include name="*Portlet.java"/>
</fileset>
...
package de.amites.web;
Check the archive for the posts I made to Rob Griffin only a few days
ago with subject "XDoclet fails to generate JMX files". It's exactly
the same thing, a problem with your fileset.
Andrew.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real
users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
xdoclet-user mailing list
xdoclet-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-user
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
xdoclet-user mailing list
xdoclet-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-user