本文整理汇总了Java中org.apache.tools.ant.taskdefs.Copy.setFile方法的典型用法代码示例。如果您正苦于以下问题:Java Copy.setFile方法的具体用法?Java Copy.setFile怎么用?Java Copy.setFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.taskdefs.Copy
的用法示例。
在下文中一共展示了Copy.setFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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()));
}
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}
}
示例5: 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];
}