/*
* Copyright 2007-present the original author or authors.
*
* Licensed 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.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* 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/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".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 directory '" + 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 {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
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();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
spring-cloud.zip
共210个文件
xml:162个
java:15个
class:12个
需积分: 5 0 下载量 110 浏览量
2021-11-25
17:32:45
上传
评论
收藏 177KB ZIP 举报
温馨提示
springCloud的Eureka+Feign实现两个微服务之间的调用
资源详情
资源评论
资源推荐
收起资源包目录
spring-cloud.zip (210个子文件)
DogServiceImpl.class 1KB
TestSendController.class 996B
TestController.class 980B
Client002Application.class 859B
ClientApplication.class 844B
ServiceEurekaApplication.class 823B
Dog.class 784B
ServiceEurekaApplicationTests.class 564B
Client002ApplicationTests.class 544B
ClientApplicationTests.class 529B
TestService.class 452B
DogService.class 242B
.gitignore 395B
service-eureka.iml 18KB
client.iml 17KB
client002.iml 17KB
spring-cloud.iml 6KB
maven-wrapper.jar 50KB
MavenWrapperDownloader.java 5KB
TestController.java 884B
TestSendController.java 869B
DogServiceImpl.java 856B
TestService.java 670B
Dog.java 541B
Client002Application.java 503B
ClientApplication.java 494B
ServiceEurekaApplication.java 439B
SpringCloudApplication.java 338B
DogService.java 324B
SpringCloudApplicationTests.java 229B
ServiceEurekaApplicationTests.java 221B
Client002ApplicationTests.java 213B
ClientApplicationTests.java 207B
HELP.md 763B
maven-wrapper.properties 218B
application.properties 1B
application.properties 1B
application.properties 1B
application.properties 1B
application.properties 1B
application.properties 1B
application.properties 1B
workspace.xml 32KB
pom.xml 2KB
pom.xml 1KB
pom.xml 1KB
compiler.xml 910B
pom.xml 884B
Maven__org_springframework_cloud_spring_cloud_starter_netflix_eureka_server_2_0_0_RELEASE.xml 839B
Maven__org_springframework_cloud_spring_cloud_starter_netflix_eureka_client_2_0_0_RELEASE.xml 839B
Maven__org_springframework_cloud_spring_cloud_starter_netflix_archaius_2_0_0_RELEASE.xml 804B
Maven__org_springframework_cloud_spring_cloud_starter_netflix_ribbon_2_0_0_RELEASE.xml 790B
Maven__org_springframework_cloud_spring_cloud_netflix_eureka_client_2_0_0_RELEASE.xml 783B
Maven__org_springframework_cloud_spring_cloud_netflix_eureka_server_2_0_0_RELEASE.xml 783B
Maven__org_springframework_boot_spring_boot_actuator_autoconfigure_2_0_3_RELEASE.xml 779B
Maven__org_springframework_cloud_spring_cloud_starter_openfeign_2_0_0_RELEASE.xml 755B
Maven__org_springframework_boot_spring_boot_starter_freemarker_2_0_3_RELEASE.xml 751B
Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_0_3_RELEASE.xml 751B
Maven__org_springframework_cloud_spring_cloud_netflix_archaius_2_0_0_RELEASE.xml 748B
Maven__org_springframework_boot_spring_boot_starter_actuator_2_0_3_RELEASE.xml 737B
Maven__org_springframework_cloud_spring_cloud_openfeign_core_2_0_0_RELEASE.xml 734B
Maven__org_springframework_cloud_spring_cloud_netflix_ribbon_2_0_0_RELEASE.xml 734B
Maven__org_springframework_boot_spring_boot_starter_logging_2_0_3_RELEASE.xml 730B
Maven__org_springframework_boot_spring_boot_starter_tomcat_2_0_3_RELEASE.xml 723B
Maven__org_springframework_cloud_spring_cloud_netflix_core_2_0_0_RELEASE.xml 720B
Maven__com_fasterxml_jackson_module_jackson_module_jaxb_annotations_2_9_6.xml 718B
Maven__org_springframework_boot_spring_boot_autoconfigure_2_0_3_RELEASE.xml 716B
Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_9_6.xml 711B
Maven__org_springframework_security_spring_security_crypto_5_0_6_RELEASE.xml 711B
Maven__org_springframework_boot_spring_boot_starter_json_2_0_3_RELEASE.xml 709B
Maven__org_springframework_boot_spring_boot_starter_test_2_0_3_RELEASE.xml 709B
Maven__io_netty_netty_transport_native_unix_common_4_1_25_Final.xml 708B
Maven__org_springframework_boot_spring_boot_starter_aop_2_0_3_RELEASE.xml 702B
Maven__org_springframework_boot_spring_boot_starter_web_2_0_3_RELEASE.xml 702B
Maven__org_springframework_security_spring_security_rsa_1_0_5_RELEASE.xml 690B
Maven__org_springframework_cloud_spring_cloud_commons_2_0_0_RELEASE.xml 685B
Maven__org_springframework_cloud_spring_cloud_starter_2_0_0_RELEASE.xml 685B
Maven__org_springframework_cloud_spring_cloud_context_2_0_0_RELEASE.xml 685B
Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml 682B
Maven__org_springframework_boot_spring_boot_actuator_2_0_3_RELEASE.xml 681B
Maven__org_springframework_spring_context_support_5_0_7_RELEASE.xml 675B
Maven__org_springframework_boot_spring_boot_starter_2_0_3_RELEASE.xml 674B
Maven__com_fasterxml_jackson_dataformat_jackson_dataformat_xml_2_9_6.xml 671B
Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_9_6.xml 670B
Maven__io_netty_netty_transport_native_epoll_4_1_25_Final.xml 666B
Maven__org_hibernate_validator_hibernate_validator_6_0_10_Final.xml 663B
Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_9_6.xml 656B
Maven__org_springframework_boot_spring_boot_test_2_0_3_RELEASE.xml 653B
modules.xml 645B
Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_31.xml 642B
Maven__org_springframework_spring_expression_5_0_7_RELEASE.xml 640B
Maven__com_netflix_netflix_commons_netflix_commons_util_0_3_0.xml 637B
Maven__com_sun_jersey_contribs_jersey_apache_client4_1_19_1.xml 635B
misc.xml 633B
Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_0.xml 626B
Maven__com_netflix_netflix_commons_netflix_statistics_0_1_1.xml 623B
Maven__org_springframework_spring_context_5_0_7_RELEASE.xml 619B
Maven__org_springframework_boot_spring_boot_2_0_3_RELEASE.xml 618B
Maven__org_springframework_spring_webmvc_5_0_7_RELEASE.xml 612B
Maven__com_netflix_netflix_commons_netflix_eventbus_0_3_0.xml 609B
共 210 条
- 1
- 2
- 3
我乃流至清末
- 粉丝: 11
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0