if the maven home is incorrect, detect the problem more gracefully.

This commit is contained in:
Kohsuke Kawaguchi committed 2011-06-10 08:07:39 -07:00
1 parent e73e870fdc
commit 86d4548398
2 files changed
+11 -2

No files matched your search

@@ -575,7 +575,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
if(mvn==null)
throw new AbortException("A Maven installation needs to be available for this project to be built.\n"+
"Either your server has no Maven installations defined, or the requested Maven version does not exist.");
mvn = mvn.forEnvironment(envVars).forNode(Computer.currentComputer().getNode(), listener);
MavenInformation mavenInformation = getModuleRoot().act( new MavenVersionCallable( mvn.getHome() ));
@@ -24,6 +24,7 @@ package hudson.maven;
* THE SOFTWARE.
*/
import hudson.AbortException;
import hudson.remoting.Callable;
import java.io.File;
@@ -53,7 +54,15 @@ public class MavenVersionCallable
{
try
{
return MavenEmbedderUtils.getMavenVersion( new File(mavenHome) );
File home = new File(mavenHome);
if(!home.isDirectory())
{
if (home.exists())
throw new AbortException("Maven Home "+home+" is not a directory");
else
throw new AbortException("Maven Home "+home+" doesn't exist");
}
return MavenEmbedderUtils.getMavenVersion(home);
}
catch ( MavenEmbedderException e )
{