common

gxt 5569aec081 ShardingJDBC配置 version 3.0 +xml中的sql 现在还有问题 il y a 2 ans
common-core 5569aec081 ShardingJDBC配置 version 3.0 +xml中的sql 现在还有问题 il y a 2 ans
common-security 680aa04416 ShardingJDBC配置 version 3.0 +1 il y a 2 ans
common-util 680aa04416 ShardingJDBC配置 version 3.0 +1 il y a 2 ans
.gitignore 1d450952c9 common first submission il y a 3 ans
README.md 49086f257e 2.0 common project scheme il y a 3 ans
pom.xml 680aa04416 ShardingJDBC配置 version 3.0 +1 il y a 2 ans
settings.xml 6371d6aa68 migrate to 114.115.206.163 il y a 3 ans

README.md

microarch_bg_common

@author: NewMeanning
@description: 功图诊断量液系统微架构 公共Maven工程

目录

|— microarch_bg_common // root 根工程
|—— common-core // 公共核心包
|———— com.gct.common.core.entity // 公用实体对象
|———— com.gct.common.core.result // 接口返回封装
|———— com.gct.common.core.util // 通用工具类
|—— common-security // 公共security安全包
|———— com.gct.common.security.core // security核心封装对象
|———— com.gct.common.security.util // security/jwt 工具类

引用说明

RELEASE:发布版本 ,生产环境引用
SNAPSHOT:快照版本 ,开发环境应用

1.配置maven

@description: 如果已经配置好maven 可以跳过此步骤; 此步骤为设置本地maven的settings.xml文件或工程中的pom.xml文件; 因为我们搭建并使用了nexus作为maven私服管理我们的工程以及依赖关系。

参考1
参考2

@attention: if you want to develop the common project,suggest to use local 'settings.xml' file to your 'maven' tool builder
找到maven的conf文件下的settings.xml,在<mirrors>标签下进行如下配置:

<mirrors> 
    <!--配置如下代码-->
	<mirror>
		<id>nexus</id>
		<name>maven-public</name>
		<url>http://117.34.118.57:28081/repository/maven-public/</url>
		<mirrorOf>*</mirrorOf>
	</mirror>
</mirrors>

如果需要将本地工程上传到nexus,还需如下配置(不需要可以跳过),进行如下配置:

①配置 <servers>

<servers>
    <!--配置如下代码-->
	<server>   
		<id>releases</id>   
		<username>admin</username>   
		<password>123456</password>   
	</server>
	<server>   
		<id>snapshots</id>   
		<username>admin</username>   
		<password>123456</password>   
	</server>
  </servers>

②配置<profiles>

<profiles>
    <profile>
      <activation>
          <!-- 默认激活此 profile -->
          <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>nexus</id>
          <name>Nexus Repository</name>
          <url>http://117.34.118.57:28081/repository/maven-public/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
        </repository>
      
        <repository>
          <id>central</id>
          <name>Nexus Central Repository</name>
          <url>http://117.34.118.57:28081/repository/maven-central/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        
        <repository>
          <id>release</id>
          <name>Nexus Release Repository</name>
          <url>http://117.34.118.57:28081/repository/maven-releases/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        
        <repository>
          <id>snapshots</id>
          <name>Nexus Snapshots Repository</name>
          <url>http://117.34.118.57:28081/repository/maven-snapshots/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      
      <pluginRepositories>
        <pluginRepository>
          <id>plugins</id>
          <name>Nexus Plugin Repositories</name>
          <url>http://117.34.118.57:28081/repository/maven-public/</url>
        </pluginRepository>
      </pluginRepositories>
    </profile>
</profiles>

③配置pom.xml文件:

<distributionManagement>
    <repository>
        <id>releases</id>
        <name>Nexus Release Repository</name>
        <url>http://117.34.118.57:28081/repository/maven-releases/</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <name>Nexus Snapshot Repository</name>
        <url>http://117.34.118.57:28081/repository/maven-snapshots/</url>
    </snapshotRepository>
</distributionManagement>

2.使用方式

项目工程pom.xml中引用对应的依赖即可,例:

 <dependency>
    <groupId>com.gct.common.core</groupId>
    <artifactId>common-core</artifactId>
    <version>1.0-RELEASE</version>
</dependency>

知识扩展

1.RELEASE与SNAPSHOT

maven中的仓库分为两种, snapshot快照仓库和release发布仓库。 snapshot快照仓库用于保存开发过程中的不稳定版本, release正式仓库则是用来保存稳定的发行版本。

2.选择,SNAPSHOT or RELEASE?

在开发阶段,可以将公用库的版本设置为快照版本,而被依赖组件则引用快照版本进行开发, 在公用库的快照版本更新后,我们也不需要修改pom文件提示版本号来下载新的版本, 直接mvn执行相关编译、打包命令即可重新下载最新的快照库了,从而也方便了我们进行开发。 因为,同一个SNAPSHOT版本的依赖可以多次发布(deploy)到仓库中, 也就是说同一个SNAPSHOT版本的依赖可以在仓库中存在多份, 每一份都是代码在某一个特定时间的快照,这也是SNAPSHOT的含义。 SNAPSHOT不是一个特定的版本,而是一系列的版本的集合, 其中HEAD总是指向最新的快照,对外界可见的一般也是最新版。

RELEASE一旦发布,就不可改变。 应用生产环境。