About scm and check style of pom.xml file

A. Scm project

<scm>
      #git项目地址可以用SSH  也可以用 HTTPS的    
      <connection>scm:git:http://10.69.205.31:8886/mazhenbang/maven_scm.git</connection>    #git项目地址可以用SSH  也可以用 HTTPS的
      <developerConnection>scm:git:http://10.69.205.31:8886/mazhenbang/maven_scm.git</developerConnection>
     #git项目浏览器里的地址   
     <url>http://10.69.205.31:8886/mazhenbang/maven_scm/tree/master</url>
</scm>

(1) pom.xml installed plug

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.0-beta-7</version>
        <configuration>
          <providerImplementations>
            <git>jgit</git>
          </providerImplementations>
          <username>xxxusername</username>
          <password>xxxxpasswrod</password>
          <tagBase>${project.artifactId}-${project.version}</tagBase>
          <goals>-f pom.xml deploy</goals>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-provider-jgit</artifactId>
            <version>1.9.5</version>
          </dependency>
        </dependencies>
    </plugin>
  </plugins>
</build>

(2) the need to write distributionManagement, otherwise not get published

<distributionManagement>
    <repository>
      <id>bizseer.repo</id>
      <name>Bizseer Private Repo</name>
      <url>http://192.168.115.11:8081/repository/maven-releases</url>
    </repository>
    <snapshotRepository>
      <id>bizseer.snapshots</id>
      <name>Bizseer Private Repo</name>
      <url>http://192.168.115.11:8081/repository/maven-snapshots</url>
    </snapshotRepository>
  </distributionManagement>

(3) the need to use the command

1.mvn release:prepare

This command is mainly to do is:
. A project you hit a release version
b make a tag in the tag in git.
C automatically upgraded SNAPSHOT pom and submit the updated file to git.
I now project version is 0.0.3- SNAPSHOT
Here Insert Picture Description
into the project root directory, execute mvn release: prepare (Note: you must submit local code up, otherwise it will prompt you "can not prepare the release because you have local modifications")
Here Insert Picture Description
first he must fight you will be prompted to release version is What can be entered manually, he can also be the default (default version is labeled version of the project SNAPSHOT release)
and then it prompts you for a name tag labeled on git, by default he can come, because of the above pom Lane configuration tagBase the
last he would code of your project in the modified version and automatically submit pom rise to a version to your git, originally 0.0.3-SNAPSHOT, when you executes this command, you go git look in the warehouse pom version, has become the magic of 0.0.3-SNAPSHOT. And it will give you generate a tag.

Here Insert Picture Description

2.mvn release: perform
this command is mainly to do is:
. A code to get the git Tag
b with a code on the tag, hit a release version of the package.
On c.deploy your maven PW

(4) ignored test

mvn release:prepare -Darguments="-DskipTests"
mvn release:perform -Darguments="-DskipTests"

Error Messages (5) possible

<1> First Error:
You don't have a SNAPSHOT project in the reactor projects list
<1> Solution:
出现这个错,首先去看一下你的pom.xml    <version>标签是不是 *.*-SNAPSHOT 结尾标识,按照maven规定  发布下一个正式版本都是在SNAPSHOST版本基础做执行 就是说主干 trunk, 下pom 都是开发版本 是:*.*-SNAPSHOT 标识

<2> Remove tag has been generated, should pay attention to local and remote delete an exception or an error occurred

	git tag  查看所有的tag
	git tag -d 版本名字  删除版本名 git tag -d v1.0
	git push origin :refs/tags/标签名  删除远程的tag git tag origin :refs/tags/v1.0
	

<3> If you upgraded version of the time, the previous version reported wrong, please delete the project file release.properties

<4> If there is a problem when packing port, check whether the machine is occupied port

II. Project check style

Information (1) pom.xml want to add

 <checkstype.version>3.1.0</checkstype.version>


  <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${checkstype.version}</version>
        <configuration>
          <configLocation>conf/style/bizseer-kaptain-style.xml</configLocation>
          <encoding>UTF-8</encoding>
          <consoleOutput>true</consoleOutput>
          <failsOnError>true</failsOnError>
          <linkXRef>false</linkXRef>
        </configuration>
        <executions>
          <execution>
            <id>validate</id>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
   </plugin>

(2) common commands

mvn checkstyle:help 查看帮助
mvn checkstyle:check 查看工程是否满足检查。如果不满足,检查失败,可以通过target/checkstyle-result.xml来查看
mvn checkstyle:checkstyle 查看工程是否满足检查。如果不满足,不会失败,可以通过target/site/checkstyle.html查看检查信息
mvn checkstyle:checkstyle-aggregate 检查工程是否满足检查。如果不满足,不会失败,可以通过target/site/checkstyle.html查看
Published 25 original articles · won praise 0 · Views 438

Guess you like

Origin blog.csdn.net/m0_38028438/article/details/104388045