/*
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();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
springboot2 + dubbo + mybatis入门教程示例源码
共192个文件
xml:151个
java:15个
properties:5个
需积分: 10 16 下载量 150 浏览量
2019-02-15
13:17:02
上传
评论
收藏 304KB ZIP 举报
温馨提示
springboot 2 整合 dubbo 2.6.2 + mybatis,参考dubbo官网的文档编写的一个springboot 2 整合 dubbo 的入门教程demo
资源推荐
资源详情
资源评论
收起资源包目录
springboot2 + dubbo + mybatis入门教程示例源码 (192个子文件)
mvnw.cmd 6KB
mvnw.cmd 6KB
mvnw.cmd 6KB
mvnw.cmd 6KB
.gitignore 269B
.gitignore 269B
.gitignore 269B
.gitignore 269B
spbt-dbo-user-consumer.iml 16KB
spbt-dbo-user-provider.iml 13KB
spbt-dbo-common.iml 10KB
spbt-dbo-basics.iml 979B
maven-wrapper.jar 47KB
maven-wrapper.jar 47KB
maven-wrapper.jar 47KB
maven-wrapper.jar 47KB
MavenWrapperDownloader.java 5KB
MavenWrapperDownloader.java 5KB
MavenWrapperDownloader.java 5KB
MavenWrapperDownloader.java 5KB
CommonResponse.java 3KB
SwaggerConfig.java 1KB
UserApi.java 1019B
UserServiceImpl.java 839B
TUser.java 751B
ProviderApplication.java 652B
ConsumerApplication.java 555B
ProviderApplicationTests.java 351B
ConsumerApplicationTests.java 342B
UserMapper.java 324B
UserService.java 282B
mvnw 9KB
mvnw 9KB
mvnw 9KB
mvnw 9KB
maven-wrapper.properties 116B
maven-wrapper.properties 116B
maven-wrapper.properties 116B
maven-wrapper.properties 116B
application.properties 16B
workspace.xml 33KB
uiDesigner.xml 9KB
pom.xml 3KB
pom.xml 2KB
pom.xml 2KB
Project_Default.xml 1KB
dubbo-provider.xml 1KB
pom.xml 1KB
compiler.xml 913B
dubbo-consumer.xml 812B
Maven__org_springframework_boot_spring_boot_starter_data_redis_2_1_2_RELEASE.xml 793B
Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_1_2_RELEASE.xml 793B
Maven__net_oschina_durcframework_fastmybatis_spring_boot_autoconfigure_1_0_2.xml 790B
Maven__org_springframework_boot_spring_boot_starter_data_jpa_2_1_2_RELEASE.xml 779B
Maven__com_github_pagehelper_pagehelper_spring_boot_autoconfigure_1_2_10.xml 774B
Maven__org_springframework_boot_spring_boot_starter_logging_2_1_2_RELEASE.xml 772B
Maven__org_springframework_boot_spring_boot_starter_tomcat_2_1_2_RELEASE.xml 765B
modules.xml 761B
Maven__org_springframework_boot_spring_boot_autoconfigure_2_1_2_RELEASE.xml 758B
Maven__org_hibernate_common_hibernate_commons_annotations_5_0_4_Final.xml 756B
Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_2_0_0.xml 754B
Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_9_8.xml 753B
Maven__org_springframework_boot_spring_boot_starter_json_2_1_2_RELEASE.xml 751B
Maven__org_springframework_boot_spring_boot_starter_jdbc_2_1_2_RELEASE.xml 751B
Maven__org_springframework_boot_spring_boot_starter_test_2_1_2_RELEASE.xml 751B
Maven__net_oschina_durcframework_fastmybatis_spring_boot_starter_1_0_2.xml 748B
Maven__org_springframework_plugin_spring_plugin_metadata_1_2_0_RELEASE.xml 745B
Maven__org_hibernate_javax_persistence_hibernate_jpa_2_1_api_1_0_0_Final.xml 744B
Maven__org_springframework_boot_spring_boot_starter_web_2_1_2_RELEASE.xml 744B
Maven__org_springframework_boot_spring_boot_starter_aop_2_1_2_RELEASE.xml 744B
Maven__com_github_pagehelper_pagehelper_spring_boot_starter_1_2_10.xml 732B
Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml 724B
Maven__org_springframework_data_spring_data_keyvalue_2_1_4_RELEASE.xml 723B
Maven__org_springframework_plugin_spring_plugin_core_1_2_0_RELEASE.xml 717B
Maven__org_springframework_spring_context_support_5_1_4_RELEASE.xml 717B
Maven__org_springframework_data_spring_data_commons_2_1_4_RELEASE.xml 716B
Maven__org_springframework_boot_spring_boot_starter_2_1_2_RELEASE.xml 716B
Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_9_8.xml 712B
Maven__com_alibaba_boot_dubbo_spring_boot_autoconfigure_0_2_0.xml 712B
Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_2_0_0.xml 712B
Maven__org_hibernate_validator_hibernate_validator_6_0_14_Final.xml 705B
Maven__org_springframework_data_spring_data_redis_2_1_4_RELEASE.xml 702B
Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_9_8.xml 698B
Maven__org_springframework_boot_spring_boot_test_2_1_2_RELEASE.xml 695B
Maven__org_springframework_data_spring_data_jpa_2_1_4_RELEASE.xml 688B
Maven__org_apache_tomcat_embed_tomcat_embed_websocket_9_0_14.xml 684B
Maven__org_springframework_spring_expression_5_1_4_RELEASE.xml 682B
Maven__com_alibaba_boot_dubbo_spring_boot_starter_0_2_0.xml 670B
Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_0.xml 668B
Maven__org_springframework_spring_aspects_5_1_4_RELEASE.xml 661B
Maven__org_springframework_spring_context_5_1_4_RELEASE.xml 661B
Maven__org_springframework_boot_spring_boot_2_1_2_RELEASE.xml 660B
Maven__com_alibaba_druid_spring_boot_starter_1_1_10.xml 657B
Maven__org_springframework_spring_webmvc_5_1_4_RELEASE.xml 654B
Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_14.xml 649B
Maven__com_fasterxml_jackson_core_jackson_databind_2_9_8.xml 647B
Maven__io_springfox_springfox_swagger_common_2_9_2.xml 647B
Maven__org_springframework_spring_beans_5_1_4_RELEASE.xml 647B
Maven__net_oschina_durcframework_fastmybatis_core_1_0_2.xml 643B
Maven__org_springframework_spring_core_5_1_4_RELEASE.xml 640B
共 192 条
- 1
- 2
资源评论
.诗书
- 粉丝: 2
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功