private File getExeFile(String execName) { String m2Home = Util.replaceMacro(getHome(),EnvVars.masterEnvVars); if(Functions.isWindows()) { File exeFile = new File(m2Home, "bin/" + execName + ".bat"); // since Maven 3.3 .bat files are replaced with .cmd if (!exeFile.exists()) { return new File(m2Home, "bin/" + execName + ".cmd"); } return exeFile; } else { return new File(m2Home, "bin/" + execName); } }
/** * install directory. * * @deprecated as of 1.308. Use {@link #getHome()}. */ @Deprecated public String getMavenHome() { return getHome(); }
public File getHomeDir() { return new File(getHome()); }
private File getExeFile(String execName) { if(File.separatorChar=='\\') execName += ".bat"; String m2Home = Util.replaceMacro(getHome(),EnvVars.masterEnvVars); return new File(m2Home, "bin/" + execName); }
/** * install directory. * * @deprecated as of 1.308. Use {@link #getHome()}. */ @Deprecated public String getMavenHome() { return getHome(); }
private File getExeFile(String execName) { if(File.separatorChar=='\\') execName += ".bat"; String m2Home = Util.replaceMacro(getHome(),EnvVars.masterEnvVars); return new File(m2Home, "bin/" + execName); }
@Override protected String getMavenAgentClassPath(MavenInstallation mvn, FilePath slaveRoot, BuildListener listener) throws IOException, InterruptedException { String classWorldsJar = getLauncher().getChannel().call(new GetClassWorldsJar(mvn.getHome(),listener)); String path = classPathEntry(slaveRoot, Maven35Main.class, "maven35-agent", listener) + (getLauncher().isUnix()?":":";")+classWorldsJar; // TODO this configurable?? path += (getLauncher().isUnix()?":":";")+mvn.getHomeDir().getPath()+"/conf/logging"; return path; }
@Override protected String getMavenAgentClassPath(MavenInstallation mvn, FilePath slaveRoot, BuildListener listener) throws IOException, InterruptedException { String classWorldsJar = getLauncher().getChannel().call(new GetClassWorldsJar(mvn.getHome(),listener)); return classPathEntry(slaveRoot, Maven3Main.class, "maven3-agent", listener) + (getLauncher().isUnix()?":":";")+classWorldsJar; }
@Override protected String getMavenAgentClassPath(MavenInstallation mvn, FilePath slaveRoot, BuildListener listener) throws IOException, InterruptedException { String classWorldsJar = getLauncher().getChannel().call(new Maven3ProcessFactory.GetClassWorldsJar(mvn.getHome(),listener)); String path = classPathEntry(slaveRoot, Maven32Main.class, "maven32-agent", listener) + (getLauncher().isUnix()?":":";")+classWorldsJar; // TODO this configurable?? path += (getLauncher().isUnix()?":":";")+mvn.getHomeDir().getPath()+"/conf/logging"; return path; }
/** * install directory. * * @deprecated as of 1.308. Use {@link #getHome()}. */ public String getMavenHome() { return getHome(); }
/** * @return True if the Maven version is at least the version that is passed. */ public static boolean isAtLeastVersion(MavenModuleSetBuild build, EnvVars vars, TaskListener listener, String version) throws IOException, InterruptedException { Maven.MavenInstallation mavenInstallation = getMavenInstallation(build, vars, listener); return isAtLeast(build, mavenInstallation.getHome(), version); }
/** * install directory. * * @deprecated as of 1.308. Use {@link #getHome()}. */ public String getMavenHome() { return getHome(); }
private File getExeFile(String execName) { if(File.separatorChar=='\\') execName += ".bat"; String m2Home = Util.replaceMacro(getHome(),EnvVars.masterEnvVars); return new File(m2Home, "bin/" + execName); }
@Override public void buildEnvVars(EnvVars env) { String home = getHome(); if (home == null) { return; } env.put("M2_HOME", home); env.put("MAVEN_HOME", home); env.put("PATH+MAVEN", home + "/bin"); }
String exec = mi.getExecutable(launcher); if(exec==null) { listener.fatalError(Messages.Maven_NoExecutable(mi.getHome())); return false;
@Test @ConfiguredWithCode("MavenConfiguratorTest.yml") public void should_configure_maven_tools_and_global_config() { final Maven.DescriptorImpl descriptor= (Maven.DescriptorImpl) j.jenkins.getDescriptorOrDie(Maven.class); Assert.assertEquals(1, descriptor.getInstallations().length); Assert.assertEquals("/usr/share/maven", descriptor.getInstallations()[0].getHome()); InstallSourceProperty installSourceProperty = descriptor.getInstallations()[0].getProperties().get(InstallSourceProperty.class); Assert.assertEquals("3.5.0", installSourceProperty.installers.get(Maven.MavenInstaller.class).id); final SettingsProvider provider = GlobalMavenConfig.get().getSettingsProvider(); Assert.assertTrue(provider instanceof FilePathSettingsProvider); Assert.assertEquals("/usr/share/maven-settings.xml", ((FilePathSettingsProvider)provider).getPath()); } }
public MavenInstallation forEnvironment(EnvVars environment) { return new MavenInstallation(getName(), environment.expand(getHome()), getProperties().toList()); }
@Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final MavenInstallation that = (MavenInstallation) o; if (getHome() != null ? !getHome().equals(that.getHome()) : that.getHome() != null) return false; if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) return false; return true; }
@Override public void buildEnvVars(EnvVars env) { String home = getHome(); if (home == null) { return; } env.put("M2_HOME", home); env.put("MAVEN_HOME", home); env.put("PATH+MAVEN", home + "/bin"); }