I recently discovered Cargo and am really excited about its potential for allowing developers to consistently and automatically test web artifacts using maven -- but I am having trouble getting it configured correctly. For better or worse, we are a WebLogic shop, but I have been unable to find a good example of configuring a WebLogic Local Standalone using Cargo's Maven plugin, as the plugin is unable to find the org.codehaus.cargo.container.weblogic.WebLogic103xStandaloneLocalConfiguration class.
To simplify things, I started with the archetype (which includes samples for ever server EXCEPT weblogic....gee thanks) and changed the plugin under pluginManagement to look like this:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.5</version>
<configuration>
<container>
<containerId>weblogic103x</containerId>
<type>standalone</type>
<home>${weblogic.10.3.server}</home>
</container>
<configuration>
<type>local</type>
<properties>
<cargo.servlet.port>8001</cargo.servlet.port>
</properties>
</configuration>
</configuration>
</plugin>
Some of this may be redundant (I'm not very experienced with maven profiles), but I also added an additional profile and made it default:
<profile>
<id>weblogic103x</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.5</version>
<configuration>
<container>
<containerId>weblogic103x</containerId>
<type>standalone</type>
<home>${weblogic.10.3.server}</home>
</container>
<configuration>
<type>local</type>
<implementation>org.codehaus.cargo.container.weblogic.WebLogic103xStandaloneLocalConfiguration</implementation>
<properties>
<cargo.servlet.port>8001</cargo.servlet.port>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
And the exception I get is:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Custom configuration implementation [org.codehaus.cargo.container.weblogic.WebLogic103xStandaloneLocalConfiguration] cannot be loaded
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Custom configuration implementation [org.codehaus.cargo.container.weblogic.WebLogic103xStandaloneLocalConfiguration] cannot be loaded
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
[snip]... several more
Caused by: org.apache.maven.plugin.MojoExecutionException: Custom configuration implementation [org.codehaus.cargo.container.weblogic.WebLogic103xStandaloneLocalConfiguration] cannot be loaded
at org.codehaus.cargo.maven2.configuration.Configuration.createConfiguration(Configuration.java:266)
[snip]... several more
Caused by: java.lang.ClassNotFoundException: org.codehaus.cargo.container.weblogic.WebLogic103xStandaloneLocalConfiguration
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:266)
at org.codehaus.cargo.maven2.configuration.Configuration.createConfiguration(Configuration.java:259)
... 24 more
Am I just missing some setting? Or am I fundamentally misunderstanding how Cargo is supposed to work? Or something else?
OK, I got it. This was occurring because I had specified an implementation class in the profile. Once that was removed, the error was:
There's no registered configuration for the parameters (container [id = [weblogic103x], type = [standalone]], configuration type [local]).
This is of course because I needed to pay closer attention to exactly the which values are allowed which type field -- Container type vs Configuration type. This page has the reference:
http://cargo.codehaus.org/Maven2+Plugin+Reference+Guide
Once I got the container type to "installed" and the configuration type to "standalone", things went much more smoothly.
So, RTFM on me! :)