This topic describes the requirements for building the SOFABoot environment. It mainly involves the installation and configuration of JDK and Maven.
Install JDK
Version requirements
SOFABoot is developed based on the Spring Boot framework and requires JDK version ≥ 8.
Installation steps
Go to the Oracle official website to download and install the Java SE installation package that matches your operating system. For more information, see Install the JDK or Installation Guide.
Configure system environment variables. For more information, see Introduction and Configuration of PATH and CLASSPATH Variables.
Windows systems:
JAVA_HOME: Enter the installation path of the JDK, asC:/Program Files/Java/jdk1.8.0_181.PATH: Add the%JAVA_HOME%/binfolder path. Separate multiple paths with semicolons (;).
macOS and Linux: Example:
export JAVA_HOME=/${path_to_jdk_dir}/jdk1.8.0_181 export PATH=/${path_to_jdk_dir}/jdk1.8.0_181/bin:$PATHIf you use the binary installation package (dmg or RPM), you may not need to manually configure environment variables. You can skip to the next step to check if Java is available.
Check whether Java is installed:
$ java -versionNoteThe symbol $ is not required on Windows systems.
Install Apache Maven
Version requirements
SOFABoot requires Apache Maven version 3.2.5 or later.
Installation steps
Go to the official Apache Maven website to download the installation package.
Decompress the installation package file to the installation directory:
$ unzip apache-maven-3.6.1-bin.zipor
$ tar xzvf apache-maven-3.6.1-bin.tar.gzConfigure environment variables:
Windows:
M2_HOME: The installation path of Maven.PATH: Add a%M2_HOME%/binpath. Separate multiple paths with semicolons (;).
macOS and Linux: Example:
export M2_HOME=/${path_to_maven_dir}/apache-maven-3.6.1 export PATH=/${path_to_maven_dir}/apache-maven-3.6.1/bin:$PATH
Check whether Maven is successfully installed in the new shell terminal:
$ mvn -v
For more information, see Apache Maven documentation.
Modify the local configuration file of Maven
Modify steps
The JAR package of SOFABoot is not uploaded to the central repository of Maven. To download the dependent JAR packages when you build a project, you must:
Locate the
settings.xmlfile in the local Maven path. In different operating systems, you can refer to the following path to find.System global configuration file path:
Windows:$M2_HOME/conf/settings.xml
Linux or macOS: $M2_HOME/conf/settings.xml
NoteWhen both the user profile and the system profile are present, their contents are merged and the user settings.xml file dominates.
User Profile Path:
Windows:${user.home}/.m2/settings.xml. Example:
C:/Users/userName_XXX/.m2/settings.xmlNoteThe. m2 folder needs to comment out the
<localRepository>D:/maven/repository</localRepository>in the system global configuration file settings.xml, and then executemvn help:systemcommands are generated.The settings.xml file is not generated by the system by default and needs to be manually copied.
Linux or macOS: ${user.home}/.m2/settings.xml. Example:
/Users/userName_XXX/.m2/settings.xmlImportantOn Linux or macOS systems, the. m2 directory may be hidden. macOS can
Command + Shift + .to view; Linux can be viewed through theCtrl + H.
Click settings to download the Maven
settings.xmlfile and copy it to the path in Step 1 or overwrite thesettings.xmlfile in Step 1.NoteWhen you run the Maven command to create a project, the
settings.xmlfile in the default Maven installation path is used by default. recommend, copy the downloadedsettings.xmlfile to the. m2 directory. If there is a file with the same name in the. m2 directory, we recommend that you overwrite it.If you want to use the Maven
settings.xmlin a custom path, we recommend that you specify it bymvn -s "file_path"in the Maven command. Example:mvn -s "C:/apache-maven-3.3.3/conf/settingsXXX.xml".
Configuration description
After the overwrite operation in Step 2, the information that has been configured in the settings.xml mainly includes the profile tag.
profile tag: used to configure some global information and its activation conditions, mainly including some warehouse tags, the content is as follows:
<profile> <id>cloud-open-archetype</id> <activation> <activeByDefault>true</activeByDefault> </activation> <repositories> <repository> <id>archetype</id><!-- Don't change this! --> <url>http://mvn.cloud.alipay.com/nexus/content/groups/open</url> <releases> <enabled>true</enabled> <checksumPolicy>fail</checksumPolicy> </releases> <snapshots> <enabled>true</enabled> <checksumPolicy>warn</checksumPolicy> </snapshots> </repository> </repositories> </profile>