这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
分享:技术:maven:maven_scm_release_plugin [2015/07/07 15:31] gxx |
分享:技术:maven:maven_scm_release_plugin [2015/07/07 15:51] (当前版本) gxx |
||
---|---|---|---|
行 14: | 行 14: | ||
接着上面继续讲,每次正式的发布你都可以手工一步步的做这些事情,无非就是一些svn操作,一些pom编辑,还有一些mvn操作。但是重复手工做这些事情,一来繁琐,而来容易出错。因此maven-scm-plugin插件和maven-release-plugin插件就是用来自动化这一系列动作。 | 接着上面继续讲,每次正式的发布你都可以手工一步步的做这些事情,无非就是一些svn操作,一些pom编辑,还有一些mvn操作。但是重复手工做这些事情,一来繁琐,而来容易出错。因此maven-scm-plugin插件和maven-release-plugin插件就是用来自动化这一系列动作。 | ||
===== 操作 ===== | ===== 操作 ===== | ||
+ | ==== pom.xml源码 ==== | ||
+ | 注意其中的: | ||
+ | * scm软件配置管理 | ||
+ | * nexus私服仓库 | ||
+ | * scm软件配置管理插件 | ||
+ | * 版本发布插件 | ||
+ | * 版本发布管理 | ||
+ | <code xml pom.xml> | ||
+ | <?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/maven-v4_0_0.xsd"> | ||
+ | <modelVersion>4.0.0</modelVersion> | ||
+ | <groupId>com.gxx</groupId> | ||
+ | <artifactId>record</artifactId> | ||
+ | <packaging>war</packaging> | ||
+ | <version>0.0.1-SNAPSHOT</version> | ||
+ | <name>record Maven Webapp</name> | ||
+ | <url>http://maven.apache.org</url> | ||
+ | |||
+ | <!-- 项目属性 --> | ||
+ | <properties> | ||
+ | <!-- jar 版本设置 --> | ||
+ | <spring.version>4.0.5.RELEASE</spring.version> | ||
+ | <aspectjrt.version>1.6.9</aspectjrt.version> | ||
+ | <aspectjweaver.version>1.6.1</aspectjweaver.version> | ||
+ | <freemarker.version>2.3.20</freemarker.version> | ||
+ | <mybatis.version>3.2.7</mybatis.version> | ||
+ | <mybatis-spring.version>1.2.2</mybatis-spring.version> | ||
+ | <mybatis-generator-core.version>1.3.2</mybatis-generator-core.version> | ||
+ | <servlet-api.version>2.4</servlet-api.version> | ||
+ | <jsp-api.version>2.0</jsp-api.version> | ||
+ | <jstl.version>1.2</jstl.version> | ||
+ | <standard.version>1.1.2</standard.version> | ||
+ | <jackson-databind.version>2.4.0</jackson-databind.version> | ||
+ | <jackson-annotations.version>2.4.0</jackson-annotations.version> | ||
+ | <jackson-module-jaxb-annotations.version>2.4.0</jackson-module-jaxb-annotations.version> | ||
+ | <jackson-core.version>2.4.0</jackson-core.version> | ||
+ | <junit.version>4.11</junit.version> | ||
+ | <log4j.version>1.2.16</log4j.version> | ||
+ | <mysql-connector-java.version>5.1.9</mysql-connector-java.version> | ||
+ | <commons-dbcp.version>1.4</commons-dbcp.version> | ||
+ | </properties> | ||
+ | |||
+ | <!-- scm软件配置管理 --> | ||
+ | <scm> | ||
+ | <connection>scm:svn:svn://121.43.104.34/gxx/trunk/record</connection> | ||
+ | <developerConnection>scm:svn:svn://121.43.104.34/gxx/trunk/record</developerConnection> | ||
+ | </scm> | ||
+ | |||
+ | <dependencies> | ||
+ | <!-- Spring --> | ||
+ | <dependency> | ||
+ | <groupId>org.springframework</groupId> | ||
+ | <artifactId>spring-core</artifactId> | ||
+ | <version>${spring.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>org.springframework</groupId> | ||
+ | <artifactId>spring-beans</artifactId> | ||
+ | <version>${spring.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>org.springframework</groupId> | ||
+ | <artifactId>spring-context</artifactId> | ||
+ | <version>${spring.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>org.springframework</groupId> | ||
+ | <artifactId>spring-context-support</artifactId> | ||
+ | <version>${spring.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>org.springframework</groupId> | ||
+ | <artifactId>spring-aop</artifactId> | ||
+ | <version>${spring.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>org.springframework</groupId> | ||
+ | <artifactId>spring-jdbc</artifactId> | ||
+ | <version>${spring.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>org.springframework</groupId> | ||
+ | <artifactId>spring-web</artifactId> | ||
+ | <version>${spring.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>org.springframework</groupId> | ||
+ | <artifactId>spring-webmvc</artifactId> | ||
+ | <version>${spring.version}</version> | ||
+ | </dependency> | ||
+ | |||
+ | <!-- aspectj --> | ||
+ | <dependency> | ||
+ | <groupId>org.aspectj</groupId> | ||
+ | <artifactId>aspectjrt</artifactId> | ||
+ | <version>${aspectjrt.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>org.aspectj</groupId> | ||
+ | <artifactId>aspectjweaver</artifactId> | ||
+ | <version>${aspectjweaver.version}</version> | ||
+ | </dependency> | ||
+ | |||
+ | <!-- freemarker --> | ||
+ | <dependency> | ||
+ | <groupId>org.freemarker</groupId> | ||
+ | <artifactId>freemarker</artifactId> | ||
+ | <version>${freemarker.version}</version> | ||
+ | </dependency> | ||
+ | |||
+ | <!-- mybatis --> | ||
+ | <dependency> | ||
+ | <groupId>org.mybatis</groupId> | ||
+ | <artifactId>mybatis</artifactId> | ||
+ | <version>${mybatis.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>org.mybatis</groupId> | ||
+ | <artifactId>mybatis-spring</artifactId> | ||
+ | <version>${mybatis-spring.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>org.mybatis.generator</groupId> | ||
+ | <artifactId>mybatis-generator-core</artifactId> | ||
+ | <version>${mybatis-generator-core.version}</version> | ||
+ | </dependency> | ||
+ | |||
+ | <!-- j2ee基础 --> | ||
+ | <dependency> | ||
+ | <groupId>javax.servlet</groupId> | ||
+ | <artifactId>servlet-api</artifactId> | ||
+ | <version>${servlet-api.version}</version> | ||
+ | <scope>provided</scope> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>javax.servlet.jsp</groupId> | ||
+ | <artifactId>jsp-api</artifactId> | ||
+ | <version>${jsp-api.version}</version> | ||
+ | <scope>provided</scope> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>javax.servlet</groupId> | ||
+ | <artifactId>jstl</artifactId> | ||
+ | <version>${jstl.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>taglibs</groupId> | ||
+ | <artifactId>standard</artifactId> | ||
+ | <version>${standard.version}</version> | ||
+ | </dependency> | ||
+ | |||
+ | <!-- jackson --> | ||
+ | <dependency> | ||
+ | <groupId>com.fasterxml.jackson.core</groupId> | ||
+ | <artifactId>jackson-databind</artifactId> | ||
+ | <version>${jackson-databind.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>com.fasterxml.jackson.core</groupId> | ||
+ | <artifactId>jackson-annotations</artifactId> | ||
+ | <version>${jackson-annotations.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>com.fasterxml.jackson.module</groupId> | ||
+ | <artifactId>jackson-module-jaxb-annotations</artifactId> | ||
+ | <version>${jackson-module-jaxb-annotations.version}</version> | ||
+ | </dependency> | ||
+ | <dependency> | ||
+ | <groupId>com.fasterxml.jackson.core</groupId> | ||
+ | <artifactId>jackson-core</artifactId> | ||
+ | <version>${jackson-core.version}</version> | ||
+ | </dependency> | ||
+ | |||
+ | <!-- log4j --> | ||
+ | <dependency> | ||
+ | <groupId>log4j</groupId> | ||
+ | <artifactId>log4j</artifactId> | ||
+ | <version>${log4j.version}</version> | ||
+ | </dependency> | ||
+ | |||
+ | <!-- junit --> | ||
+ | <dependency> | ||
+ | <groupId>junit</groupId> | ||
+ | <artifactId>junit</artifactId> | ||
+ | <scope>test</scope> | ||
+ | <version>${junit.version}</version> | ||
+ | </dependency> | ||
+ | |||
+ | <!-- mysql --> | ||
+ | <dependency> | ||
+ | <groupId>mysql</groupId> | ||
+ | <artifactId>mysql-connector-java</artifactId> | ||
+ | <version>${mysql-connector-java.version}</version> | ||
+ | </dependency> | ||
+ | |||
+ | <!-- dbcp --> | ||
+ | <dependency> | ||
+ | <groupId>commons-dbcp</groupId> | ||
+ | <artifactId>commons-dbcp</artifactId> | ||
+ | <version>${commons-dbcp.version}</version> | ||
+ | </dependency> | ||
+ | </dependencies> | ||
+ | |||
+ | <!-- 设定除中央仓repo1.maven.org/maven2/)外的其他仓库,按设定顺序进行查 --> | ||
+ | <repositories> | ||
+ | <!-- nexus私服仓库 --> | ||
+ | <repository> | ||
+ | <id>nexus</id> | ||
+ | <name>Team Nexus Repository</name> | ||
+ | <url>http://121.43.104.34:8081/nexus/content/groups/public</url> | ||
+ | </repository> | ||
+ | <repository> | ||
+ | <id>offical</id> | ||
+ | <name>Maven Official Repository</name> | ||
+ | <url>http://repo1.maven.org/maven2</url> | ||
+ | <snapshots> | ||
+ | <enabled>false</enabled> | ||
+ | </snapshots> | ||
+ | </repository> | ||
+ | <repository> | ||
+ | <id>spring-milestone</id> | ||
+ | <name>Spring Maven MILESTONE Repository</name> | ||
+ | <url>http://maven.springframework.org/milestone</url> | ||
+ | </repository> | ||
+ | <repository> | ||
+ | <id>jboss</id> | ||
+ | <name>Jboss Repository</name> | ||
+ | <url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url> | ||
+ | <snapshots> | ||
+ | <enabled>false</enabled> | ||
+ | </snapshots> | ||
+ | </repository> | ||
+ | <repository> | ||
+ | <id>java.net</id> | ||
+ | <name>Java.net Repository</name> | ||
+ | <url>http://download.java.net/maven/2/</url> | ||
+ | <snapshots> | ||
+ | <enabled>false</enabled> | ||
+ | </snapshots> | ||
+ | </repository> | ||
+ | <repository> | ||
+ | <id>spring-release</id> | ||
+ | <name>Spring Maven Release Repository</name> | ||
+ | <url>http://repo.springsource.org/libs-release</url> | ||
+ | <snapshots> | ||
+ | <enabled>false</enabled> | ||
+ | </snapshots> | ||
+ | </repository> | ||
+ | </repositories> | ||
+ | |||
+ | <build> | ||
+ | <finalName>record</finalName> | ||
+ | <plugins> | ||
+ | <!-- jdk编译插件 --> | ||
+ | <plugin> | ||
+ | <groupId>org.apache.maven.plugins</groupId> | ||
+ | <artifactId>maven-compiler-plugin</artifactId> | ||
+ | <version>2.0.2</version> | ||
+ | <configuration> | ||
+ | <source>1.6</source> | ||
+ | <target>1.6</target> | ||
+ | <encoding>utf8</encoding> | ||
+ | </configuration> | ||
+ | </plugin> | ||
+ | <!-- scm软件配置管理插件 --> | ||
+ | <plugin> | ||
+ | <groupId>org.apache.maven.plugins</groupId> | ||
+ | <artifactId>maven-scm-plugin</artifactId> | ||
+ | <version>1.3</version> | ||
+ | </plugin> | ||
+ | <!-- 版本发布插件 --> | ||
+ | <plugin> | ||
+ | <groupId>org.apache.maven.plugins</groupId> | ||
+ | <artifactId>maven-release-plugin</artifactId> | ||
+ | <version>2.4</version> | ||
+ | <configuration> | ||
+ | <tagBase>svn://121.43.104.34/gxx/tags/record</tagBase> | ||
+ | <branchBase>svn://121.43.104.34/gxx/branches/record</branchBase> | ||
+ | </configuration> | ||
+ | </plugin> | ||
+ | <!-- 原型插件 --> | ||
+ | <plugin> | ||
+ | <groupId>org.apache.maven.plugins</groupId> | ||
+ | <artifactId>maven-archetype-plugin</artifactId> | ||
+ | <version>2.2</version> | ||
+ | </plugin> | ||
+ | </plugins> | ||
+ | </build> | ||
+ | |||
+ | <!-- 版本发布管理 --> | ||
+ | <distributionManagement> | ||
+ | <!-- release稳定版本 --> | ||
+ | <repository> | ||
+ | <id>nexus-releases</id> | ||
+ | <name>Nexus Release Repository</name> | ||
+ | <url>http://121.43.104.34:8081/nexus/content/repositories/releases/</url> | ||
+ | </repository> | ||
+ | <!-- snapshots快照版本 --> | ||
+ | <snapshotRepository> | ||
+ | <id>nexus-snapshots</id> | ||
+ | <name>Nexus Snapshot Repository</name> | ||
+ | <url>http://121.43.104.34:8081/nexus/content/repositories/snapshots/</url> | ||
+ | </snapshotRepository> | ||
+ | </distributionManagement> | ||
+ | </project> | ||
+ | </code> | ||
+ | ==== 操作步骤 ==== | ||
<file> | <file> | ||
D:\05.HeadWorkspace\record>mvn release:prepare #进入项目目录,dir会看到pom.xml,当前版本是0.0.1-SNAPSHOT,执行脚本 | D:\05.HeadWorkspace\record>mvn release:prepare #进入项目目录,dir会看到pom.xml,当前版本是0.0.1-SNAPSHOT,执行脚本 | ||
行 61: | 行 368: | ||
#maven-release-plugin会自动帮我们检出刚才打的tag,然后打包,分发到nexus私有仓库中 | #maven-release-plugin会自动帮我们检出刚才打的tag,然后打包,分发到nexus私有仓库中 | ||
</file> | </file> | ||
- | 操作结束后查看pom.xml | + | ==== 结束检查 ==== |
+ | 查看pom.xml | ||
{{ :分享:技术:maven:maven插件截图3.png?300 |}} | {{ :分享:技术:maven:maven插件截图3.png?300 |}} | ||
查看svn | 查看svn | ||
行 67: | 行 375: | ||
查看nexus | 查看nexus | ||
{{ :分享:技术:maven:maven插件截图2.png?300 |}} | {{ :分享:技术:maven:maven插件截图2.png?300 |}} | ||
+ | ==== 错误记录 ==== | ||
在这个过程中我报过一些错误,这里都记录了下来,如果有相同的错误信息出现,可以参考后面跟的解决方案 | 在这个过程中我报过一些错误,这里都记录了下来,如果有相同的错误信息出现,可以参考后面跟的解决方案 | ||
<file> | <file> |