Package org.mevenide.idea.global

Examples of org.mevenide.idea.global.MavenManager


        //
        //check some preconfigured properties that are not present in
        //configuration files, but Maven expects them because they are
        //passed by the maven shell scripts
        //
        final MavenManager mavenMgr = MavenManager.getInstance();
        final VirtualFile mavenHome = mavenMgr.getMavenHome();
        if (pName.equals("maven.home"))
            return mavenHome == null ? null : mavenHome.getPath();

        //
        //system properties
View Full Code Here


                               final ProjectJdk pJvm,
                               final String... pGoals) throws MavenHomeUndefinedException {

        final ParametersList vmArgs = getVMParametersList();
        final ParametersList params = getProgramParametersList();
        final MavenManager mavenMgr = MavenManager.getInstance();

        //
        //make sure the user has set the Maven home location
        //
        final VirtualFile mavenHome = mavenMgr.getMavenHome();
        if (mavenHome == null || !mavenHome.isValid() || !FileUtils.exists(mavenHome))
            throw new MavenHomeUndefinedException();

        //
        //important locations for the command line
        //
        final VirtualFile foreheadConf = mavenHome.findFileByRelativePath(FOREHEAD_CONF_FILE);
        final VirtualFile jdkHome = pJvm.getHomeDirectory();
        VirtualFile javaEndorsed = jdkHome.findFileByRelativePath(JRE_ENDORSED_DIR_NAME);
        if (javaEndorsed == null)
            javaEndorsed = jdkHome.findFileByRelativePath(JDK_ENDORSED_DIR_NAME);

        final VirtualFile mavenEndorsed = mavenHome.findFileByRelativePath(MAVEN_ENDORSED_DIR_NAME);
        final VirtualFile foreheadJar = mavenHome.findFileByRelativePath(FOREHEAD_JAR_FILE);

        final StringBuilder endorsedBuf = new StringBuilder();
        if (javaEndorsed != null) {
            endorsedBuf.append(FileUtils.getAbsolutePath(javaEndorsed));
            endorsedBuf.append(File.pathSeparatorChar);
        }
        if (mavenEndorsed != null)
            endorsedBuf.append(FileUtils.getAbsolutePath(mavenEndorsed));
        final String endorsedDirs = endorsedBuf.toString();

        //
        //setup commandline
        //
        final VirtualFile dir = pPomFile.getParent();
        if (dir == null)
            throw new IllegalArgumentException("POM file has no directory.");
        setWorkingDirectory(FileUtils.getAbsolutePath(dir));
        setJdk(pJvm);
        setMainClass(FOREHEAD_MAIN_CLASS);

        //maven-related JVM arguments
        vmArgs.defineProperty("maven.home", FileUtils.getAbsolutePath(mavenHome));
        vmArgs.defineProperty("tools.jar", pJvm.getToolsPath());
        vmArgs.defineProperty("forehead.conf.file", FileUtils.getAbsolutePath(foreheadConf));
        if (endorsedDirs != null && endorsedDirs.trim().length() > 0)
            vmArgs.defineProperty("java.endorsed.dirs", endorsedDirs);

        //user specified JVM arguments
        final String mavenOptions = mavenMgr.getMavenOptions();
        if (mavenOptions != null && mavenOptions.trim().length() > 0)
            vmArgs.add(mavenOptions);

        //only forehead is needed in the classpath
        getClassPath().add(FileUtils.getAbsolutePath(foreheadJar));

        //set offline mode, if needed
        if (mavenMgr.isOffline())
            params.add("-o");

        //suppress banner
        params.add("-b");
        params.add("-p", pPomFile.getName());
View Full Code Here

TOP

Related Classes of org.mevenide.idea.global.MavenManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.