Spring

Maven-build-lifesycle

link on JianShu

Introduction to the Build Lifecycle

  • validate - validate the project is correct and all necessary information is available
  • compile - compile the source code of the project
  • test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
  • package - take the compiled code and package it in its distributable format, such as a JAR.
  • verify - run any checks on results of integration tests to ensure quality criteria are met
  • install - install the package into the local repository, for use as a dependency in other projects locally
  • deploy - done in the build environment, copies the final package to the remote repository for sharing with other developers and projects.

  • mvn clean package依次执行了clean、resources、compile、testResources、testCompile、test、jar(打包)等7个阶段。
  • mvn clean install依次执行了clean、resources、compile、testResources、testCompile、test、jar(打包)、install等8个阶段。
  • mvn clean deploy依次执行了clean、resources、compile、testResources、testCompile、test、jar(打包)、install、deploy等9个阶段。

  • package命令完成了项目编译、单元测试、打包功能,但没有把打好的可执行jar包(war包或其它形式的包)布署到本地maven仓库和远程maven私服仓库
  • install命令完成了项目编译、单元测试、打包功能,同时把打好的可执行jar包(war包或其它形式的包)布署到本地maven仓库,但没有布署到远程maven私服仓库
  • deploy命令完成了项目编译、单元测试、打包功能,同时把打好的可执行jar包(war包或其它形式的包)布署到本地maven仓库和远程maven私服仓库

Spring-boot服务(一)

link to JianShu

阿里云

  1. 目前阿里云新用户有优惠,89年一年。购买的是劵,然后用劵再正式开通服务,设置好用户名密码,默认22端口开通。可以远程访问。
  2. 阿里云实例列表–更多–网络和安全组–安全组配置–配置规则–增加入网的端口。这样才可以访问对应的端口
  3. 增加日常用户
  4. 安装mysql服务
  5. 安装maven sudo apt install maven,配置阿里云镜像。创建 .m2/settings.xml文件,内容如下——
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                              https://maven.apache.org/xsd/settings-1.0.0.xsd">
    <localRepository />
    <interactiveMode />
    <usePluginRegistry />
    <offline />
    <pluginGroups />
    <servers />
    <mirrors>
        <mirror>
        <id>nexus-aliyun</id>
        <mirrorOf>*</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
    </mirrors> 
    <proxies />
    <profiles />
    <activeProfiles />
</settings>


  
  
  

Spring-boot服务(二):aliyun

link on JianShu

从头再来。旧的镜像在我安装gitlab之后Gitlab CE,现在远程登录相当慢。重新初始化了一下镜像。使用强密码策略。

    1. 安装zsh+oh my zsh apt-get install -y zsh; sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    1. 安装Maven, git, java apt-get update; apt-get install -y maven git openjdk-8-jdk
    1. 生成SSH public key ssh-keygen -t rsa -b 4096 -C "e@example.com" 并配置多个key ~/.ssh/config 内容如下
    1. 安装mysqlhow-to-install-mysql-on-ubuntu-18-04
    1. 配置安全组策略,打开需要访问的端口。
Host github.com
    # Specifies the real host name to log into. Numeric IP addresses are also permitted.
    HostName github.com
    # Defines the username for the SSH connection.
    User gebitang
    # Specifies a file from which the user’s DSA, ECDSA or DSA authentication identity is read.
    IdentityFile ~/.ssh/id_rsa_github
Host gitlab.com
    # Specifies the real host name to log into. Numeric IP addresses are also permitted.
    HostName gitlab.com
    # Defines the username for the SSH connection.
    User gebitang
    # Specifies a file from which the user’s DSA, ECDSA or DSA authentication identity is read.
    IdentityFile ~/.ssh/id_rsa