Enhanced the vdoclet plugin. Previous versions did not provide access
to the Jelly context within the vdoclet velocity templates. Thus, as a result, support of the maven.tasklist.taskTag was dropped and the tasklist plugin was hardcoded to use "@todo" because there was no way to get the value from the Jelly context. - VDocletBean can now be passed a JellyContext which gets wrapped in the same JellyContextAdapter that I wrote from the Velocity taglib. To access the context from a vdoclet template, use '$jellyContext'. - Updated the taglib and tag defined in plugin.jelly to automatically include the current context. - Updated the POM to include the jelly deps. On a side note, also had to update the POM of the xdoc plugin as it had a dependency on the velocity taglib as well, and it was being loaded before the jar specified in this POM. git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113032 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
f3b5e44893
commit
8477e3bf29
4 files changed
+48
-2
No files matched your search
@@ -17,6 +17,7 @@
|
||||
template="${template}"
|
||||
outputFile="${outputFile}"
|
||||
encoding="${encoding}"
|
||||
jellyContext="${context}"
|
||||
/>
|
||||
</define:tag>
|
||||
</define:taglib>
|
||||
|
||||
@@ -50,6 +50,17 @@
|
||||
<id>oro</id>
|
||||
<version>2.0.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<id>commons-jelly</id>
|
||||
<version>1.0-beta-4</version>
|
||||
<url>http://jakarta.apache.org/commons/jelly/</url>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-jelly</groupId>
|
||||
<artifactId>commons-jelly-tags-velocity</artifactId>
|
||||
<version>20030303.205659</version>
|
||||
<url>http://jakarta.apache.org/commons/jelly/</url>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<id>logkit</id>
|
||||
<version>1.0.1</version>
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
package org.apache.maven.vdoclet;
|
||||
|
||||
import com.thoughtworks.qdox.model.JavaSource;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.jelly.JellyContext;
|
||||
import org.apache.commons.jelly.tags.velocity.JellyContextAdapter;
|
||||
import org.apache.velocity.context.Context;
|
||||
|
||||
import com.thoughtworks.qdox.model.JavaSource;
|
||||
|
||||
import vdoclet.Generator;
|
||||
import vdoclet.docinfo.DocInfo;
|
||||
import vdoclet.docinfo.QDoxBuilder;
|
||||
@@ -34,6 +40,9 @@ public class VDocletBean
|
||||
/** docinfo */
|
||||
DocInfo docInfo;
|
||||
|
||||
/** The jelly context */
|
||||
JellyContext jellyContext;
|
||||
|
||||
/**
|
||||
* Alias for srcPath
|
||||
*/
|
||||
@@ -50,6 +59,16 @@ public class VDocletBean
|
||||
this.destDir = destDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Jelly context.
|
||||
*
|
||||
* @param jellyContext the Jelly context
|
||||
*/
|
||||
public void setJellyContext(JellyContext jellyContext)
|
||||
{
|
||||
this.jellyContext = jellyContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* destDir attribute
|
||||
*/
|
||||
@@ -125,11 +144,26 @@ public class VDocletBean
|
||||
|
||||
Generator generator = new Generator(destDir);
|
||||
generator.setAttribute("docInfo", docInfo);
|
||||
|
||||
if (jellyContext != null)
|
||||
{
|
||||
generator.setAttribute("jellyContext", getJellyContextAdapter());
|
||||
}
|
||||
|
||||
if (encoding != null)
|
||||
{
|
||||
generator.setAttribute("encoding", encoding);
|
||||
}
|
||||
generator.eval(template, new FileWriter(new File(destDir, outputFile)));
|
||||
}
|
||||
|
||||
private Context getJellyContextAdapter()
|
||||
{
|
||||
JellyContextAdapter adapter = new JellyContextAdapter(jellyContext);
|
||||
|
||||
adapter.setReadOnly(true);
|
||||
|
||||
return adapter;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@
|
||||
<dependency>
|
||||
<groupId>commons-jelly</groupId>
|
||||
<artifactId>commons-jelly-tags-velocity</artifactId>
|
||||
<version>20030211.144921</version>
|
||||
<version>20030303.205659</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-jelly</groupId>
|
||||
|
||||
Reference in new issue
Block a user