當前位置: 首頁>>代碼示例>>Java>>正文


Java ProjectHelper.getProjectHelper方法代碼示例

本文整理匯總了Java中org.apache.tools.ant.ProjectHelper.getProjectHelper方法的典型用法代碼示例。如果您正苦於以下問題:Java ProjectHelper.getProjectHelper方法的具體用法?Java ProjectHelper.getProjectHelper怎麽用?Java ProjectHelper.getProjectHelper使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.tools.ant.ProjectHelper的用法示例。


在下文中一共展示了ProjectHelper.getProjectHelper方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: altCompile

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
/**
 * Description: compile method that does not maintains the i/o streams after the task is done.
 * This is an alternative for the current compile method for future uses.
 * @param file path of the build xml to be executed
 */
public static void altCompile( String file) {
    
    // File buildFile = new File("build.xml");
    File buildFile = new File(file);
    Project p = new Project();
    p.setUserProperty("ant.file", buildFile.getAbsolutePath());     
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);
    
    try {
        p.fireBuildStarted();
        p.init();
        ProjectHelper helper = ProjectHelper.getProjectHelper();
        p.addReference("ant.projectHelper", helper);
        helper.parse(p, buildFile);
        p.executeTarget(p.getDefaultTarget());
        p.fireBuildFinished(null);
      
    } catch (Exception e) {}
}
 
開發者ID:bufferhe4d,項目名稱:call-IDE,代碼行數:29,代碼來源:BuildSys.java

示例2: createProject

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
/**
 * @return Factory method to create new Project instances
 */
protected static Project createProject() {
    final Project project = new Project();

    final ProjectHelper helper = ProjectHelper.getProjectHelper();
    project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
    helper.getImportStack().addElement("AntBuilder"); // import checks that stack is not empty 

    final BuildLogger logger = new NoBannerLogger();

    logger.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_INFO);
    logger.setOutputPrintStream(System.out);
    logger.setErrorPrintStream(System.err);

    project.addBuildListener(logger);

    project.init();
    project.getBaseDir();
    return project;
}
 
開發者ID:apache,項目名稱:groovy,代碼行數:23,代碼來源:AntBuilder.java

示例3: getErrorProject

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
/**
 * Constructs the Project and returns it.
 * 
 * @return The Project
 * @throws Exception
 *            If anything goes wrong.
 */
private Project getErrorProject() throws Exception {
   Path buildFilePath = Paths.get(BUILD_REPORT_FILE);
   LOG.finer("Build file path set to " + String.valueOf(buildFilePath));
   Project p = new Project();
   p.setSystemProperties();
   p.setUserProperty("ant.file", buildFilePath.toAbsolutePath().toString());
   LOG.finer("Project ant.file property set.");
   p.init();
   LOG.finer("Project.init() called.");
   ProjectHelper helper = ProjectHelper.getProjectHelper();
   LOG.finer("ProjectHelper created.");
   p.addReference("ant.projectHelper", helper);
   LOG.finer("Project ant.projectHelper reference set.");
   p.addReference("user.dir", System.getProperty("user.dir"));
   LOG.finer("Project user.dir reference set.");
   helper.parse(p, buildFilePath.toAbsolutePath().toFile());
   LOG.finer("PrjectHelper.parse() called.");
   errorProject = p;
   p.addBuildListener(getBuildListener());
   LOG.finer("BuildListener added.");
   return errorProject;
}
 
開發者ID:Loreinator,項目名稱:Shuffle-Move,代碼行數:30,代碼來源:ShuffleModel.java

示例4: createProject

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
/**
 * Creates and configures Ant project for Java task.
 * 
 * @return Ant project for Java task
 */
protected Project createProject()
{
    final Project result = new Project();

    final ProjectHelper helper = ProjectHelper.getProjectHelper();
    result.addReference( ProjectHelper.PROJECTHELPER_REFERENCE, helper );
    helper.getImportStack().addElement( "AntBuilder" ); // import checks that stack is not empty

    final BuildLogger logger = new NoBannerLogger();

    logger.setMessageOutputLevel( Project.MSG_INFO );
    logger.setOutputPrintStream( System.out );
    logger.setErrorPrintStream( System.err );

    result.addBuildListener( logger );

    result.init();
    result.setDefaultInputStream( System.in ); // for interactive commands, like "shell", needs more work!
    return result;
}
 
開發者ID:sbtrun-maven-plugin,項目名稱:sbtrun-maven-plugin,代碼行數:26,代碼來源:AbstractAntJavaBasedMojo.java

示例5: createProject

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
protected Project createProject()
{
    final Project project = new Project();

    final ProjectHelper helper = ProjectHelper.getProjectHelper();
    project.addReference( ProjectHelper.PROJECTHELPER_REFERENCE, helper );
    helper.getImportStack().addElement( "AntBuilder" ); // import checks that stack is not empty

    final BuildLogger logger = new NoBannerLogger();

    logger.setMessageOutputLevel( Project.MSG_INFO );
    logger.setOutputPrintStream( System.out );
    logger.setErrorPrintStream( System.err );

    project.addBuildListener( logger );

    project.init();
    project.getBaseDir();
    return project;
}
 
開發者ID:play1-maven-plugin,項目名稱:play1-maven-plugin,代碼行數:21,代碼來源:AbstractAntJavaBasedPlayMojo.java

示例6: newProject

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
private static Project newProject() throws IOException {
    setupBuildFile();
    Project project = new Project();
    project.setUserProperty("ant.file", buildFile.getAbsolutePath());
    project.init();
    DefaultLogger listener = new DefaultLogger();
    listener.setErrorPrintStream(System.err);
    listener.setOutputPrintStream(System.out);
    listener.setMessageOutputLevel(Project.MSG_INFO);
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    project.addReference("ant.projectHelper", helper);
    project.setProperty("ftp.port", String.valueOf(ftpPort));
    project.setProperty("ssh.port", String.valueOf(sshPort));
    helper.parse(project, buildFile);
    project.addBuildListener(listener);
    return project;
}
 
開發者ID:Alexey1Gavrilov,項目名稱:ExpectIt,代碼行數:18,代碼來源:AntHarnessTest.java

示例7: main

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
public static void main(String[] args) {

    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);

    File buildFile = new File("build.xml");
    Project p = new Project();
    p.addBuildListener(consoleLogger);
    p.setUserProperty("ant.file", buildFile.getAbsolutePath());
    p.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);
    p.executeTarget("test");

  }
 
開發者ID:perdian,項目名稱:ant-webstart,代碼行數:19,代碼來源:TestAnt.java

示例8: install

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
static void install(Map<String, String> options)
{
    // Initialize an Ant project from the build file
    Project project = new Project();
    project.setBaseDir(new File(System.getProperty("user.dir"))); // XXX current dir?

    ProjectHelper projectHelper = ProjectHelper.getProjectHelper();
    project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, projectHelper);
    URL buildResource = Installer.class.getResource("/build.xml");
    projectHelper.parse(project, buildResource);

    // Configure the project
    project.setProperty("ivySettings",
                Installer.class.getResource("/ivysettings.xml").toString());

    // Select the target operation

    String target;
    if (options.containsKey(OPT_TARGET))
        target = options.get(OPT_TARGET);
    else
        target = project.getDefaultTarget();

    // Install
    project.executeTarget(target);
}
 
開發者ID:mwoodiupui,項目名稱:DSpace-installer,代碼行數:27,代碼來源:Installer.java

示例9: invokeAntBuild

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
private File invokeAntBuild(String pathToBuildFile) throws URISyntaxException {
    File buildFile = new File(this.getClass().getResource(pathToBuildFile).toURI());

    File targetDirectory = createTemporaryOutputFolder();

    Project project = new Project();
    project.setUserProperty("ant.file", buildFile.getAbsolutePath());
    project.setUserProperty("targetDirectory", targetDirectory.getAbsolutePath());
    project.init();

    ProjectHelper helper = ProjectHelper.getProjectHelper();
    project.addReference("ant.projecthelper", helper);
    helper.parse(project, buildFile);

    project.executeTarget(project.getDefaultTarget());

    return targetDirectory;
}
 
開發者ID:fge,項目名稱:jsonschema2pojo,代碼行數:19,代碼來源:Jsonschema2PojoTaskIT.java

示例10: createProject

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
/**
 * @return Factory method to create new Project instances
 */
public static Project createProject() {
    final Project project = new Project();

    final ProjectHelper helper = ProjectHelper.getProjectHelper();
    project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
    helper.getImportStack().addElement("AntBuilder"); // import checks that stack is not empty

    project.addBuildListener(new AntLoggingAdapter());

    project.init();
    project.getBaseDir();
    return project;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:17,代碼來源:AntUtil.java

示例11: invokeAntBuild

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
private void invokeAntBuild(String pathToBuildFile) throws URISyntaxException {
    File buildFile = new File(this.getClass().getResource(pathToBuildFile).toURI());

    Project project = new Project();
    project.setUserProperty("ant.file", buildFile.getAbsolutePath());
    project.setUserProperty("targetDirectory", schemaRule.getGenerateDir().getAbsolutePath());
    project.init();

    ProjectHelper helper = ProjectHelper.getProjectHelper();
    project.addReference("ant.projecthelper", helper);
    helper.parse(project, buildFile);

    project.executeTarget(project.getDefaultTarget());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:Jsonschema2PojoTaskIT.java

示例12: compile

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
/**
 * Description: compile method that maintains the i/o streams after the task is done.
 * @param file path of the build xml to be executed
 * @param out current output stream
 * @param err current input stream
 */
public static void compile( String file, PrintStream out, PrintStream err) {
    
    // File buildFile = new File("build.xml");
    File buildFile = new File(file);
    Project p = new Project();
    p.setUserProperty("ant.file", buildFile.getAbsolutePath());     
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    
    p.addBuildListener(consoleLogger);
    
    try {
        p.fireBuildStarted();
        p.init();
        ProjectHelper helper = ProjectHelper.getProjectHelper();
        p.addReference("ant.projectHelper", helper);
        helper.parse(p, buildFile);
        p.executeTarget(p.getDefaultTarget());
        p.fireBuildFinished(null);
        System.setErr(err);
        System.setOut(out);
        
        
    } catch (Exception e) {}
}
 
開發者ID:bufferhe4d,項目名稱:call-IDE,代碼行數:34,代碼來源:BuildSys.java

示例13: parse

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
/**
 *
 * build.xml파일을 파싱처리하여
 * 빌드처리 준비상태로 처리한다.
 * 이후 run 함수를 호출하여 빌드를 실행할 수 있다.
 *
 * @작성자 : KYJ
 * @작성일 : 2017. 3. 7.
 */
public void parse() {

	p = new Project();
	p.setUserProperty("ant.file", buildFile.getAbsolutePath());
	p.setUserProperty("encoding", encoding.displayName());

	p.init();
	helper = ProjectHelper.getProjectHelper();
	p.addReference("ant.projectHelper", helper);

	if (baseDir != null && baseDir.exists())
		p.setBaseDir(baseDir);
	else
		p.setBaseDir(buildFile.getParentFile());

	//setting console
	DefaultLogger consoleLogger = getLogger();

	consoleLogger.setOutputPrintStream(new PrintStream(out));
	consoleLogger.setErrorPrintStream(new PrintStream(err));

	consoleLogger.setMessageOutputLevel(Project.MSG_VERBOSE);
	p.addBuildListener(consoleLogger);

	//parse build.xml
	helper.parse(p, buildFile);

	LOGGER.debug("  ##### base dir : " + p.getBaseDir());
	LOGGER.debug("  ##### default target : " + p.getDefaultTarget());

	//append build debugger.
	BuildListener buildListener = getBuildListener();
	if (buildListener != null)
		p.addBuildListener(buildListener);

	wasParse = true;
}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:47,代碼來源:AntJavaCompiler.java

示例14: executeAntTask

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
/**
 * @param filePath     with the file path
 * @param errorStream  with the error stream
 * @param outputStream with the output stream
 * @param temporaryDir with the temporary directory
 * @throws APIRestGeneratorException with an occurred exception
 */
public void executeAntTask(final String filePath,
                           final PrintStream errorStream,
                           final PrintStream outputStream,
                           final String temporaryDir) throws APIRestGeneratorException
{
    final File buildFile  = new File(this.generatorBuilderPath + File.separator + this.antFile);
    final Project project = this.generateProject(filePath, errorStream, outputStream, temporaryDir, buildFile);

    try
    {
        project.fireBuildStarted();
        project.init();

        final ProjectHelper projectHelper = ProjectHelper.getProjectHelper();
        project.addReference(ConstantsAnt.ANT_REF_PROJECT_HELPER, projectHelper);
        projectHelper.parse(project, buildFile);

        project.executeTarget(this.getGoalTask());
        project.fireBuildFinished(null);
    }
    catch (BuildException buildException)
    {
        project.fireBuildFinished(buildException);

        final String errorString = "BuildException while calling the ANT task with the following parameters: [antFile: " +
                                   this.antFile +
                                   ", filePath: " + filePath + "]";
        AbstractAntExecutor.LOGGER.error(errorString, buildException);
        throw new APIRestGeneratorException(errorString, buildException);
    }
}
 
開發者ID:BBVA-CIB,項目名稱:APIRestGenerator,代碼行數:39,代碼來源:AbstractAntExecutor.java

示例15: runAnt

import org.apache.tools.ant.ProjectHelper; //導入方法依賴的package包/類
/**
 * Execute an ant script.
 * 
 * @param buildFile the ant script
 * @throws Exception if ant script execution fails
 */
protected void runAnt(final File buildFile) throws Exception {
    final Project project = new Project();
    project.addBuildListener(new TestLogger());
    project.setCoreLoader(this.getClass().getClassLoader());
    project.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    project.addReference("ant.projectHelper", helper);
    helper.parse(project, buildFile);
    Vector < String > targets = new Vector < String >();
    targets.addElement(project.getDefaultTarget());
    project.executeTargets(targets);
}
 
開發者ID:legsem,項目名稱:legstar-cob2xsd,代碼行數:19,代碼來源:Cob2XsdTaskTest.java


注:本文中的org.apache.tools.ant.ProjectHelper.getProjectHelper方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。