Hi All,

I've read the docs, googled, read mailing list archives, asked in irc
etc. but have been unable to find the answer to this.

I'm writing a maven 1 plugin which adds a goal that calls <ant:java>
running the main method of a class which is bundled in the plugin jar.
There are jar deps in the plugin but my question is not about ensuring
that the plugin's dependencies are on the runtime classpath of the
jvm. I understand how to do this using the
${plugin.getDependencyPath()} call.

The purpose of the plugin is to create a file for the distribution -
essentially metadata for the app. Originally I tried to implement the
whole thing in Jelly but after a few hours I gave up and wrote it in a
dozen lines of Java.

The plugin runs the goal in my project but when the jvm tries to load
my class it can't find it. Why is the plugin jar not on the classpath
of the project when the goal is sought? I have tried sprinkling magic
fork="true" spawn="true" and this doesn't work.

I've been assuming I need to put a classpath reference into the
<ant:java> tag.  But I can't do this because my plugin jar is not  a
dep of itself. Below you can see I've descended into cargo culting a
bit in frustration and pasted ant path elements willy nilly.

The only other plugins I can find that bundle classes are build
reports which register themselves explicitly. Do I have to register
for a non report plugin?

My plugin id: maven-hash-registry-plugin
Main class for plugin: com.atlassian.hashregistry.GenerateHashRegistry
Goal name: hashregistry:generate

<project xmlns:ant="jelly:ant">
  <goal name="hashregistry:generate" prereqs="java:compile"
description="Generate the hash registry">
    <ant:java classname="com.atlassian.hashregistry.GenerateHashRegistry">
        <ant:classpath>
                <ant:pathelement location="${maven.build.dest}" />
                <ant:path refid="maven.dependency.classpath" />
                <ant:path refid="maven.compile.src.set" />
                <ant:pathelement
location="${plugin.getDependencyPath('commons-jelly:commons-jelly')}"/>
                <ant:pathelement
location="${plugin.getDependencyPath('commons-codec:commons-codec')}"/>
                <ant:pathelement
location="${plugin.getDependencyPath('commons-io:commons-io')}"/>
                <ant:pathelement
location="${plugin.getDependencyPath('maven-hash-registry-plugin:maven-hash-registry-plugin')}"/>
                <ant:pathelement
location="${plugin.getDependencyPath('maven-hash-registry-plugin')}"/>
<!-- just in case this is correct -->
           </ant:classpath>
    </ant:java>
  </goal>
</project>

Any pointers or wisdom would help. I'm just about to check out the
source to Maven!

thanks in advance,

Chris.

-- 
Chris Mountford

"In theory, there is no difference between theory and practice. But,
in practice, there is." -- Jan L. A. van de Snepscheut

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to