Hi Srepfler,
It should be quite similar to achieve the same behavior for hibernate
etc since there are only 2 stages to writing plugins of your own.
To start with copy the ejbdoclet plugin (rename as necessary) and then:
1. Edit the dependencies in the pom.xml file. The dependencies will
be used to form the ant taskdef classpath - I believe you won't need
to alter them as I included rather too many in the ejbdoclet pom.xml,
so that likely includes the hibernate dependencies.
2. Edit the mojo. I've included the code snipped below and if you
know xpath you'll immediately see the left hand side is the xpath for
the ant attribute and the right hand side is the constant that will
be used to set it's value, meaning users of the plugin don't have to.
For example notice that ejbdoclet/@destDir ant attribute will have
the generated java source directory assigned to it.
String[] mappings = new String[] {
"@destDir",
MantGoal.JAVA_GEN,
"deploymentdescriptor/@destDir", MantGoal.META_INF_GEN,
"fileset/@dir",
MantGoal.JAVA,
"jboss/@destDir",
MantGoal.META_INF_GEN
};
MantGoal goal = new MantGoal(this, project,
"xdoclet.modules.ejb.EjbDocletTask", task, mappings);
goal.execute("xdoclet.class.path");
Don't know if it's feasible (don't know enough about writing plugins)
but in future I'd like to make it so that you don't have to write
a plugin, just simply provide a properties file with the mappings.
On 25 Nov 2005, at 04:01, Srepfler Srgjan wrote:
Hi Ashley,
Can you please tell me what would it take to make similar doclets
but for hibernate or if you know there are already some existing ones?
Thanks
Ashley Williams wrote:
I have placed new ejbdoclet and webdoclet plugins in the sandbox here
https://svn.codehaus.org/mojo/trunk/mojo/mojo-sandbox/
And to see their use in a sample ear project try the following link:
https://svn.codehaus.org/mojo/trunk/mojo/mojo-sandbox/sample-ear-
proj/
---
Briefly they provide the following features:
1. Familiar ant xdoclet syntax can be used in configuration
2. Maven properties are automatically applied to the ant task -
for example
you don't have to specify attributes such as destDir="target/
generated-sources",
because the plugin applies a list of known mappings!
3. Can execute plugins in the same mvn session - eg a pom.xml
that kicks off
an ejb and then web build won't bomb out.
4. Works by creating an actual build.xml file on the fly.
- Ashley
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]