File pluginJarFile = getPluginJarFile();
System.out.println("Using plugin jar [" + pluginJarFile + "]...");
MavenResolverSystem mavenDependencyResolver = Maven.resolver();
// Pull in any required plugins from our pom's dependencies.
Collection<RhqAgentPluginArchive> requiredPlugins = Arrays.asList(mavenDependencyResolver
.loadPomFromFile("pom.xml").importRuntimeAndTestDependencies(new AcceptScopesStrategy(ScopeType.PROVIDED))
.as(RhqAgentPluginArchive.class));
return ShrinkWrap.create(ZipImporter.class, pluginJarFile.getName()).importFrom(pluginJarFile)
.as(RhqAgentPluginArchive.class).withRequiredPluginsFrom(requiredPlugins);