当前位置: 首页>>代码示例>>Java>>正文


Java Main类代码示例

本文整理汇总了Java中org.apache.tools.ant.Main的典型用法代码示例。如果您正苦于以下问题:Java Main类的具体用法?Java Main怎么用?Java Main使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Main类属于org.apache.tools.ant包,在下文中一共展示了Main类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import org.apache.tools.ant.Main; //导入依赖的package包/类
public void run() {
    GradleVersion currentVersion = GradleVersion.current();

    final StringBuilder sb = new StringBuilder();
    sb.append("\n------------------------------------------------------------\nGradle ");
    sb.append(currentVersion.getVersion());
    sb.append("\n------------------------------------------------------------\n\nBuild time:   ");
    sb.append(currentVersion.getBuildTime());
    sb.append("\nRevision:     ");
    sb.append(currentVersion.getRevision());
    sb.append("\n\nGroovy:       ");
    sb.append(GroovySystem.getVersion());
    sb.append("\nAnt:          ");
    sb.append(Main.getAntVersion());
    sb.append("\nJVM:          ");
    sb.append(Jvm.current());
    sb.append("\nOS:           ");
    sb.append(OperatingSystem.current());
    sb.append("\n");

    System.out.println(sb.toString());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:CommandLineActionFactory.java

示例2: run

import org.apache.tools.ant.Main; //导入依赖的package包/类
public void run() {
    GradleVersion currentVersion = GradleVersion.current();

    final StringBuilder sb = new StringBuilder();
    sb.append("\n------------------------------------------------------------\nGradle ");
    sb.append(currentVersion.getVersion());
    sb.append("\n------------------------------------------------------------\n\nBuild time:   ");
    sb.append(currentVersion.getBuildTime());
    sb.append("\nBuild number: ");
    sb.append(currentVersion.getBuildNumber());
    sb.append("\nRevision:     ");
    sb.append(currentVersion.getRevision());
    sb.append("\n\nGroovy:       ");
    sb.append(GroovySystem.getVersion());
    sb.append("\nAnt:          ");
    sb.append(Main.getAntVersion());
    sb.append("\nJVM:          ");
    sb.append(Jvm.current());
    sb.append("\nOS:           ");
    sb.append(OperatingSystem.current());
    sb.append("\n");

    System.out.println(sb.toString());
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:25,代码来源:CommandLineActionFactory.java

示例3: prettyPrint

import org.apache.tools.ant.Main; //导入依赖的package包/类
public String prettyPrint() {
    final StringBuilder sb = new StringBuilder();
    sb.append("\n------------------------------------------------------------\nGradle ");
    sb.append(getVersion());
    sb.append("\n------------------------------------------------------------\n\nBuild time:   ");
    sb.append(getBuildTime());
    sb.append("\nBuild number: ");
    sb.append(buildNumber);
    sb.append("\nRevision:     ");
    sb.append(commitId);
    sb.append("\n\nGroovy:       ");
    sb.append(GroovySystem.getVersion());
    sb.append("\nAnt:          ");
    sb.append(Main.getAntVersion());
    sb.append("\nIvy:          ");
    sb.append(Ivy.getIvyVersion());
    sb.append("\nJVM:          ");
    sb.append(Jvm.current());
    sb.append("\nOS:           ");
    sb.append(OperatingSystem.current());
    sb.append("\n");
    return sb.toString();
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:24,代码来源:GradleVersion.java

示例4: captureAnt

import org.apache.tools.ant.Main; //导入依赖的package包/类
static public String captureAnt( Runnable runnable )
{
	ByteArrayOutputStream buf = new ByteArrayOutputStream();
	PrintStream print = new PrintStream( buf );
	PrintStream origOut = System.out;
	PrintStream origErr = System.err;
	System.setOut( print );
	System.setErr( print );
	Deencapsulation.setField( Main.class, "out", print );
	Deencapsulation.setField( Main.class, "err", print );
	try
	{
		runnable.run();
		print.close();
	}
	finally
	{
		System.setOut( origOut );
		System.setErr( origErr );
	}
	return buf.toString();
}
 
开发者ID:sindicate,项目名称:solidbase,代码行数:23,代码来源:TestUtil.java

示例5: getAntVersion

import org.apache.tools.ant.Main; //导入依赖的package包/类
public String getAntVersion() {
    try {
        return Main.getAntVersion();
    } catch (BuildException be) {
        AntModule.err.notify(ErrorManager.INFORMATIONAL, be);
        return NbBundle.getMessage(BridgeImpl.class, "LBL_ant_version_unknown");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:BridgeImpl.java

示例6: createTask

import org.apache.tools.ant.Main; //导入依赖的package包/类
protected Zip createTask() {
  String version = Main.getAntVersion();
  Jar task;
  if (version != null && (version.indexOf("1.8.0") != -1 || version.indexOf("1.8.1") != -1)) {
    task = new PatchedJar();
  }
  else {
    task = new Jar();
  }
  task.setTaskName("jar");
  task.setWhenmanifestonly((Zip.WhenEmpty) Zip.WhenEmpty.getInstance(Zip.WhenEmpty.class, "skip"));
  return task;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JarContainer.java

示例7: runBuild

import org.apache.tools.ant.Main; //导入依赖的package包/类
private void runBuild(File buildFile, Vector<String> targets, int messageLevel) throws BuildException {

        final Project project = new Project();
        project.setCoreLoader(null);

        Throwable error = null;

        try {
            addBuildListeners(project, messageLevel);
            addInputHandler(project, null);

            PrintStream err = System.err;
            PrintStream out = System.out;
            InputStream in = System.in;

            // use a system manager that prevents from System.exit()
            SecurityManager oldsm = null;
            oldsm = System.getSecurityManager();

            // SecurityManager can not be installed here for backwards
            // compatibility reasons (PD). Needs to be loaded prior to
            // ant class if we are going to implement it.
            // System.setSecurityManager(new NoExitSecurityManager());
            try {
                project.setDefaultInputStream(System.in);
                System.setIn(new DemuxInputStream(project));
                System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
                System.setErr(new PrintStream(new DemuxOutputStream(project, true)));

                project.fireBuildStarted();

                project.init();
                project.setUserProperty("ant.version", Main.getAntVersion());

                project.setUserProperty("ant.file", buildFile.getAbsolutePath());

                ProjectHelper.configureProject(project, buildFile);

                // make sure that we have a target to execute
                if (targets.size() == 0 && project.getDefaultTarget() != null) {
                    targets.addElement(project.getDefaultTarget());
                }

                project.executeTargets(targets);
            } finally {
                // put back the original security manager
                // The following will never eval to true. (PD)
                if (oldsm != null) {
                    System.setSecurityManager(oldsm);
                }

                System.setOut(out);
                System.setErr(err);
                System.setIn(in);
            }
        } catch (RuntimeException | Error exc) {
            error = exc;
            throw exc;
        } finally {
            project.fireBuildFinished(error);
        }
    }
 
开发者ID:apache,项目名称:ant-ivy,代码行数:63,代码来源:AntCallTriggerTest.java

示例8: getDefaultBuildFile

import org.apache.tools.ant.Main; //导入依赖的package包/类
/**
 * Get the default build file name to use when launching the task.
 * <p>
 * This function may be overriden by providers of custom ProjectHelper so they can implement easily their sub
 * launcher.
 *
 * @return the name of the default file
 * @since Ant 1.8.0
 */
protected String getDefaultBuildFile() {
    return Main.DEFAULT_BUILD_FILENAME;
}
 
开发者ID:apache,项目名称:ant,代码行数:13,代码来源:Ant.java

示例9: getDefaultBuildFile

import org.apache.tools.ant.Main; //导入依赖的package包/类
/**
 * Get the default build file name to use when launching the task.
 * <p>
 * This function may be overriden by providers of custom ProjectHelper so
 * they can implement easily their sub launcher.
 * </p>
 *
 * @return the name of the default file
 * @since Ant 1.8.0
 */
protected String getDefaultBuildFile() {
    return Main.DEFAULT_BUILD_FILENAME;
}
 
开发者ID:apache,项目名称:ant,代码行数:14,代码来源:SubAnt.java


注:本文中的org.apache.tools.ant.Main类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。