pom.xml 9.09 KB
<?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">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.5.3.RELEASE</version>
	</parent>

	<groupId>com.ylp.common</groupId>
	<artifactId>ylp-common-parent</artifactId>
	<version>2.1.0-SNAPSHOT</version>
	<packaging>pom</packaging>

	<name>ylp-common-parent</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<ylp.common.version>2.1.0-SP4-SNAPSHOT</ylp.common.version>
		<mybatisplus-spring-boot-starter.version>1.0.1</mybatisplus-spring-boot-starter.version>
		<org.springframework.boot.version>1.5.3.RELEASE</org.springframework.boot.version>
		<sonar.host.url>http://172.16.8.244:9000</sonar.host.url>
		<sonar.language>java</sonar.language>
		<sonar.inclusions>src/main/java/**/*.java</sonar.inclusions>
		<sonar.java.binaries>target/classes</sonar.java.binaries>
		<sonar.java.libraries>target/dependency/*.jar</sonar.java.libraries>
		<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
		<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
	</properties>

	<!-- 全局属性配置 -->
	<profiles>

		<!-- 开发环境 -->
		<profile>
			<id>main</id>
			<properties>
				<!-- 部署环境(对应配置文件版本) -->
				<env>main</env>
				<ver>3.0-SNAPSHOT</ver>
				<maven.test.skip>false</maven.test.skip>
			</properties>
			<!-- 设置默认环境 -->
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
		</profile>

		<!-- 测试环境 -->
		<profile>
			<id>test</id>
			<properties>
				<!-- 部署环境(对应配置文件版本) -->
				<env>test</env>
				<ver>4.0-SNAPSHOT</ver>
			</properties>
		</profile>

		<!-- qa环境 -->
		<profile>
			<id>qa</id>
			<properties>
				<!-- 部署环境(对应配置文件版本) -->
				<env>qa</env>
				<ver>2.0.0-SNAPSHOT</ver>
			</properties>
		</profile>

		<!-- prod环境 -->
		<profile>
			<id>prod</id>
			<properties>
				<!-- 部署环境(对应配置文件版本) -->
				<env>prod</env>
				<ver>2.0.0-SNAPSHOT</ver>
			</properties>
		</profile>

	</profiles>

	<distributionManagement>
		<repository>
			<id>nexus-releases</id>
			<name>Nexus Release Repository</name>
			<url>http://nexus.vipzhuang.cn/content/repositories/releases/</url>
		</repository>
		<snapshotRepository>
			<id>nexus-snapshots</id>
			<name>Nexus Snapshot Repository</name>
			<url>http://nexus.vipzhuang.cn/content/repositories/snapshots/</url>
		</snapshotRepository>

	</distributionManagement>
	
	<repositories>
		<repository>
			<id>nexus</id>
			<url>http://nexus.vipzhuang.cn/content/groups/public</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>nexus-snapshots</id>
			<url>http://nexus.vipzhuang.cn/content/repositories/snapshots/</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>


	<build>
        <!-- 切换到项目根目录执行mvn clean compile test package sonar:sonar能够生成测试报告  http://172.16.8.244:9000可以查看 -->
        <pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.sonarsource.scanner.maven</groupId>
					<artifactId>sonar-maven-plugin</artifactId>
					<version>3.3.0.603</version>
					<executions>
						<execution>
							<id>sonar</id>
							<phase>package</phase>
							<goals>
								<goal>sonar</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-deploy-plugin</artifactId>			
				<configuration>
					<uniqueVersion>false</uniqueVersion>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>		
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>			
				<configuration>				
					<source>1.7</source>
					<target>1.7</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>		
				<executions>
					<execution>
						<id>attach-sources</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			
			


			<!-- 拷贝依赖包插件 -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>	
				<executions>
					<execution>
						<id>copy</id>
						<phase>process-resources</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- 单元测试插件 -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>	
				<!-- 等效mvn test -Dmaven.surefire.debug
				<configuration>
				<debugForkedProcess>true</debugForkedProcess>
				</configuration>
				 -->
			</plugin>
			<!-- 集成测试插件 -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-failsafe-plugin</artifactId>		
			</plugin>
			<!-- 覆盖率统计插件 -->
			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<version>0.7.9</version>
				<configuration>
					<append>true</append>
				</configuration>
				<executions>
					<execution>
						<id>agent-for-ut</id>
						<goals>
							<goal>prepare-agent</goal>
						</goals>
					</execution>
					<execution>
						<id>agent-for-it</id>
						<goals>
							<goal>prepare-agent-integration</goal>
						</goals>
					</execution>
					<execution>
						<id>jacoco-site</id>
						<phase>test</phase>
						<goals>
							<goal>report</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<!-- 性能测试,安全测试,docker发布插件,暂略 -->
			
			
		</plugins>
	</build>

	<reporting>
		<plugins>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-checkstyle-plugin</artifactId>
				<version>2.10</version>
				<configuration>
					<configLocation>config/sun_checks.xml</configLocation>
					<suppressionsLocation>config/checkstyle-suppressions.xml</suppressionsLocation>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-pmd-plugin</artifactId>
				<version>3.0.1</version>
				<configuration>
					<rulesets>
						<!-- pmd 5.0.2 的Java所规则如下 -->
						<!-- <ruleset>rulesets/java/android.xml</ruleset> -->
						<ruleset>rulesets/java/basic.xml</ruleset>
						<ruleset>rulesets/java/braces.xml</ruleset>
						<ruleset>rulesets/java/clone.xml</ruleset>
						<ruleset>rulesets/java/codesize.xml</ruleset>
						<ruleset>rulesets/java/controversial.xml</ruleset>
						<ruleset>rulesets/java/coupling.xml</ruleset>
						<ruleset>rulesets/java/design.xml</ruleset>
						<ruleset>rulesets/java/empty.xml</ruleset>
						<ruleset>rulesets/java/finalizers.xml</ruleset>
						<ruleset>rulesets/java/imports.xml</ruleset>
						<ruleset>rulesets/java/j2ee.xml</ruleset>
						<ruleset>rulesets/java/javabeans.xml</ruleset>
						<ruleset>rulesets/java/junit.xml</ruleset>
						<ruleset>rulesets/java/logging-jakarta-commons.xml</ruleset>
						<ruleset>rulesets/java/logging-java.xml</ruleset>
						<ruleset>rulesets/java/migrating.xml</ruleset>
						<ruleset>rulesets/java/naming.xml</ruleset>
						<ruleset>rulesets/java/optimizations.xml</ruleset>
						<ruleset>rulesets/java/strictexception.xml</ruleset>
						<ruleset>rulesets/java/strings.xml</ruleset>
						<ruleset>rulesets/java/sunsecure.xml</ruleset>
						<ruleset>rulesets/java/typeresolution.xml</ruleset>
						<ruleset>rulesets/java/unnecessary.xml</ruleset>
						<ruleset>rulesets/java/unusedcode.xml</ruleset>
					</rulesets>
					<aggregate>true</aggregate>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>findbugs-maven-plugin</artifactId>
				<version>2.5.2</version>
			</plugin>

			<plugin>
				<!-- 添加了jxr插件  ,用来在生成的结果中可以通过link找到代码对应的行 -->
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jxr-plugin</artifactId>
				<version>2.3</version>
				<!-- 支持聚合报告 -->
				<configuration>
					<aggregate>true</aggregate>
				</configuration>
			</plugin>

		</plugins>
	</reporting>

</project>