/*
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
http://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框架直接复制模板写项目就可以了
共337个文件
xml:294个
java:11个
properties:9个
需积分: 50 17 下载量 112 浏览量
2019-02-19
18:06:16
上传
评论
收藏 320KB ZIP 举报
温馨提示
这个框架是我准备也毕业设计前搭的,刚刚开始很空。微服务,运用springcloud。每个model在main下有个.java类直接运行就可以了。
资源推荐
资源详情
资源评论
收起资源包目录
springcloud框架直接复制模板写项目就可以了 (337个子文件)
ZipkinServerApplication.class 865B
EurekaServerApplication.class 830B
EurekaServerApplicationTests.class 674B
ZipkinServerApplicationTests.class 674B
mvnw.cmd 6KB
mvnw.cmd 6KB
mvnw.cmd 6KB
mvnw.cmd 6KB
.gitignore 269B
.gitignore 269B
.gitignore 269B
.gitignore 269B
eureka-server.iml 18KB
zipkin-server.iml 17KB
login.iml 12KB
school_shop.iml 6KB
maven-wrapper.jar 47KB
maven-wrapper.jar 47KB
maven-wrapper.jar 47KB
MavenWrapperDownloader.java 5KB
MavenWrapperDownloader.java 5KB
MavenWrapperDownloader.java 5KB
ZipkinServerApplication.java 513B
EurekaServerApplication.java 442B
EurekaServerApplicationTests.java 362B
ZipkinServerApplicationTests.java 362B
SchoolShopApplicationTests.java 359B
LoginApplicationTests.java 348B
SchoolShopApplication.java 342B
LoginApplication.java 326B
mvnw 9KB
mvnw 9KB
mvnw 9KB
mvnw 9KB
application.properties 1KB
application.properties 1KB
application.properties 620B
application.properties 620B
application.properties 610B
application.properties 610B
maven-wrapper.properties 116B
maven-wrapper.properties 116B
maven-wrapper.properties 116B
workspace.xml 28KB
pom.xml 4KB
pom.xml 3KB
pom.xml 2KB
pom.xml 2KB
compiler.xml 912B
Maven__org_springframework_cloud_spring_cloud_starter_netflix_eureka_client_1_4_4_RELEASE.xml 857B
Maven__org_springframework_cloud_spring_cloud_starter_netflix_hystrix_dashboard_unknown.xml 843B
Maven__org_springframework_cloud_spring_cloud_starter_netflix_archaius_1_4_4_RELEASE.xml 822B
Maven__org_springframework_cloud_spring_cloud_starter_netflix_eureka_server_2_0_0_M8.xml 822B
Maven__org_springframework_cloud_spring_cloud_starter_netflix_eureka_client_unknown.xml 815B
Maven__org_springframework_cloud_spring_cloud_starter_netflix_ribbon_1_4_4_RELEASE.xml 808B
Maven__org_springframework_cloud_spring_cloud_netflix_eureka_client_1_4_4_RELEASE.xml 801B
Maven__org_springframework_boot_spring_boot_actuator_autoconfigure_2_1_3_RELEASE.xml 797B
Maven__org_springframework_cloud_spring_cloud_starter_netflix_archaius_2_0_0_M8.xml 787B
Maven__org_jboss_spec_javax_annotation_jboss_annotations_api_1_2_spec_1_0_2_Final.xml 783B
Maven__org_jboss_spec_javax_annotation_jboss_annotations_api_1_2_spec_1_0_0_Final.xml 783B
Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_10_RELEASE.xml 776B
Maven__org_springframework_cloud_spring_cloud_starter_netflix_ribbon_2_0_0_M8.xml 773B
Maven__org_springframework_cloud_spring_cloud_starter_netflix_hystrix_unknown.xml 773B
Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_1_3_RELEASE.xml 769B
Maven__org_springframework_boot_spring_boot_starter_freemarker_2_1_3_RELEASE.xml 769B
Maven__org_springframework_cloud_spring_cloud_netflix_eureka_server_2_0_0_M8.xml 766B
Maven__org_springframework_cloud_spring_cloud_netflix_eureka_client_2_0_0_M8.xml 766B
Maven__org_jboss_spec_javax_websocket_jboss_websocket_api_1_1_spec_1_1_0_Final.xml 765B
Maven__org_jboss_spec_javax_websocket_jboss_websocket_api_1_1_spec_1_1_3_Final.xml 765B
Maven__org_springframework_boot_spring_boot_starter_undertow_1_5_10_RELEASE.xml 762B
Maven__org_springframework_boot_spring_boot_starter_actuator_1_5_10_RELEASE.xml 762B
Maven__org_springframework_boot_spring_boot_starter_logging_1_5_10_RELEASE.xml 755B
Maven__org_springframework_boot_spring_boot_starter_undertow_2_1_3_RELEASE.xml 755B
Maven__org_springframework_boot_spring_boot_starter_actuator_2_1_3_RELEASE.xml 755B
Maven__org_springframework_cloud_spring_cloud_starter_zipkin_1_3_3_RELEASE.xml 752B
Maven__org_springframework_cloud_spring_cloud_starter_sleuth_1_3_3_RELEASE.xml 752B
Maven__org_springframework_boot_spring_boot_starter_tomcat_1_5_10_RELEASE.xml 748B
Maven__org_springframework_boot_spring_boot_starter_logging_2_1_3_RELEASE.xml 748B
Maven__org_springframework_cloud_spring_cloud_sleuth_zipkin_1_3_3_RELEASE.xml 745B
Maven__org_springframework_boot_spring_boot_autoconfigure_1_5_10_RELEASE.xml 741B
Maven__org_springframework_boot_spring_boot_starter_log4j2_2_1_3_RELEASE.xml 741B
Maven__org_springframework_boot_spring_boot_starter_tomcat_2_1_3_RELEASE.xml 741B
Maven__org_springframework_cloud_spring_cloud_netflix_core_1_4_4_RELEASE.xml 738B
Maven__io_zipkin_java_zipkin_autoconfigure_metrics_prometheus_2_9_4.xml 736B
Maven__com_fasterxml_jackson_module_jackson_module_jaxb_annotations_2_9_3.xml 736B
Maven__org_springframework_boot_spring_boot_autoconfigure_2_1_3_RELEASE.xml 734B
Maven__org_springframework_boot_spring_boot_starter_test_1_5_10_RELEASE.xml 734B
Maven__org_springframework_cloud_spring_cloud_sleuth_core_1_3_3_RELEASE.xml 731B
Maven__org_springframework_cloud_spring_cloud_netflix_archaius_2_0_0_M8.xml 731B
Maven__org_springframework_security_spring_security_crypto_4_2_4_RELEASE.xml 729B
Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_9_8.xml 729B
Maven__org_springframework_security_spring_security_crypto_5_1_4_RELEASE.xml 729B
Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_9_3.xml 729B
Maven__org_springframework_boot_spring_boot_starter_json_2_1_3_RELEASE.xml 727B
Maven__org_springframework_boot_spring_boot_starter_web_1_5_10_RELEASE.xml 727B
Maven__org_springframework_boot_spring_boot_starter_jdbc_2_1_3_RELEASE.xml 727B
Maven__org_springframework_boot_spring_boot_starter_aop_1_5_10_RELEASE.xml 727B
Maven__org_springframework_boot_spring_boot_starter_test_2_1_3_RELEASE.xml 727B
Maven__io_netty_netty_transport_native_unix_common_4_1_33_Final.xml 726B
Maven__org_springframework_boot_spring_boot_starter_aop_2_1_3_RELEASE.xml 720B
共 337 条
- 1
- 2
- 3
- 4
资源评论
行走的地瓜
- 粉丝: 57
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功