1.3使用marven Spring项目快速搭建

自己开发了一个股票智能分析软件,功能很强大,需要的点击下面的链接获取:

https://www.cnblogs.com/bclshuai/p/11380657.html

1.3  Spring项目快速搭建

(1)marven介绍

marven是软件项目管理工具,可以方便的创建项目,管理依赖关系,自动从远程仓库下载依赖包到本地仓库m2文件夹中。

(2)dependency三要素

通过pom.xml文件配置依赖的jar包,会自动根据配置文件下载。依赖三要素

1)   groupId:组织标识

2)   artifactId:项目标识;

3)   version版本号;

<dependency>
         <groupId>com.hikvision.pbg.jc.ishelf</groupId>
         <artifactId>ishelf-web-business</artifactId>
         <version>${ishelf-web-business-version}</version>
      </dependency>

(2)<properities>定义属性

例如定义一个版本号,然后在version中使用${proname}来引用属性。

<properties>
<ishelf-web-business-version>2.0.0-SNAPSHOT</ishelf-web-business-version>
</properties>

pom.xml实例

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <parent>
      <groupId>com.hikvision.pbg.jc.ishelf</groupId>
      <artifactId>modules</artifactId>
      <version>2.0.0-SNAPSHOT</version>
   </parent>
  
   <artifactId>ishelf-web-provider</artifactId>
   <packaging>jar</packaging>
    <properties>
<ishelf-web-business-version>2.0.0-SNAPSHOT</ishelf-web-business-version>
</properties>

   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-web</artifactId>
      </dependency>
      <!-- 本服务的api接口包 -->
      <dependency>
         <groupId>com.hikvision.pbg.jc.ishelf</groupId>
         <artifactId>ishelf-web-external-api</artifactId>
         <version>2.0.0-SNAPSHOT</version>
      </dependency>
      <dependency>
         <groupId>com.hikvision.pbg.jc.ishelf</groupId>
         <artifactId>ishelf-web-business</artifactId>
         <version>${ishelf-web-business-version}</version>
      </dependency>
      <dependency>
         <groupId>com.hikvision.ga.common</groupId>
         <artifactId>hik-ga-boot-resteasy</artifactId>
      </dependency>
   </dependencies>

</project>
原文地址:https://www.cnblogs.com/bclshuai/p/13096114.html