org.apache.tools.ant.taskdefs.Javac.createSrc()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.apache.tools.ant.taskdefs.Javac.createSrc()方法的一些代码示例,展示了Javac.createSrc()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Javac.createSrc()方法的具体详情如下:
包路径:org.apache.tools.ant.taskdefs.Javac
类名称:Javac
方法名:createSrc

Javac.createSrc介绍

[英]Adds a path for source compilation.
[中]为源代码编译添加路径。

代码示例

代码示例来源:origin: org.apache.ant/ant

/**
 * Recreate src.
 *
 * @return a nested src element.
 */
protected Path recreateSrc() {
  src = null;
  return createSrc();
}

代码示例来源:origin: org.codehaus.castor/castor-testsuite-xml-framework

/**
 * Compiles a directory tree. Throws a <code>CompilationException</code> if build fails.
 *
 * @param srcDir Source directory holding the files to be compiled.
 * @param destDir Destination directory to put the compiled classes in.
 */
private void compileDirectory(final File srcDir, final File destDir) {
 File[] entries = srcDir.listFiles();
 for (int i = 0; i < entries.length; i++) {
  File entry = entries[i];
  if (entry.isDirectory() && !IGNORE_DIRS.contains(entry.getName())) {
   compileDirectory(entry, destDir);
  }
 }
 entries = null;
 try {
  Path srcPath = _compiler.createSrc();
  srcPath.setLocation(destDir);
  _compiler.setSrcdir(srcPath);
  _compiler.execute();
 } catch (BuildException ex) {
  throw new CompilationException("Problem compiling directory " + srcDir, ex);
 }
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

public void compile(List files, CompilationUnit cu) {
    // forward options
    if (javac.getClasspath()==null) {
      javac.setClasspath(compileClasspath);
    }
    if (javac.getSourcepath()==null && compileSourcepath!=null) {
      javac.createSourcepath().add(compileSourcepath);
    }
    if (javac.getEncoding()==null) {
      javac.setEncoding(encoding);
    }
    javac.setDestdir(destDir);
    
    Path p = javac.createSrc();
    p.add(src);
    
    Path tmpDir = new Path(getProject());
    File dir = (File) cu.getConfiguration().getJointCompilationOptions().get("stubDir");
    tmpDir.setLocation(dir);
    p.add(tmpDir);
    javac.execute();
  }
};

相关文章