/*
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();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
springcloud zuul 网关实现源码 (153个子文件)
ThirdFilter.class 2KB
PreFilter.class 2KB
SecondFilter.class 2KB
DmGatewayZuulApplication.class 804B
DmGatewayZuulApplicationTests.class 659B
mvnw.cmd 6KB
.gitignore 333B
dm-gateway-zuul.iml 16KB
maven-wrapper.jar 47KB
MavenWrapperDownloader.java 5KB
PreFilter.java 2KB
ThirdFilter.java 1KB
SecondFilter.java 1KB
DmGatewayZuulApplication.java 443B
DmGatewayZuulApplicationTests.java 354B
HELP.md 1KB
mvnw 9KB
maven-wrapper.properties 116B
workspace.xml 15KB
pom.xml 2KB
compiler.xml 825B
Maven__org_springframework_cloud_spring_cloud_netflix_eureka_client_1_3_5_RELEASE.xml 801B
Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_6_RELEASE.xml 769B
Maven__org_springframework_cloud_spring_cloud_starter_archaius_1_3_5_RELEASE.xml 766B
Maven__org_springframework_cloud_spring_cloud_starter_hystrix_1_3_5_RELEASE.xml 759B
Maven__org_springframework_boot_spring_boot_starter_actuator_1_5_6_RELEASE.xml 755B
Maven__org_springframework_cloud_spring_cloud_starter_eureka_1_3_5_RELEASE.xml 752B
Maven__org_springframework_cloud_spring_cloud_starter_ribbon_1_3_5_RELEASE.xml 752B
Maven__org_springframework_boot_spring_boot_starter_logging_1_5_6_RELEASE.xml 748B
Maven__org_springframework_boot_spring_boot_starter_tomcat_1_5_6_RELEASE.xml 741B
Maven__org_springframework_cloud_spring_cloud_netflix_core_1_3_5_RELEASE.xml 738B
Maven__org_springframework_cloud_spring_cloud_starter_zuul_1_3_5_RELEASE.xml 738B
Maven__org_springframework_boot_spring_boot_autoconfigure_1_5_6_RELEASE.xml 734B
Maven__org_springframework_security_spring_security_crypto_4_2_3_RELEASE.xml 729B
Maven__org_springframework_boot_spring_boot_starter_test_1_5_6_RELEASE.xml 727B
Maven__org_springframework_boot_spring_boot_starter_web_1_5_6_RELEASE.xml 720B
Maven__org_springframework_security_spring_security_rsa_1_0_3_RELEASE.xml 708B
Maven__org_springframework_cloud_spring_cloud_context_1_2_4_RELEASE.xml 703B
Maven__org_springframework_cloud_spring_cloud_commons_1_2_4_RELEASE.xml 703B
Maven__org_springframework_cloud_spring_cloud_starter_1_2_4_RELEASE.xml 703B
Maven__com_fasterxml_jackson_module_jackson_module_afterburner_2_8_9.xml 701B
Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml 700B
Maven__org_springframework_boot_spring_boot_actuator_1_5_6_RELEASE.xml 699B
Maven__org_springframework_boot_spring_boot_starter_1_5_6_RELEASE.xml 692B
Maven__com_netflix_hystrix_hystrix_metrics_event_stream_1_5_12.xml 686B
Maven__io_netty_netty_transport_native_epoll_4_0_27_Final.xml 684B
Maven__org_springframework_boot_spring_boot_test_1_5_6_RELEASE.xml 671B
Maven__org_springframework_spring_expression_4_3_10_RELEASE.xml 665B
Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_16.xml 660B
Maven__com_netflix_netflix_commons_netflix_commons_util_0_1_1.xml 655B
Maven__com_sun_jersey_contribs_jersey_apache_client4_1_19_1.xml 653B
Maven__org_springframework_spring_context_4_3_10_RELEASE.xml 644B
Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_0.xml 644B
Maven__com_netflix_netflix_commons_netflix_statistics_0_1_1.xml 641B
Maven__org_springframework_spring_webmvc_4_3_10_RELEASE.xml 637B
Maven__com_netflix_hystrix_hystrix_serialization_1_5_12.xml 637B
Maven__org_springframework_boot_spring_boot_1_5_6_RELEASE.xml 636B
Maven__org_hibernate_hibernate_validator_5_3_5_Final.xml 634B
Maven__org_springframework_spring_beans_4_3_10_RELEASE.xml 630B
Maven__com_netflix_netflix_commons_netflix_eventbus_0_3_0.xml 627B
Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_16.xml 625B
Maven__commons_configuration_commons_configuration_1_8.xml 624B
Maven__org_springframework_spring_core_4_3_10_RELEASE.xml 623B
Maven__org_springframework_spring_test_4_3_10_RELEASE.xml 623B
Maven__com_fasterxml_jackson_core_jackson_databind_2_8_9.xml 623B
Maven__org_springframework_spring_aop_4_3_10_RELEASE.xml 616B
Maven__org_springframework_spring_web_4_3_10_RELEASE.xml 616B
Maven__commons_collections_commons_collections_3_2_2.xml 616B
Maven__com_netflix_ribbon_ribbon_loadbalancer_2_2_2.xml 612B
Maven__javax_validation_validation_api_1_1_0_Final.xml 611B
Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_16.xml 611B
Maven__org_codehaus_woodstox_woodstox_core_asl_4_4_1.xml 610B
Maven__org_jboss_logging_jboss_logging_3_3_1_Final.xml 608B
Maven__com_netflix_netflix_commons_netflix_infix_0_3_0.xml 606B
Maven__com_netflix_hystrix_hystrix_javanica_1_5_12.xml 602B
Maven__io_netty_netty_codec_http_4_0_27_Final.xml 600B
Maven__com_netflix_ribbon_ribbon_httpclient_2_2_2.xml 598B
Maven__com_fasterxml_jackson_core_jackson_core_2_8_9.xml 595B
Maven__io_netty_netty_transport_4_0_27_Final.xml 593B
Maven__com_netflix_ribbon_ribbon_transport_2_2_2.xml 591B
Maven__com_netflix_servo_servo_internal_0_10_1.xml 580B
Maven__io_netty_netty_handler_4_0_27_Final.xml 579B
Maven__com_netflix_archaius_archaius_core_0_7_4.xml 578B
Maven__org_apache_httpcomponents_httpclient_4_5_3.xml 577B
Maven__ch_qos_logback_logback_classic_1_1_11.xml 575B
Maven__com_netflix_hystrix_hystrix_core_1_5_12.xml 574B
Maven__io_netty_netty_common_4_0_27_Final.xml 572B
Maven__io_netty_netty_buffer_4_0_27_Final.xml 572B
Maven__com_netflix_ribbon_ribbon_eureka_2_2_2.xml 570B
Maven__com_netflix_eureka_eureka_client_1_6_2.xml 570B
Maven__io_reactivex_rxnetty_contexts_0_4_9.xml 567B
Maven__io_netty_netty_codec_4_0_27_Final.xml 565B
Maven__org_apache_httpcomponents_httpcore_4_4_6.xml 563B
Maven__org_bouncycastle_bcprov_jdk15on_1_55.xml 562B
Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml 562B
Maven__org_bouncycastle_bcpkix_jdk15on_1_55.xml 562B
Maven__com_sun_jersey_jersey_client_1_19_1.xml 561B
Maven__com_netflix_eureka_eureka_core_1_6_2.xml 556B
Maven__com_netflix_ribbon_ribbon_core_2_2_2.xml 556B
Maven__org_apache_commons_commons_lang3_3_1.xml 556B
共 153 条
- 1
- 2
资源评论
- fuyongliao2021-05-06里边只有几个JAVA文件,服务鉴权、路由、限流都没有
warleo
- 粉丝: 6
- 资源: 21
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 本资源库是关于“Java Collection Framework API”的参考资料,是 Java 开发社区的重要贡献,旨在提供有关 Java 语言学院 API 的实践示例和递归教育关系 .zip
- 插件: e2eFood.dll
- 打造最强的Java安全研究与安全开发面试题库,帮助师傅们找到满意的工作.zip
- (源码)基于Spark的实时用户行为分析系统.zip
- (源码)基于Spring Boot和Vue的个人博客后台管理系统.zip
- 将流行的 ruby faker gem 引入 Java.zip
- (源码)基于C#和ArcGIS Engine的房屋管理系统.zip
- (源码)基于C语言的Haribote操作系统项目.zip
- (源码)基于Spring Boot框架的秒杀系统.zip
- (源码)基于Qt框架的待办事项管理系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功