On 28/01/2011 01:15, Jane Ren wrote:
I cannot use my new plugin because I get
java.lang.NoClassDefFoundError on something from a 3rd party jar.  I
have code to import stuff from this jar.

Could someone provide some examples on how to get around this problem
in pom.xml?

Also, does this have to be somewhere defined in the pom.xml for the
maven plugin for managing taverna plugins?

The main Maven way to deal with these things is to use the assembly
plugin with its built-in jar-with-dependencies descriptor. That makes a
JAR that includes all the dependencies within it, plus the metadata
magic to make Java know how to use it.


http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html

Thus, in my code I have this:

    <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.2</version>
        <configuration>
            <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>
            <!-- This next section because I happen to be building an
                 executable JAR; you probably don't need it... -->
            <archive>
                <manifest>
                    <mainClass>${workerMainClass}</mainClass>
                </manifest>
            </archive>
        </configuration>
        <executions>
            <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

Note that the assembly plugin is *very* complex, but the case you're
doing is (probably) one where you don't need to know about all the
horrible gory details.

Donal.

<<attachment: donal_k_fellows.vcf>>

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
taverna-hackers mailing list
[email protected]
Web site: http://www.taverna.org.uk
Mailing lists: http://www.taverna.org.uk/about/contact-us/
Developers Guide: http://www.taverna.org.uk/developers/

Reply via email to