package com.cici;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List; import org.apache.commons.io.FileUtils; public class TestCopy {
private static List<File> files = new ArrayList(); public static void main(String[] args)
throws Exception
{
TestCopy tCP = new TestCopy();
copyJars("D:\\path1", "D:\\path2");
}
public static String getFilesuffix(String strs)
{
String ss[] = strs.split("\\.") ;
return ss[1];
}
public static void copyJars(String sourceDir, String destDir)
throws Exception
{
addJarsIntoList(sourceDir); File file = new File(destDir);
if (file.isDirectory())
{
for (File f : files) {
FileInputStream inputStream = new FileInputStream(f);
FileUtils.copyFile(f, new File(file.getPath() + "\\" + f.getName()));
}
}
}
public static void addJarsIntoList(String path1)
{
File dir = new File(path1);
if (dir.isDirectory())
{
File[] subFiles = dir.listFiles();
for (File file : subFiles)
//if it is file then we need to added into file list
if (file.isFile())
if (getFilesuffix(file.getName()).equals("jar"))
files.add(file);
//if it is not file it is just directory then we need to analize it then it into directory
else
addJarsIntoList(file.getAbsolutePath());
}
}
}

拷贝JAR包的更多相关文章

  1. maven 常用插件 拷贝依赖 拷贝jar包 查看属性 环境变量

    1 maven编译后希望将生产的jar包拷贝到指定目录 在pom中配置maven插件 maven-antrun-plugin <build > <plugins> <pl ...

  2. 解决IDEA部署web项目时,jar包拷贝不全的问题

    原因 先前已部署过,输出目录有lib文件夹. 再次部署时,IDEA一检测,发现输出目录已经存在lib文件夹,认为已经拷贝过了,为节省时间,不再重新拷贝jar包,殊不知我们新添加了jar包. 于是我们新 ...

  3. maven添加jar包依赖

    maven的东西使用了一段时间,但是每次使用都多少有点含糊,所以总结一下. 目前主要使用是在jar包的控制上 原理: 在本地,指定一个文件夹,便是maven的仓库,maven会从远程的中央仓库中下载你 ...

  4. Eclipse 将projectBuild Path中引用的jar包自己主动复制到WEB-INF下的lib目录下

    在用用 Eclipse进行Java Web开发时,web应用中引用的jar须要复制到WEB-INF下的lib目录下,否则常常出现ClassNotFound异常. 通过以下方法,能够不用手动拷贝jar包 ...

  5. Android 添加第三方jar包

    1,拷贝jar包到项目的\app\libs文件夹下. 2,打开项目下的build.gradle(Module:app)文件,在“dependencies {}”中添加“compile files('l ...

  6. 【spring boot】idea下springboot打包成jar包和war包,并且可以在外部tomcat下运行访问到(转)

    转自:https://www.cnblogs.com/sxdcgaq8080/p/7727249.html   接着上一章走呗:http://www.cnblogs.com/sxdcgaq8080/p ...

  7. 自动配置pom文件,构建maven项目jar包依赖关系,找到jar包运用到jmeter

    首先说下pom文件特别方便的优点: 什么是pom文件? POM(Project Object Model) 是Maven的基础. 它是一个XML文件,包含了Maven用来build项目所需要的项目配置 ...

  8. maven 如何依赖工程项目里面的 jar 包

    前言:现在有个 jar 包在私服和公共仓库里面都没有,需要自己将 jar 包放在工程里,然后让 maven 依赖. 这里举个栗子 项目路径: pom.xml 配置 <!--自定义查询组件的jar ...

  9. Maven项目打Jar包,如何添加依赖

    之前介绍了使用spring-boot-maven-plugin插件打jar包,会把所有的依赖文件都导入,然后变成了一个可执行的jar包.这样的不好的地方就是,我实际上并不需要把依赖的jar包也打入到生 ...

随机推荐

  1. (二分查找 拓展) leetcode278. First Bad Version

    You are a product manager and currently leading a team to develop a new product. Unfortunately, the ...

  2. webserver Etcd Cluster / CoreOS etcd / macOS etcd

    s https://coreos.com/etcd/ https://coreos.com/etcd/docs/latest/ macOS mojave etcd 003deMac-mini:~ ma ...

  3. EF CodeFirst系列(2)---CodeFirst的数据库初始化

    1. CodeFirst的默认约定 1.领域类和数据库架构的映射约定 在介绍数据库的初始化之前我们需要先了解领域类和数据库之间映射的一些约定.在CodeFirst模式中,约定指的是根据领域类(如Stu ...

  4. 如何解决failed to push some refs to git

    $ git push -u origin master To git@github.com:yangchao0718/cocos2d.git ! [rejected]        master -& ...

  5. 项目实战 redis 缓存

    1 首先在你的项目中,引用以下ServiceStack.Redis相关的四个类库.或者通过Nuget进行安装Redis常用组件ServiceStack.Redis. 下载示例代码. 2. 创建一个Re ...

  6. 一、Kubernetes系列之介绍篇

      •Kubernetes介绍 1.背景介绍 云计算飞速发展 - IaaS - PaaS - SaaS Docker技术突飞猛进 - 一次构建,到处运行 - 容器的快速轻量 - 完整的生态环境 2.什 ...

  7. LeetCode前100题(EASY难度)

    1 Two Sum Given an array of integers, return indices of the two numbers such that they add up to a s ...

  8. Python爬虫从入门到进阶(1)之Python概述及爬虫入门

    一.Python 概述 1.计算机语言概述 (1).语言:交流的工具,沟通的媒介 (2).计算机语言:人跟计算机交流的工具 (3).Python是计算机语言的一种 2.Python编程语言 代码:人类 ...

  9. pytorch multi-gpu train

    记录一下pytorch如何进行单机多卡训练: 官网例程:https://pytorch.org/tutorials/beginner/blitz/data_parallel_tutorial.html ...

  10. 让CPU占用率曲线听你指挥

    使用GetTickCount()和Sleep(): Code#include <stdio.h> #include <unistd.h> #include <time.h ...