工程化专题之maven

1 高效maven插件

  1)findbugs 静态代码检查,主要用于检查一些语义上的bug

  2)versions 统一修改module版本号

  3)source 自动下载打包源代码

  4)assembly 打包项目依赖的jar

2 自定义maven插件

  1)依赖:

    maven-plugin-api

    maven-plugin-annotations

  2)<packaging>maven-plugin</packaging>

  3)用@Mojo标注AbstractMojo的子类

    用@Parameters 标注参数,该参数可以在pom.xml的<configuration>标签或是mvn的-D参数指定(需要定义property属性)

3 profile

  1)pom中定义profile

  2)<resources>标签中排除及导入

4 nexus

  1)type=group 将所有仓库对外提供合集的仓库

  2)type=hosted 本地仓库

    - 3rd:party

    - Release:

    - Snapshots:

  3)pom.xml配置

    <distributionManagement>

      <repository>

        <id>

        <name>

        <url>

  4)settings.xml 配置

    <servers>

      <server>

        <id>

        <username>

        <password>

  5)下载jar配置

    a.配置mirror

    b.配置profile

5.maven 自定义脚手架

  1)mvn archetype:create-from-project projectname

  2)cd target/generated-sources/archetype

  3)mvn install

  4)从教手脚新建项目:可以在idea中导入也可以mvn archetype:generate -DarchetypeCatelog=local

猜你喜欢

转载自www.cnblogs.com/winner2016/p/9834435.html