maven构建系统项目的结构的体系确定
以单点登录学习的内容来说
项目整体结构图
1、总司令父工程
1、这是一个maven总司令父工程,所有的工程都在这个工程里面,里面会聚合各种其他的工程,请看下面的注释
2、这个工程主要是提供给其他工程一些一本的变量、参数
等
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.carl.auth</groupId>
<artifactId>sso</artifactId>
<version>1.6.0-RC2</version>
<packaging>pom</packaging>
<modules>
<!--相当于是tool工具类工程(这里放的是关于spring boot web启动的一些依赖,继承它工程进行使用),
比如下面的 sso-client-demo(客户端总工程,提供多个客户端工程) 继承sso-spring-dependencies 用来提供支持web服务,这样就不需要每次都继承下面的父类
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/>
</parent>
-->
<module>sso-spring-dependencies</module>
<module>sso-client-demo</module>
<module>sso-server</module>
<module>sso-config</module>
<module>sso-management</module>
</modules>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<cas.version>5.1.5</cas.version>
<springboot.version>1.5.3.RELEASE</springboot.version>
<spring-cloud.version>Dalston.SR4</spring-cloud.version>
<java.cas.client.version>3.4.1</java.cas.client.version>
</properties>
</project>
2、sso-server
普通的子工程
继承总司令工程,这个工程师CAS
的服务端工程,因为没有利用SpringBoot方式启动,所以不需要继承上面的sso-spring-dependencies
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.carl.auth</groupId>
<artifactId>sso</artifactId>
<version>1.6.0-RC2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>sso-server</artifactId>
<packaging>war</packaging>
<name>sso-server</name>
<description>CAS认证服务,负责各系统的鉴权的鉴权</description>
3、sso-spring-dependencies
工具工程
一般工具类是用来提供给其他工程依赖jar包的,但是这个是提供spring-boot
、web 服务的,需要继承核心parent
1、由于cas不能直接依赖spring-boot,所以其他项目统在此依赖,本工程用来提供给其他的工程springboot
web支持。
2、本工程继承于spring-boot-starter-parent
,被总司令sso聚合
<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/xsd/maven-4.0.0.xsd">
<!-- Inherit defaults from Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.carl.auth</groupId>
<artifactId>sso-spring-dependencies</artifactId>
<version>1.6.0-RC2</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.SR4</spring-cloud.version>
<shiro.version>1.4.0</shiro.version>
<buji.version>3.0.0</buji.version>
<pac4j.version>2.0.0</pac4j.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring-boot-web-starter</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.pac4j</groupId>
<artifactId>pac4j-cas</artifactId>
<version>${pac4j.version}</version>
</dependency>
<dependency>
<groupId>org.pac4j</groupId>
<artifactId>pac4j-jwt</artifactId>
<version>${pac4j.version}</version>
</dependency>
<dependency>
<groupId>org.pac4j</groupId>
<artifactId>pac4j-http</artifactId>
<version>${pac4j.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
4、sso-client-demo
,聚合一些臭味相投的工程
1、重点:父工程为:sso-spring-dependencies
2、聚合一些客户端工程,这些客户端工程需要spring-boot
的属性
<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/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.carl.auth</groupId>
<artifactId>sso-spring-dependencies</artifactId>
<version>1.6.0-RC2</version>
<relativePath>../sso-spring-dependencies</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<modules>
<module>sso-cas-client-demo</module>
<module>sso-client-shiro-demo</module>
<module>sso-client-proxy-demo</module>
</modules>
<artifactId>sso-client-demo</artifactId>
</project>
2、sso-client-demo
的子工程sso-client-demo
1、这是一个spring-boot工程
<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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sso-client-demo</artifactId>
<groupId>com.carl.auth</groupId>
<version>1.6.0-RC2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sso-cas-client-demo</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.jasig.cas.client</groupId>
<artifactId>cas-client-core</artifactId>
<version>3.4.1</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>