/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.util.Properties;
public class MavenWrapperDownloader {
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL =
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: : " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
Springboot项目启动时加载数据库数据到内存.rar

共41个文件
java:9个
class:8个
xml:6个

需积分: 41 37 下载量 191 浏览量
2019-06-19
23:51:33
上传
评论
收藏 65KB RAR 举报
温馨提示
博客地址:https://blog.csdn.net/fukaiit/article/details/92853086 1. 启动后访问http://localhost:8848/code,可见控制台输出codeMap中的值 2. 新建一个只有key和value两个字段的表code 3. 不要轻易浪费积分下载代码,没什么实质内容
资源推荐
资源详情
资源评论


























收起资源包目录




















































































共 41 条
- 1
资源评论


fukaiit
- 粉丝: 105
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 5种ceemdan组合时间序列预测模型Python代码(包括ceemdan-lstm、ceemdan-cnn-lstm等)
- 江苏移动通信有限责任公司员工绩效考核实施细则精.doc
- 最新国家开放大学电大《优秀广告作品评析答案》网络核心课形考网考作业.docx
- 工程项目管理计划书.doc
- 基于PLC双轴位置控制.docx
- 基于复矢量PI控制器的模型参考自适应三相永磁同步电机高速低载波比无速度传感器控制仿真研究 - MATLAB 宝典
- 第8章-网络营销的策略组合.ppt
- (源码)基于NodeMCU的可视化通知提醒系统.zip
- 系统集成测试(SIT)报告.docx
- 基于MATLAB的GMSK系统的设计仿真.doc
- 离心风机辐射噪声仿真分析:从结构模态到声源辐射噪声的全流程解析 · 辐射噪声 深度版
- 专题讲座资料(2021-2022年)大工秋Java程序设计在线作业.docx
- (源码)基于Arduino的EDeliveryRobot.zip
- Comsol光子晶体仿真技术:拓扑荷、偏振态、三维能带及Q因子计算
- 基于非支配排序的多目标鱼鹰优化算法求解柔性作业车间调度问题的MATLAB实现
- (源码)基于多种编程语言和框架的物联网服务器与客户端.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
