IIRC, getClass().getProtectionDomain().getCodeSource().getLocation()
will return the URL off the jar containing the current class. Maybe
that helps ?
Tom
On 2/18/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:
I'm using javadoc to "scrape" a set of classes and annotations to form
an XML file that, in turn, will generate some Doxia documentation as
part of my site.
I'm copying a lot of stuff from maven-javadoc-plugin.
Here's my issue: I need to run Javadoc against a doclet defined
within the plugin.
Therefore, I need to set the -docletpath argument on the javadoc command line.
I haven't found a way to get this to work ideally. What I have seems
to work for the moment:
/**
* Needed to help locate this plugin's local JAR file for the
-doclet argument.
*
* @parameter default-value="${localRepository}"
* @read-only
*/
private ArtifactRepository localRepository;
/**
* Needed to help locate this plugin's local JAR file for the
-doclet argument.
*
* @parameter default-value="${plugin.groupId}"
* @read-only
*/
private String pluginGroupId;
/**
* Needed to help locate this plugin's local JAR file for the
-doclet argument.
*
* @parameter default-value="${plugin.artifactId}"
* @read-only
*/
private String pluginArtifactId;
/**
* Needed to help locate this plugin's local JAR file for the
-doclet argument.
*
* @parameter default-value="${plugin.version}"
* @read-only
*/
private String pluginVersion;
@SuppressWarnings("unchecked")
private String docletPath() throws MavenReportException
{
File file = new File(localRepository.getBasedir());
for (String term : pluginGroupId.split("\\."))
file = new File(file, term);
file = new File(file, pluginArtifactId);
file = new File(file, pluginVersion);
file = new File(file, String.format("%s-%s.jar",
pluginArtifactId, pluginVersion));
return file.getAbsolutePath();
}
Notes:
I was unable to inject ${plugin} by itself, it was always a null
PluginDescriptor. Thus I have to inject three seperate values.
I have a sneaking suspicion that this may not work for users who
download a snapshot version of the plugin from a remote repository.
What's the best way to accomplish what I want?
--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com
---------------------------------------------------------------------
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]