geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r531466 - /geronimo/devtools/maven-plugins/trunk/maven-eclipsepde-plugin/src/main/java/org/apache/geronimo/devtools/plugins/eclipsepde/ManifestDependenciesMojo.java
Date Mon, 23 Apr 2007 13:49:23 GMT
Author: sppatel
Date: Mon Apr 23 06:49:15 2007
New Revision: 531466

URL: http://svn.apache.org/viewvc?view=rev&rev=531466
Log:
improve error on no eclipse image

Modified:
    geronimo/devtools/maven-plugins/trunk/maven-eclipsepde-plugin/src/main/java/org/apache/geronimo/devtools/plugins/eclipsepde/ManifestDependenciesMojo.java

Modified: geronimo/devtools/maven-plugins/trunk/maven-eclipsepde-plugin/src/main/java/org/apache/geronimo/devtools/plugins/eclipsepde/ManifestDependenciesMojo.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/maven-plugins/trunk/maven-eclipsepde-plugin/src/main/java/org/apache/geronimo/devtools/plugins/eclipsepde/ManifestDependenciesMojo.java?view=diff&rev=531466&r1=531465&r2=531466
==============================================================================
--- geronimo/devtools/maven-plugins/trunk/maven-eclipsepde-plugin/src/main/java/org/apache/geronimo/devtools/plugins/eclipsepde/ManifestDependenciesMojo.java
(original)
+++ geronimo/devtools/maven-plugins/trunk/maven-eclipsepde-plugin/src/main/java/org/apache/geronimo/devtools/plugins/eclipsepde/ManifestDependenciesMojo.java
Mon Apr 23 06:49:15 2007
@@ -91,6 +91,8 @@
 	private Set bundleEntries = new HashSet();
 
 	private Set exportedEntries = new HashSet();
+	
+	private File[] plugins;
 
 	/*
 	 * (non-Javadoc)
@@ -98,6 +100,12 @@
 	 * @see org.apache.maven.plugin.Mojo#execute()
 	 */
 	public void execute() throws MojoExecutionException, MojoFailureException {
+		
+		File pluginsDir = new File(eclipseHome,"plugins");
+		plugins = pluginsDir.listFiles();
+		if(plugins == null || plugins.length == 0) {
+			throw new MojoFailureException("No plugins or plugins directory could be found at " +
pluginsDir);
+		}
 
 		addRequiredBundles(getManifestFromFile(manifestFile), false);
 
@@ -174,8 +182,7 @@
 				if (bundle.isFile()) {
 					manifest = new JarFile(bundle).getManifest();
 				} else {
-					File manifestFile = new File(bundle + File.separator
-							+ MANIFEST_PATH);
+					File manifestFile = new File(bundle,MANIFEST_PATH);
 					manifest = getManifestFromFile(manifestFile);
 				}
 			} else {
@@ -207,12 +214,10 @@
 	}
 
 	private File findBundleForDependency(String artifactId) {
-		File pluginsDir = new File(eclipseHome + File.separator + "plugins");
-		File[] members = pluginsDir.listFiles();
-		for (int i = 0; i < members.length; i++) {
-			String bundleName = InstallPluginDependenciesMojo.getBundleName(members[i]);
+		for (int i = 0; i < plugins.length; i++) {
+			String bundleName = InstallPluginDependenciesMojo.getBundleName(plugins[i]);
 			if (artifactId.equals(bundleName))
-				return members[i];
+				return plugins[i];
 		}
 		return null;
 	}



Mime
View raw message