/*
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();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
J2ee实验报告1-3.rar (420个子文件)
08307772320ff66025c8ff50301aacb5a57871 230B
09e358f41e3ed4ee3c6e164ef79c0624ec2d26 589B
0e91ff3a67e4193136be53c092e3899016526b 46B
183f26ba2868751105c709d46648ba89bea517 46B
18675ff67c8defefd0f760390b1d2d1bb71604 114B
1931b6e097e3241d57c98388ba62f91694c885 128B
1f5d090f4f55486110cf6ef08e6eac77baed6b 77B
1f8d6c2617cdc09da6aa72e5853c642189b847 165B
29eb15fac0073630cd1bae6aa14baa678be136 50B
2d02242f12dde5db35e4a0c9dbe2269e746885 46B
2e23546f32f241571c4f49f6551a4e98a5ae28 1022B
36a41064904ec22efad4f5fc6bc400ccad978a 101B
45242763307cf3d4af8cba55dabef425e5c65e 210B
49ee0a06832665dcd44fc6279df9bf146cb661 64B
5541a66d59d1060bacd3405d78fafc634ddff2 45B
5e16968830fc74620d31c0f28eb45d98c20757 164B
600c38c5c103230db7497800474145cc10855e 57B
60dbbb49eea6b756663df07c699222fcece365 61B
611c1bf7bd384b6a07ebbf87fba48f3308ba87 211B
677ecd3ac5f9f5e6c517411785fd77c25aa288 50B
6957261f705d5de68e38709d1c6f9e90e47a3a 46B
7d60e67661f7e14b8aa0914a6d2805ac6a59e8 86B
7eb0a97c8a650fd9bd117eb8da68be056b6fb5 46B
818d64fba6683ac040c110e1b233a2b25b7d5b 81B
918c7a3685c8daaf7c4d10173a730a9d60c88b 175B
97a7f1cb2389f85fe6381425d29f0a9866fb65 87B
9de29bb2d1d6434b8b29ae775ad8c2e48c5391 15B
9e0dbe9117e8ac8c065c9951eca7b52f76ff5d 595B
a3f6fbfa39438547815ff7cbd2825e1facab5b 652B
a6e3ee048028ca478dd2870e336184989ff12f 85B
ab3b4599faea9f42e9235393e81cca4667d32c 85B
b078875f2264bca06b7de217edf4045f5fe52b 246B
b355b8da107a8103d4961ff2eab950e477e282 296B
b5ef00b3c6a540303c327aab44e8c0ffad0e89 47B
bf8ae4a07147ab37c39bb9bd6000893f0a9a0f 59B
c02d52334e392f752c602cddaf15b16d7d3b0a 45B
c1203063aeddd0bd4b4834d246122a315ca527 87B
c144f5095a3fa7220f628188ab8331a5244376 59B
cc3a2ebc13a4c31822a3a557a1183dc0319776 90B
JsonStudentServlet.class 6KB
JsonStudentServlet.class 6KB
JsonStudentServlet.class 6KB
JsonStudentServlet.class 6KB
DBStudentServlet.class 5KB
DBStudentServlet.class 5KB
CustomerController.class 4KB
StudentController.class 4KB
StudentController.class 4KB
DBStudentController.class 4KB
DBStudentController.class 4KB
Order.class 4KB
DBStudentController3.class 3KB
DBStudentController3.class 3KB
Customer.class 3KB
StudentServlet.class 3KB
StudentServlet.class 3KB
StudentServlet.class 3KB
StudentServlet.class 3KB
BuyService.class 3KB
StudentServlet.class 3KB
StudentServlet.class 3KB
StudentService.class 3KB
StudentService.class 3KB
DBStudentController2.class 2KB
DBStudentController2.class 2KB
Product.class 2KB
SwaggerConfig.class 2KB
SwaggerConfig.class 2KB
SwaggerConfig.class 2KB
DBStudentServlet.class 2KB
App.class 2KB
ScheduleDemo.class 2KB
Money.class 2KB
Student.class 2KB
Student.class 2KB
OrderLine.class 2KB
BuyController.class 1KB
ProductController.class 1KB
ListServlet.class 1KB
Student.class 1KB
Student.class 1KB
Student.class 1KB
Student.class 1KB
Student.class 1KB
Student.class 1KB
OrderController.class 1KB
Address.class 1KB
Student.class 1KB
MyServlet.class 1KB
OrderState.class 1000B
DemoSpringBoot1Application.class 883B
Student.class 839B
DemoSpringBoot1Application.class 817B
DemoSpringBoot2Application.class 817B
CustomerDao.class 803B
Email.class 758B
DemoSpringBoot1ApplicationTests.class 639B
DemoSpringBoot2ApplicationTests.class 639B
DemoSpringBoot1ApplicationTests.class 639B
ProductDao.class 635B
共 420 条
- 1
- 2
- 3
- 4
- 5
资源评论
CHYOU3
- 粉丝: 5
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- MMDF1N05ER2G-VB一款SOP8封装2个N-Channel场效应MOS管
- zipkin-server-3.3.0-exec.jar
- MI9933-VB一款SOP8封装2个P-Channel场效应MOS管
- zipkin-server-2.24.4-exec.jar
- MI4953-VB一款SOP8封装2个P-Channel场效应MOS管
- 基于Akka模拟实现Spark Standalone.pdf
- MI4946-VB一款SOP8封装2个N-Channel场效应MOS管
- 毕业答辩模板(动态模板)苹果IOS星空通用论文答辩模板
- 有效cookie值获取方式汇总
- 基于python实现的英雄联盟知识图谱问答系统源码(期末大作业).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功