In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you how to build a development environment for Spring Cloud. The content is simple and easy to understand. It is clearly organized. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn this article "How to build a development environment for Spring Cloud".
2 Development environment
If a worker wants to do a good job, he must sharpen his tools first. Before describing the technical content of this book, build the development environment first. The basic environment involved in this book will be prepared in this chapter, including Eclipse, Maven, etc. If you are familiar with Maven, Eclipse, Spring Boot, etc., you can skip the relevant chapters in this chapter.
I recommend that readers use the same tools and editions as in this book. Java version 1.8 is used in this chapter. Figure 2-1 shows the output of the "java -version" command. Java installation and configuration are relatively simple, so this book will not describe them again.
Figure 2.1 Java version
Note: All cases in this book were developed and run under Windows 7.
2.1 Installation and Configuration Maven 2.1.1 About Maven
Maven is an open source project under Apache, used to build projects. Maven can be used to manage the dependency packages of the project and support the inheritance of build scripts. For some projects with more modules (child projects), Maven is a better choice. Child projects can inherit the build scripts of parent projects, reducing the redundancy of build scripts.
In addition, Maven's own plug-in mechanism makes it more powerful and flexible. Users can configure various Maven plug-ins to complete their own things. If they feel that the official or third-party Maven plug-ins are not enough, they can also write Maven plug-ins that meet their own requirements. Maven provides users with a unified dependency repository, where the distribution packages of various open source projects can be found, within a company or a project group, and even private Maven repositories can be built to put their own project packages into private repositories for use by other project groups or developers.
Among Maven's many features, the most important is its dependency management. Maven puts the information of dependency packages used by the project into the dependencies node of pom.xml. For example, we need to use the jar package of the spring-core module, just configure the dependency information of the module in pom.xml, and Maven will automatically introduce modules such as spring-beans into the environment variables of our project. Spring Cloud projects are built on Spring Boot. It is precisely because of the dependency management features that Maven and Spring Boot complement each other more, allowing us to build a usable development environment more quickly.
2.1.2 Download and install Maven
The version of Maven used in this book is version 3.5, which can be downloaded from Maven's official website: http://maven.apache.org/. Download and extract the apache-maven-3.5.0 directory, and add the bin directory under the main directory to the system environment variables, as shown in Figure 2-2.
Figure 2.2. Modifying Environment Variables
After configuration, open cmd command line, enter "mvn -v", you can see the output Maven version information. Dependency packages downloaded by Maven will be stored in the local repository. The default path is: C:\Users\username\.m2\repository.
2.1.3 Configuring Remote Warehouses
If you do not configure the repository, by default, you will download the dependency package to the Apache official repository. Since the Apache official repository is located abroad, the download speed is slow, which will reduce the development efficiency. The author recommends using the domestic Maven repository or building your own private service. The focus of this book is not Maven, so I directly use the Maven repository provided by Alibaba Cloud. Modify setting.xml in apache-maven-3.5.0/conf directory and add the following configuration under mirrors node:
alimaven aliyun maven http://maven.aliyun.com/nexus/content/groups/public/ central
After configuration, Maven will download dependency packages from Alibaba Cloud's repository in the future. It should also be noted that most of the cases in this book do not use Maven's inheritance features, and each Maven project can be introduced independently.
2.2 Install Eclipse version 2.2.1 Eclipse
Eclipse is used as a development tool in this book. Version Luna (4.4) is available at http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/lunasr2, or in the soft directory included with this book. Eclipse is now version 4.7, and this book focuses on using the Maven plug-in in Eclipse.
2.2.2 Configuring Maven in Eclipse
Luna version of Eclipse comes with Maven plug-in, the default use is Maven3.2, because we installed Maven3.5 version, so you need to specify the Maven version and configuration file in Eclipse. Specify the configuration of Maven as shown in Figure 2-3, and specify the configuration file as shown in Figure 2-4.
Figure 2.3 Eclipse specifies the Maven version
Figure 2-4. Specify the Maven configuration file
The above is all the content of "How to build a development environment for Spring Cloud". Thank you for reading it! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.