maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Gies <andr...@soa-knowledge.net>
Subject Strange Class Not found Exception in selfmade plugin
Date Wed, 03 Dec 2008 09:13:49 GMT
Hello Maven Gurus,

I have developed a number of plugins that build a deployment package for 
our ESB. Now I am currently developing a series of plugins that shall 
execute
in the pre-integration-test, integration-test and post-integration-test 
lifecycle phases. The plan is to set up a server runtime and start it up 
in pre-integration-test,
run the test cases in integration-test and shut down the server runtime 
again in post-integration-test. We have decided to set up a fresh 
runtime for each integration
test as we want to test the deployment behaviour as well.

To my question: The plugin that I want to execute in the 
pre-integration-test comes with a classNotFoundException for a class 
that is definitely in the dependencies of my plugin.
I have registered my plugin for the lifecycle execution in the 
components.xml as follows:

    <!-- Define the Life Cycle for the ESB modules. -->
    <component>
      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
      <role-hint>esb</role-hint>
      
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
      <configuration>
        <phases>
          
<process-sources>com.sonicsw.maven.plugins:ESBPlugin:1.0-SNAPSHOT:esb-export</process-sources>
          
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
          
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
          <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
          
<package>com.sonicsw.maven.plugins:ESBPlugin:1.0-SNAPSHOT:esb-package</package>
          
<pre-integration-test>com.sonicsw.maven.plugins:ESBPlugin:1.0-SNAPSHOT:prepare-it</pre-integration-test>
          
<integration-test>org.apache.maven.plugins:maven-surefire-plugin:test</integration-test>
          
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
          
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
        </phases>
      </configuration>
    </component>

When I execute mvn integration-test the plugin is executed as expected. 
As mentioned, when bein executed as a maven plugin the plugin fails with
a class not found exception.. I have examined the depenency tree of my 
plugin and can clearly see, that the jar file containing the class is in 
there.
When I try to execute the plugin standalone (without the lifecycle) the 
same error occurs.

Also, when I run a JUnit test case against the plugin from within 
Eclipse (using the m2eclipse classpath container resolved via the 
dependencies), the
plugin code executes just fine.

Therefore I assume, that I am running into a classloading issue within 
maven itself. I have searched the documentation and JIRA for similar 
issues, but was
unable to find something.

Any pointers into existing issues, documenation or hints how I could 
narrow down the issue further are greatly appreciated.

Thanks in advance
Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message