1:Maven 项目管理工具
1.1:maven是什么?
Maven是基于项目对象模型(POM project object model),可以通过一小段描述信息(配置)来管理项目的构建,报告和文档的软件项目管理工具
Maven 是一个项目管理工具,可以对 Java 项目进行构建、依赖管理
核心功能:
通过pom.xml来引入其他jar包的依赖
这种又是大白话,如果没明白maven是什么,那么上面这句话跟没说一样,我自己觉得,Maven的核心功能便是合理叙述项目间的依赖关系,通俗点讲,就是通过pom.xml文件的配置获取jar包,而不用手动去添加jar包,而这里pom.xml文件对于学了一点maven的人来说,就有些熟悉了,怎么通过pom.xml的配置就可以获取到jar包呢?pom.xml配置文件从何而来?等等类似问题我们需要搞清楚,如果需要使用pom.xml来获取jar包,那么首先该项目就必须为maven项目,maven项目可以这样去想,就是在java项目和web项目的上面包裹了一层maven,本质上java项目还是java项目,web项目还是web项目,但是包裹了maven之后,就可以使用maven提供的一些功能了(通过pom.xml添加jar包)。
1.2maven里面仓库的概念
通过pom.xml中的配置,就能够获取到想要的jar包(还没讲解如何配置先需要了解一下仓库的概念),但是这些jar是在哪里呢?就是我们从哪里获取到的这些jar包?答案就是仓库。
仓库分为:本地仓库、第三方仓库(私服)、中央仓库
仓库具体学习路径请点击此处
pom.xml里面引入的依赖和插件的区别和联系
1.依赖是指开发的程序本身的本身需要调用的类的jar包。
2.插件是一种tool,安装了它并不会直接给开发的程序带了什么,而绝大多数情况是指给我们开发人员带来方便。
插件是一个工具,依赖是一个包。它们的本质都是jar包
pom.xml里面标签的详解
1:全局pom
<?xml version="1.0" encoding="UTF-8"?>
<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">
<!--声明项目描述符遵循哪一个POM模型版本。模型本身的版本很少改变,虽然如此,但它仍然是必不可少的,这是为了当Maven引入了新的特性或者其他模型变更的时候,确保稳定性。 -->
<modelVersion>4.0.0</modelVersion>
<!--项目的全球唯一标识符,通常使用全限定的包名区分该项目和其他项目。并且构建时生成的路径也是由此生成, 如com.mycompany.app生成的相对路径为:/com/mycompany/app -->
<groupId>com.ai.odf.m.domain</groupId>
<!-- 构件的标识符,它和group ID一起唯一标识一个构件。换句话说,你不能有两个不同的项目拥有同样的artifact ID和groupID;在某个
特定的group ID下,artifact ID也必须是唯一的。构件是项目产生的或使用的一个东西,Maven为项目产生的构件包括:JARs,源 码,二进制发布和WARs等。 -->
<artifactId>fast-odf</artifactId>
<!--项目产生的构件类型,例如jar、war、ear、pom。插件可以创建他们自己的构件类型,所以前面列的不是全部构件类型 -->
<packaging>pom</packaging>
<!--项目当前版本,格式为:主版本.次版本.增量版本-限定版本号 -->
<version>1.0-SNAPSHOT</version>
<modules>
<module>unidoc-m-server</module>
<module>unidoc-m-web</module>
</modules>
<!--父项目的坐标。如果项目中没有规定某个元素的值,那么父项目中的对应值即为项目的默认值。 坐标包括group ID,artifact ID和
version。 -->
<parent>
<!--被继承的父项目的全球唯一标识符 -->
<groupId>com.ai.osd</groupId>
<!--被继承的父项目的构件标识符 -->
<artifactId>osd-dev</artifactId>
<!--被继承的父项目的版本 -->
<version>HY2.0.0</version>
</parent>
<properties>
<csf.version>3.0-SNAPSHOT</csf.version>
<osd.version>HY2.0.0</osd.version>
</properties>
<!--发现插件的远程仓库列表,这些插件用于构建和报表 -->
<pluginRepositories>
<pluginRepository>
<id>osd-release</id>
<name>release</name>
<url>
http://10.248.62.42:8081/repository/odf-release/
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!--发现依赖和扩展的远程仓库列表。 -->
<repositories>
<repository>
<id>odf-snapshots</id>
<name>snapshots</name>
<url>
http://10.248.62.42:8081/repository/odf-snapshot/
</url>
<releases>
<enabled>
false
</enabled>
</releases>
<snapshots>
<enabled>
true
</enabled>
</snapshots>
</repository>
<repository>
<id>odf-releases</id>
<name>releases</name>
<url>
http://10.248.62.42:8081/repository/odf-release/
</url>
<snapshots>
<enabled>
false
</enabled>
</snapshots>
<releases>
<enabled>
true
</enabled>
</releases>
</repository>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<!--项目引入插件所需要的额外依赖 -->
<dependencies>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>2.10.0</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>2.10.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.csource</groupId>
<artifactId>fastdfs-client-java</artifactId>
<version>1.27-RELEASE</version>
</dependency>
<dependency>
<groupId>com.ai.aif.log4x</groupId>
<artifactId>log4x-appender</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>com.ai.aif.log4x</groupId>
<artifactId>log4x-logging</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>com.ai.aif.log4x</groupId>
<artifactId>log4x-common</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>com.ai.aif.log4x</groupId>
<artifactId>log4x-client</artifactId>
<version>3.1.3</version>
</dependency>
<!-- <dependency>
<groupId>com.ai.aif.log4x</groupId>
<artifactId>kafka</artifactId>
<version>2.12-0.10.2.2</version>
</dependency>
<dependency>
<groupId>com.ai.aif.log4x</groupId>
<artifactId>kafka-clients</artifactId>
<version>0.10.2.2</version>
</dependency>-->
<dependency>
<groupId>com.ai.aif.log4x</groupId>
<artifactId>disruptor</artifactId>
<version>3.3.6</version>
</dependency>
<dependency>
<groupId>com.ai.aif.log4x</groupId>
<artifactId>metrics-core</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>com.ai.aif.log4x</groupId>
<artifactId>scala-library</artifactId>
<version>2.12.4</version>
</dependency>
<dependency>
<groupId>com.ai.aif.log4x</groupId>
<artifactId>snappy-java</artifactId>
<version>1.1.1.7</version>
</dependency>
<!-- log4x 依赖包 end -->
</dependencies>
</project>
2:service层pom
<?xml version="1.0" encoding="UTF-8"?>
<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>fast-odf</artifactId>
<groupId>com.ai.odf.m.domain</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>unidoc-m-server</artifactId>
<properties>
<project-name>unidoc-m-server</project-name>
</properties>
<!--引入依赖-->
<dependencies>
<!--数据访问层-->
<dependency>
<groupId>com.ai.osd</groupId>
<artifactId>osd-datasource</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--
<dependency>
<groupId>org.csource</groupId>
<artifactId>fastdfs-client-java</artifactId>
<version>1.27-RELEASE</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/test/java/fastdfs-client-java-1.27-RELEASE.jar</systemPath>
</dependency>
-->
<!--rpc client-->
<dependency>
<groupId>com.ai.osd</groupId>
<artifactId>osd-socket-client</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--rpc server-->
<dependency>
<groupId>com.ai.osd</groupId>
<artifactId>osd-socket-server</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</exclusion>
<exclusion>
<groupId>appframe</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--缓存-->
<dependency>
<groupId>com.ai.osd</groupId>
<artifactId>osd-aicache</artifactId>
</dependency>
<!--消息-->
<dependency>
<groupId>com.ai.osd</groupId>
<artifactId>osd-message</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.3</version>
</dependency>
</dependencies>
<!--dependencyManagement只是进行管理,但并不引入依赖-->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.ai.osd</groupId>
<artifactId>osd-plugin</artifactId>
<version>HY2.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!--引入插件-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>system/</exclude>
<!--
<exclude>*.yml</exclude>
-->
<exclude>*.xml</exclude>
<exclude>*.properties</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<finalName>${project-name}</finalName>
<appendAssemblyId>true</appendAssemblyId>
<descriptors>
<descriptor>../s-assembly/server-src.xml</descriptor><!--对应着打包配置-->
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>pre-site</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>osd-mybatis-generator-maven-plugin</artifactId>
<version>1.3.7</version>
<configuration>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
</plugin>
</plugins>
</build>
</project>
2:sonar 进行代码质量管理(代码质量检查)
与持续集成工具(例如 Hudson/Jenkins 等)不同,Sonar 并不是简单地把不同的代码检查工具结果(例如 FindBugs,PMD 等)直接显示在 Web 页面上,而是通过不同的插件对这些结果进行再加工处理,通过量化的方式度量代码质量的变化,从而可以方便地对不同规模和种类的工程进行代码质量管理。
3:Log4j使用学习记录
Log4j使用学习记录
log4j配置详解(非常详细)
最详细的Log4J使用教程
4:Idea 的安装 与 激活码的获取
激活码:http://idea.lanyus.com/
5 :idea 下载代码的时候,提示(Clone failed runnerw.exe CreateProcess failed with error 2) 代表的时没有安装git
注意: idea 导入git项目,还是svn项目。都需要先安装对应的svn,git安装包。才可以操作的
6:swagger
swagger就是一款api生成工具,能够帮助我们构建功能强大的API,我们可以使用swagger来进行测试等等。
swagger项目的学习