提交 86d45483 编写于 作者: K Kohsuke Kawaguchi

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

上级 e73e870f
......@@ -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 )
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册