• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Copy类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: copyFile

import org.apache.tools.ant.taskdefs.Copy; //导入依赖的package包/类
static public void copyFile(File src, File obj) {
	final class AntCopy extends Copy {
		@SuppressWarnings("deprecation")
		public AntCopy() {
			project = new Project();
			project.init();
			taskType = "copy";
			taskName = "copy";
			target = new Target();
		}
	}

	AntCopy ant = new AntCopy();
	ant.setFile(src);
	ant.setTofile(obj);
	ant.execute();
}
 
开发者ID:AbnerLin,项目名称:PLWeb-Destop-Version,代码行数:18,代码来源:AntTask.java


示例2: copySet

import org.apache.tools.ant.taskdefs.Copy; //导入依赖的package包/类
private void copySet(LayoutFileSet set) {
    Copy task = new Copy();
    task.setTaskName("copy");
    task.setProject(getProject());
    String prefix = set.getPrefix(getProject());
    File target = prefix.length() > 0 ? new File(destDirectory, prefix + "/") : destDirectory;

    target.mkdirs();

    task.setTodir(target);
    LayoutFileSet unprefixed = (LayoutFileSet) set.clone();
    unprefixed.setPrefix("");

    task.addFileset(unprefixed);
    task.perform();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RootContainer.java


示例3: copyFiles

import org.apache.tools.ant.taskdefs.Copy; //导入依赖的package包/类
/**
 * Move java or class files to temp files or moves the temp files back to
 * java or class files. This must be done because javac is too nice and
 * sticks already compiled classes and ones depended on in the classpath
 * destroying the compile time wall. This way, we can keep the wall up.
 * 
 * @param srcDir
 *            Directory to copy files from/to(Usually the java files dir or
 *            the class files dir)
 * @param fileset
 *            The fileset of files to include in the move.
 * @param moveToTempFile
 *            true if moving src files to temp files, false if moving temp
 *            files back to src files.
 * @param isJavaFiles
 *            true if we are moving .java files, false if we are moving
 *            .class files.
 */
private void copyFiles(File srcDir, File destDir, FileSet fileset) {

	fileset.setDir(srcDir);
	if (!srcDir.exists())
		throw new BuildException("Directory=" + srcDir + " does not exist", getLocation());

	// before we do this, we have to move all files not
	// in the above fileset to xxx.java.ant-tempfile
	// so that they don't get dragged into the compile
	// This way we don't miss anything and all the dependencies
	// are listed or the compile will break.
	Copy move = (Copy) getProject().createTask("SilentCopy");
	move.setProject(getProject());
	move.setOwningTarget(getOwningTarget());
	move.setTaskName(getTaskName());
	move.setLocation(getLocation());
	move.setTodir(destDir);
	// move.setOverwrite(true);
	move.addFileset(fileset);
	move.perform();
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:40,代码来源:CompileWithWalls.java


示例4: signOrCopy

import org.apache.tools.ant.taskdefs.Copy; //导入依赖的package包/类
/**
 * Signs or copies the given files according to the signJars variable value.
 */
private void signOrCopy(File from, File to) {
    if (!from.exists() && from.getParentFile().getName().equals("locale")) {
        // skip missing locale files, probably the best fix for #103301
        log("Localization file " + from + " is referenced, but cannot be found. Skipping.", Project.MSG_WARN);
        return;
    }
    if (signJars) {
        getSignTask().setJar(from);
        if (to != null) {
            // #125970: might be .../modules/locale/something_ja.jar
            to.getParentFile().mkdirs();
        }
        getSignTask().setSignedjar(to);
        getSignTask().setDigestAlg("SHA1");
        getSignTask().execute();
    } else if (to != null) {
        Copy copy = (Copy)getProject().createTask("copy");
        copy.setFile(from);
        copy.setTofile(to);
        copy.execute();
    }        
    if (processJarVersions) {
      if (jarDirectories == null) {
        jarDirectories = new HashSet<>();
      }
      jarDirectories.add(new File(to.getParent()));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:MakeJNLP.java


示例5: copyFile

import org.apache.tools.ant.taskdefs.Copy; //导入依赖的package包/类
private void copyFile(File src, File dest) {
    Copy copyTask = (Copy) getProject().createTask("copy"); //NOI18N
    copyTask.setFile(src);
    copyTask.setTodir(dest);
    copyTask.setFailOnError(false);
    copyTask.init();
    copyTask.setLocation(getLocation());
    copyTask.execute();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:GenerateJnlpFileTask.java


示例6: copyDirectory

import org.apache.tools.ant.taskdefs.Copy; //导入依赖的package包/类
public static void copyDirectory(File source, File dest) {
    Project p = new Project();
    Copy c = new Copy();
    c.setProject(p);
    c.setTodir(dest);
    FileSet fs = new FileSet();
    fs.setDir(source);
    c.addFileset(fs);
    c.execute();
}
 
开发者ID:epam,项目名称:Wilma,代码行数:11,代码来源:LauncherUtils.java


示例7: installApp

import org.apache.tools.ant.taskdefs.Copy; //导入依赖的package包/类
protected void installApp(Artifact artifact) throws Exception {
    
    if (artifact.getFile() == null || artifact.getFile().isDirectory()) {
        String warName = getAppFileName(project);
        File f = new File(project.getBuild().getDirectory() + "/" + warName);
        artifact.setFile(f);
    }
    
    if (!artifact.getFile().exists()) {
        throw new MojoExecutionException(messages.getString("error.install.app.missing"));
    }
    
    File destDir = new File(serverDirectory, getAppsDirectory());
    log.info(MessageFormat.format(messages.getString("info.install.app"), artifact.getFile().getCanonicalPath()));
    
    Copy copyFile = (Copy) ant.createTask("copy");
    copyFile.setFile(artifact.getFile());
    String fileName = artifact.getFile().getName();
    if (stripVersion) {
        fileName = stripVersionFromName(fileName, artifact.getBaseVersion());
        copyFile.setTofile(new File(destDir, fileName));
    } else {
        copyFile.setTodir(destDir);
    }
    
    // validate application configuration if appsDirectory="dropins" or inject webApplication
    // to target server.xml if not found for appsDirectory="apps"
    validateAppConfig(fileName, artifact.getArtifactId());
    
    deleteApplication(new File(serverDirectory, "apps"), artifact.getFile());
    deleteApplication(new File(serverDirectory, "dropins"), artifact.getFile());
    // application can be expanded if server.xml configure with <applicationManager autoExpand="true"/>
    deleteApplication(new File(serverDirectory, "apps/expanded"), artifact.getFile());
    copyFile.execute();
}
 
开发者ID:WASdev,项目名称:ci.maven,代码行数:36,代码来源:InstallAppMojoSupport.java


示例8: copyClassFiles

import org.apache.tools.ant.taskdefs.Copy; //导入依赖的package包/类
private void copyClassFiles(File jspCompileDir) {
    Copy copy = new Copy();
    copy.setProject(getProject());
    copy.setTaskName(getTaskName());
    destdir.mkdirs();
    copy.setTodir(destdir);
    FileSet files = new FileSet();
    files.setDir(jspCompileDir);
    files.setIncludes("**/*.class");
    copy.addFileset(files);
    copy.execute();
}
 
开发者ID:WASdev,项目名称:ci.ant,代码行数:13,代码来源:CompileJSPs.java


示例9: copyIcon

import org.apache.tools.ant.taskdefs.Copy; //导入依赖的package包/类
void copyIcon() throws BuildException {
    if (parent.getIcon() != null && parent.getIcon().isFile()) {
        Copy cp = createTask(Copy.class);
        cp.setTodir(resourcesDir);
        cp.setFile(parent.getIcon());
        cp.execute();
    }
}
 
开发者ID:andrus,项目名称:japp-maven-plugin,代码行数:9,代码来源:JAppMacWorker.java


示例10: copyJars

import org.apache.tools.ant.taskdefs.Copy; //导入依赖的package包/类
void copyJars() {
    if (!parent.getLibs().isEmpty()) {
        Copy cp = createTask(Copy.class);
        cp.setTodir(javaDir);
        cp.setFlatten(true);

        for (FileSet fs : parent.getLibs()) {
            cp.addFileset(fs);
        }

        cp.execute();
    }
}
 
开发者ID:andrus,项目名称:japp-maven-plugin,代码行数:14,代码来源:JAppMacWorker.java


示例11: RenamedFileContainer

import org.apache.tools.ant.taskdefs.Copy; //导入依赖的package包/类
public RenamedFileContainer() {
  copyTask = new Copy();
  copyTask.setTaskName("copy");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:RenamedFileContainer.java


示例12: signOrCopy

import org.apache.tools.ant.taskdefs.Copy; //导入依赖的package包/类
/**
 * Signs or copies the given files according to the signJars variable value.
 */
private JarConfigResolved signOrCopy(File from, File to)
{
    final JarConfigResolved[] jarConfigResolved = new JarConfigResolved[1];

    if (!from.exists() && from.getParentFile().getName().equals("locale")) {
        // skip missing locale files, probably the best fix for #103301
        log("Localization file " + from + " is referenced, but cannot be found. Skipping.", Project.MSG_WARN);
        return jarConfigResolved[0];
    }

    if (signJars) {

        if (to != null) {
            // #125970: might be .../modules/locale/something_ja.jar
            to.getParentFile().mkdirs();
        }

        SignJar signJar = createSignTask();

        signJar.setSigningListener(
            new SignJar.SigningListener()
            {
                @Override
                public void beforeSigning( JarConfigResolved jarConfig )
                {
                    jarConfigResolved[0] = jarConfig;
                }
            });

        signJar.setJar( from );
        signJar.setSignedjar( to );

        signJar.execute();

    } else if (to != null) {
        Copy copy = (Copy)getProject().createTask("copy");
        copy.setFile(from);
        copy.setTofile(to);
        copy.execute();
    }

    if (processJarVersions)
    {
      if (jarDirectories == null)
      {
        jarDirectories = new HashSet<File>();
      }

      jarDirectories.add(new File(to.getParent()));
    }

    return jarConfigResolved[0];
}
 
开发者ID:bitstrings,项目名称:nbm-maven,代码行数:57,代码来源:MakeJnlp2.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Ad类代码示例发布时间:2022-05-21
下一篇:
Java ObjectConstructor类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap