实践Maven

介绍

Maven是一个构建工具,类似ant/gradle

安装

详情可以参考官方安装说明

二进制发行包

到官方下载二进制发行包,解压缩,设定环境变量即可。

通过包管理器

*nix系统可以使用SDKMAN,Mac可以使用Homebrew,Windows可以使用Scoop

1
$ sdk install maven 3.6.3
1
2
3
4
5
6
$ mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/ray/.sdkman/candidates/maven/current
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /media/ray/Resource/Platform/jdk1.8.0_181_linux/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-30deepin-generic", arch: "amd64", family: "unix"

命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
$ mvn --help

usage: mvn [options] [<goal(s)>] [<phase(s)>]

Options:
 -am,--also-make                        If project list is specified, also
                                        build projects required by the
                                        list
 -amd,--also-make-dependents            If project list is specified, also
                                        build projects that depend on
                                        projects on the list
 -B,--batch-mode                        Run in non-interactive (batch)
                                        mode (disables output color)
 -b,--builder <arg>                     The id of the build strategy to
                                        use
 -C,--strict-checksums                  Fail the build if checksums don't
                                        match
 -c,--lax-checksums                     Warn if checksums don't match
 -cpu,--check-plugin-updates            Ineffective, only kept for
                                        backward compatibility
 -D,--define <arg>                      Define a system property
 -e,--errors                            Produce execution error messages
 -emp,--encrypt-master-password <arg>   Encrypt master security password
 -ep,--encrypt-password <arg>           Encrypt server password
 -f,--file <arg>                        Force the use of an alternate POM
                                        file (or directory with pom.xml)
 -fae,--fail-at-end                     Only fail the build afterwards;
                                        allow all non-impacted builds to
                                        continue
 -ff,--fail-fast                        Stop at first failure in
                                        reactorized builds
 -fn,--fail-never                       NEVER fail the build, regardless
                                        of project result
 -gs,--global-settings <arg>            Alternate path for the global
                                        settings file
 -gt,--global-toolchains <arg>          Alternate path for the global
                                        toolchains file
 -h,--help                              Display help information
 -l,--log-file <arg>                    Log file where all build output
                                        will go (disables output color)
 -llr,--legacy-local-repository         Use Maven 2 Legacy Local
                                        Repository behaviour, ie no use of
                                        _remote.repositories. Can also be
                                        activated by using
                                        -Dmaven.legacyLocalRepo=true
 -N,--non-recursive                     Do not recurse into sub-projects
 -npr,--no-plugin-registry              Ineffective, only kept for
                                        backward compatibility
 -npu,--no-plugin-updates               Ineffective, only kept for
                                        backward compatibility
 -nsu,--no-snapshot-updates             Suppress SNAPSHOT updates
 -ntp,--no-transfer-progress            Do not display transfer progress
                                        when downloading or uploading
 -o,--offline                           Work offline
 -P,--activate-profiles <arg>           Comma-delimited list of profiles
                                        to activate
 -pl,--projects <arg>                   Comma-delimited list of specified
                                        reactor projects to build instead
                                        of all projects. A project can be
                                        specified by [groupId]:artifactId
                                        or by its relative path
 -q,--quiet                             Quiet output - only show errors
 -rf,--resume-from <arg>                Resume reactor from specified
                                        project
 -s,--settings <arg>                    Alternate path for the user
                                        settings file
 -t,--toolchains <arg>                  Alternate path for the user
                                        toolchains file
 -T,--threads <arg>                     Thread count, for instance 2.0C
                                        where C is core multiplied
 -U,--update-snapshots                  Forces a check for missing
                                        releases and updated snapshots on
                                        remote repositories
 -up,--update-plugins                   Ineffective, only kept for
                                        backward compatibility
 -v,--version                           Display version information
 -V,--show-version                      Display version information
                                        WITHOUT stopping build
 -X,--debug                             Produce execution debug output

MAVEN_OPTS

MAVEN_DEBUG_OPTS

Lifecycle

maven包含三套生命周期:default、clean和site。

Introduction to the lifecycle

Lifecycle Reference

Clean Lifecycle

Phase Description
pre-clean execute processes needed prior to the actual project cleaning
clean remove all files generated by the previous build
post-clean execute processes needed to finalize the project cleaning

Default Lifecycle

Phase Description
validate validate the project is correct and all necessary information is available.
initialize initialize build state, e.g. set properties or create directories.
generate-sources generate any source code for inclusion in compilation.
process-sources process the source code, for example to filter any values.
generate-resources generate resources for inclusion in the package.
process-resources copy and process the resources into the destination directory, ready for packaging.
compile compile the source code of the project.
process-classes post-process the generated files from compilation, for example to do bytecode enhancement on Java classes.
generate-test-sources generate any test source code for inclusion in compilation.
process-test-sources process the test source code, for example to filter any values.
generate-test-resources create resources for testing.
process-test-resources copy and process the resources into the test destination directory.
test-compile compile the test source code into the test destination directory
process-test-classes post-process the generated files from test compilation, for example to do bytecode enhancement on Java classes. For Maven 2.0.5 and above.
test run tests using a suitable unit testing framework. These tests should not require the code be packaged or deployed.
prepare-package perform any operations necessary to prepare a package before the actual packaging. This often results in an unpacked, processed version of the package. (Maven 2.1 and above)
package take the compiled code and package it in its distributable format, such as a JAR.
pre-integration-test perform actions required before integration tests are executed. This may involve things such as setting up the required environment.
integration-test process and deploy the package if necessary into an environment where integration tests can be run.
post-integration-test perform actions required after integration tests have been executed. This may including cleaning up the environment.
verify run any checks to verify the package is valid and meets quality criteria.
install install the package into the local repository, for use as a dependency in other projects locally.
deploy done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

Site Lifecycle

Phase Description
pre-site execute processes needed prior to the actual project site generation
site generate the project’s site documentation
post-site execute processes needed to finalize the site generation, and to prepare for site deployment
site-deploy deploy the generated site documentation to the specified web server

Build-in Lifecycle Bindings

Clean Lifecycle Bindings

Phase plugin:goal
clean clean:clean

Default Lifecycle Bindings - Packaging ejb / ejb3 / jar / par / rar / war

Phase plugin:goal
process-resources resources:resources
compile compiler:compile
process-test-resources resources:testResources
test-compile compiler:testCompile
test surefire:test
package ejb:ejb or ejb3:ejb3 or jar:jar or par:par or rar:rar or war:war
install install:install
deploy deploy:deploy

Default Lifecycle Bindings - Packaging ear

Phase plugin:goal
generate-resources ear:generate-application-xml
process-resources resources:resources
package ear:ear
install install:install
deploy deploy:deploy

Default Lifecycle Bindings - Packaging maven-plugin

Phase plugin:goal
generate-resources plugin:descriptor
process-resources resources:resources
compile compiler:compile
process-test-resources resources:testResources
test-compile compiler:testCompile
test surefire:test
package jar:jar and plugin:addPluginArtifactMetadata
install install:install
deploy deploy:deploy

Default Lifecycle Bindings - Packaging pom

Phase plugin:goal
package  
install install:install
deploy deploy:deploy

Site Lifecycle Bindings

Phase plugin:goal
site site:site
site-deploy site:deploy

pom.xml

坐标

groupId:

artifactId:

version:

packaging:

classifier:

1
2
3
4
jar {
    baseName = 'sample-gradle'
    version =  '0.1.0'
}

插件(Plugins)

插件是实际执行任务或目标(goals)的集合,可以直接使用,也可以绑定到生命周期中(添加到pom.xml的build-》plugins下),由生命周期流程驱动执行,注意:添加插件后需要配置要执行的goal,也可以定制绑定phase(有些插件的goal默认绑定了phase)。比如:

<plugins>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>2.4</version>
				<executions>
					<execution>
                        <!-- 同时绑定phase
                        <phase>package</phase>
						-->
						<goals>
							<goal>jar-no-fork</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
</build>

<pluginManagement/>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<build>
    <pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>2.4</version>
				<executions>
					<execution>
                        <!-- 同时绑定phase
                        <phase>package</phase>
						-->
						<goals>
							<goal>jar-no-fork</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
    </pluginManagement>
</build>

Maven生命周期中某些phrase已经预先绑定了一些插件。

插件一般都有一个help的目标,用来显示插件的基本信息和包含的goals等。

1
$ mvn org.springframework.boot:spring-boot-maven-plugin:help

可以查看更详细的信息,比如参数等,以及指定goal

1
$ mvn org.springframework.boot:spring-boot-maven-plugin:help -Ddetail=true -Dgoal=run

更详细信息可以使用下面常用插件中介绍的maven-help-plugin

插件前缀(plugin-prefix):简化插件的标示,如果插件的artifactId命名符合规范:{plugin-prefix}-maven-plugin或maven-{plugin-prefix}-plugin可会自动识别插件前缀,也可以通过goalPrefix自定义插件前缀。

插件解析时,默认groupId取值为org.apache.maven.plugins和org.codehaus.mojo,可以通过settings.xml中新增其他groupId,否则会报找不到指定插件前缀的插件。

1
2
3
4
5
<settings>
  	<pluginGroups>
		<pluginGroup>org.springframework.boot</pluginGroup>
	</pluginGroups>
</settings>
1
$ mvn spring-boot:help

依赖

<dependencies/>

1
2
3
4
5
6
7
<dependencies>
    <dependency>
        <groupId>wang.ray.dubbo</groupId>
        <artifactId>demo-api</artifactId>
        <version>1.0.0</version>
    </dependency>
</dependencies>

<dependencyManagement/>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<dependencyManagement>
        <dependencies>
        	<dependency>
                <groupId>wang.ray.dubbo</groupId>
                <artifactId>demo-api</artifactId>
                <version>1.0.0</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-framework-bom</artifactId>
                <version>${spring.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.dubbo</groupId>
                <artifactId>dubbo-bom</artifactId>
                <version>${dubbo.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

依赖坐标

groupId:

artifactId:

version:

type:默认值是jar,如果是pom,则表示依赖其<dependencies/><dependencyManagement/>

例如:

1
2
3
4
5
6
7
8
<dependencies>
	<dependency>
		<groupId>org.apache.dubbo</groupId>
		<artifactId>dubbo-dependencies-zookeeper</artifactId>
		<version>2.7.6</version>
		<type>pom</type>
    </dependency>
</dependencies>

classifier:

scope:

import:用于<dependencyManagement/>

例如:

1
2
3
4
5
6
7
8
9
10
11
<dependencyManagement>
	<dependencies>
 		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-framework-bom</artifactId>
 			<version>5.2.5.RELEASE</version>
  			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>

依赖传递

optional为false,则不会传递依赖

依赖调解

  1. dependencyManagement优先,且第一声明者优先
  2. 路径最近者优先
  3. 第一声明者优先

Dependency Mediation and Conflict Resolution

仓库

The Central Repository Search Engine

maven本地仓库默认路径:${home}/.m2/repository

安装构建到本地仓库,例如:

1
$ mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.2.0 -Dpackaging=jar -Dfile=d:\ojdbc14.jar

默认远程仓库为中央仓库(central),地址:https://repo1.maven.org/maven2/

阿里云Maven仓库服务

模块

父模块

1
2
3
4
5
6
7
8
<groupId>*</groupId>
<artifactId>sample-project1</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
	<module>module1</module>
	<module>module2</module>
</modules>

备注:填写的是子模块的目录名,不是子模块的artifactId

子模块

module1

1
2
3
4
5
6
7
8
9
10
11
12
13
<artifactId>sample-module1</artifactId>
<packaging>jar</packaging>
<parent>
	<groupId>*</groupId>
	<artifactId>sample-project1</artifactId>
	<version>1.0.0-SNAPSHOT</version>
</parent>

<dependency>
	<groupId>*</groupId>
	<artifactId>sample-module2</artifactId>
	<version>1.0.0-SNAPSHOT</version>
</dependency>

继承

<properties/>

<dependencies/>

<dependencyManagement/>

<plugins/>

<pluginManagement/>

超级POM

实践Maven之Super-POM

settings.xml

用户层面的settings.xml存放在${home}/.m2/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                        http://maven.apache.org/xsd/settings-1.0.0.xsd">
        <localRepository/>
        <interactiveMode/>
        <usePluginRegistry/>
        <offline/>
        <pluginGroups/>
        <servers/>
        <mirrors/>
        <proxies/>
        <profiles/>
        <activeProfiles/>
    </settings>

pluginGroups

server

maven仓库服务器相关配置,主要用于配置认证信息。

server中的id与repository或mirror中的id一致。

比如:

1
2
3
4
5
6
7
8
9
10
11
12
<servers>
    <server>
        <id>rdc-releases</id>
        <username>dSENx4</username>
        <password>******</password>
    </server>
    <server>
        <id>rdc-snapshots</id>
        <username>dSENx4</username>
        <password>******</password>
    </server>
</servers>

比如项目的pom.xml里面定义的repository

1
2
3
4
5
6
7
8
9
10
<distributionManagement>
    <repository>
        <id>rdc-releases</id>
        <url>https://repo.rdc.aliyun.com/repository/32344-release-yNEz1O/</url>
    </repository>
    <snapshotRepository>
        <id>rdc-snapshots</id>
        <url>https://repo.rdc.aliyun.com/repository/32344-snapshot-fcWD1X/</url>
    </snapshotRepository>
</distributionManagement>

mirror

镜像,其实也是一个仓库,根据匹配规则作为远程仓库的镜像。

1
2
3
4
5
6
7
<mirror>
	<id>aliyunmaven</id>
	<!-- 除了corp-repo仓库(比如pom.xml中定义) -->
	<mirrorOf>*,!corp-repo</mirrorOf>
	<name>阿里云公共仓库</name>
	<url>https://maven.aliyun.com/repository/public</url>
</mirror>

Maven Wrapper

Maven Wrapper的作用是将maven的版本纳入项目管理中,实现maven的版本由项目控制,与运行环境无关。首次运行时自动下载相应版本的maven到当前环境,升级也会非常容易。不会使用当前环境已安装的maven。

安装

有如下两种方法,区别主要再生成的目录,一个是.mvn,另一个是maven。

配置环境变量MAVEN_USER_HOME,maven下载存放到其下的wrapper/dist目录下。

1
export MAVEN_USER_HOME=/media/ray/Resource/MavenUserHome

方法一

参考:maven-wrapper,takari-maven-plugin

1
2
# 通过wrapper目标初始化maven wrapper
$ mvn -N io.takari:maven:wrapper

默认使用最新稳定版本作为maven wrapper的maven版本,也可以通过如下配置定制,比如指定maven版本

1
2
$ mvn -N io.takari:maven:wrapper -Dmaven=3.3.9
# -DdistributionUrl: 指定maven下载路径
1
2
3
4
5
6
7
8
# 生成如下maven wrapper相关文件,将这些文件添加到版本管理。
└── sample-gradle
    └── mvnw
    └── mvnw.bat
    └── .mvn
        └── wrapper
            └── maven-wrapper.jar
            └── maven-wrapper.properties

maven-wrapper.properties中可以指定maven下载路径(可以使用相对目录),比如:

1
2
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.2/maven-wrapper-0.5.2.tar.gz

方法二

参考:maven-mvnd

方法三

参考:maven-wrapper

添加plugin

1
2
3
4
5
<plugin>
	<groupId>com.rimerosolutions.maven.plugins</groupId>
	<artifactId>wrapper-maven-plugin</artifactId>
	<version>0.0.5</version>
</plugin>
1
2
# 通过wrapper目标初始化maven wrapper
$ mvn -N wrapper:wrapper

默认使用当前环境的maven版本,也可以通过如下配置定制,比如指定maven版本

1
2
$ mvn -N wrapper:wrapper -DmavenVersion=3.5.0
# -DbaseDistributionUrl: 指定maven下载路径
1
2
3
4
5
6
7
8
# 生成如下maven wrapper相关文件,将这些文件添加到版本管理。
└── sample-gradle
    └── mvnw
    └── mvnw.bat
    └── maven
        └── wrapper
            └── maven-wrapper.jar
            └── maven-wrapper.properties

maven-wrapper.properties中可以指定maven下载路径(可以使用相对目录),比如:

1
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip

使用

1
2
# 使用mvnw命令代替原始的mvn
$ ./mvnv -v

首次会自动下载相应版本的maven

升级

指定新版本的maven,重新安装即可【生成的相关文件可能会变化】

properties

1
2
3
<properties>
	<it.skip>false</it.skip>
</properties>

可以通过java系统属性提供更高优先级的设定,比如:-Dit.skip=true

plugin属性

plugin一般都定义有属性,可以通过describe插件查看,例如:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
$ mvn help:describe -Dplugin=compiler -Dgoal=compile -Ddetail
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building hello-client 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-help-plugin:2.2:describe (default-cli) @ cts-hello-client ---
[INFO] Mojo: 'compiler:compile'
compiler:compile
  Description: Compiles application sources
  Implementation: org.apache.maven.plugin.compiler.CompilerMojo
  Language: java
  Bound to phase: compile

  Available parameters:
...
    compilerVersion
      User property: maven.compiler.compilerVersion
      Version of the compiler to use, ex. '1.3', '1.5', if fork is set to true.

    debug (Default: true)
      User property: maven.compiler.debug
      Set to true to include debugging information in the compiled class files.

    encoding (Default: ${project.build.sourceEncoding})
      User property: encoding
      The -encoding argument for the Java compiler.

    outputFileName
      Sets the name of the output file when compiling a set of sources to a
      single file.
      expression='${project.build.finalName}'

    source (Default: 1.5)
      User property: maven.compiler.source
      The -source argument for the Java compiler.

    target (Default: 1.5)
      User property: maven.compiler.target
      The -target argument for the Java compiler.
...

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.083 s
[INFO] Finished at: 2017-11-30T18:09:28+08:00
[INFO] Final Memory: 15M/303M
[INFO] ------------------------------------------------------------------------
  • 可以在使用插件的地方设置属性(<configuration>),例如:
1
2
3
4
5
6
7
8
9
		   <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.2</version>
                <configuration><configurationFile>${basedir}/src/main/resources/generator/generatorConfig.xml</configurationFile>
                    <overwrite>true</overwrite>
                    <verbose>true</verbose>
                </configuration>
            </plugin>
  • 可以在pom的<properties>中定义属性(只有User property属性支持),例如:
1
2
3
4
5
6
<properties>
	<maven.compiler.source>1.8</maven.compiler.source>
	<maven.compiler.target>1.8</maven.compiler.target>
  	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
  • 可以通过java系统属性来设置(只有User property属性支持),例如:
1
$ mvn clean compile -Dmaven.test.skip=true

常用插件

maven-help-plugin

比插件自带的help显示更多信息,包括插件前缀goal绑定生命周期参数的User property等。

1
2
3
4
5
6
7
8
# 显示系统属性和环境变量
$ mvn help:system
# 显示spring-boot插件信息
$ mvn help:describe -Dplugin=spring-boot
# -Ddetail: 显示参数
$ mvn help:describe -Dplugin=spring-boot -Ddetail -Dgoal=run
# 显示有效pom
$ mvn help:effective-pom

maven-surefire-plugin

实践maven-surefire-plugin

maven-failsafe-plugin

maven-failsafe-plugin集成测试

maven-dependency-plugin

copy-dependencies

导出项目的依赖包

1
$ mvn dependency:copy-dependencies -DincludeScope=runtime
参数 描述
-Dmdep.useRepositoryLayout 按坐标目录结构,默认值:false
-DoutputDirectory 导出目录,默认值:target/dependency
-DincludeScope 导出指定级别的依赖

includeScope (Default: )

1
2
3
4
5
6
7
8
9
  Scope to include. An Empty string indicates all scopes (default). The
  scopes being interpreted are the scopes as Maven sees them, not as
  specified in the pom. In summary:
  - runtime scope gives runtime and compile dependencies,
  - compile scope gives compile, provided, and system dependencies,
  - test (default) scope gives all dependencies,
  - provided scope just gives provided dependencies,
  - system scope just gives system dependencies.
  User property: includeScope #### list
1
$ mvn dependency:list -DincludeScope=runtime

tree

1
$ mvn dependency:tree

javadoc

1
<maven.javadoc.skip>true</maven.javadoc.skip>

exec

1
$ mvn -Djava.net.preferIPv4Stack=true -Dexec.mainClass=org.apache.dubbo.samples.client.Application exec:java

QA

使用sun私有代码

使用sun私有代码,编译时可能会类似错误package com.sun.image.codec.jpeg does not exist,解决方法如下:

1
2
3
4
5
6
7
8
9
10
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <compilerArguments>
          	<!-- Linux下分隔符是: -->
            <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
        </compilerArguments>
    </configuration>
</plugin>

或者

1
2
3
4
5
6
7
8
9
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <compilerArguments>
            <compilerArgument>-XDignore.symbol.file</compilerArgument>
        </compilerArguments>
    </configuration>
</plugin>