コード例 #1
0
 public Maven.MavenInstallation getMavenInstallation() {
   Maven.MavenInstallation[] installations = getDescriptor().getInstallations();
   for (Maven.MavenInstallation installation : installations) {
     if (installation.getName().equals(mavenName)) {
       return installation;
     }
   }
   // not found, return the first installation if exists
   return installations.length > 0 ? installations[0] : null;
 }
コード例 #2
0
 private String getJobDefinedMavenInstallation(BuildListener listener, VirtualChannel channel) {
   Maven.MavenInstallation mvn = getMavenInstallation();
   if (mvn == null) {
     listener.error(
         "Maven version is not configured for this project. Can't determine which Maven to run");
     throw new Run.RunnerAbortedException();
   }
   String mvnHome = mvn.getHome();
   if (mvnHome == null) {
     listener.error("Maven '%s' doesn't have its home set", mvn.getName());
     throw new Run.RunnerAbortedException();
   }
   return mvnHome;
 }