文章標題

    <properties>
        <!-- 定義變量,一般用來指定版本 -->
        <javaVersion>1.7</javaVersion>
        <maven-model.version>3.1.1</maven-model.version>
        <maven-release.version>2.5.1</maven-release.version>
        <!--  用來定義war包名稱  -->
        <project.build.name>tools</project.build.name> 
        <!-- 指定字符集 -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>
    <dependencyManagement>
        <dependencies>
            <!-- Hadoop2 dependencies -->
            <dependency>
                <groupId>org.apache.hadoop</groupId>
                <artifactId>hadoop-common</artifactId>
                <version>${hadoop2.version}</version>
                <!-- compile import provided runtime  test system-->
                <scope>compile</scope>
                <!-- 不包含 -->
                <exclusions>
                    <exclusion>
                        <groupId>javax.servlet</groupId>
                        <artifactId>servlet-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.mrunit</groupId>
                <artifactId>mrunit</artifactId>
                <version>${mrunit.version}</version>
                <classifier>hadoop2</classifier>
            </dependency>
        </dependencies>
    <repositories>
        <repository>
            <id>central</id>
            <name>Central Repository</name>
            <url>http://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>conjars</id>
            <url>http://conjars.org/repo/</url>
        </repository>
    </repositories>
    <modules>
        <module>atopcalcite</module>
        <module>core-common</module>
    </modules>
 <build>
        <pluginManagement>
            <plugins>
            <!-- 指定使用java的那個版本進行編譯 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <source>${javaVersion}</source>
                        <target>${javaVersion}</target>
                        <encoding>${project.build.sourceEncoding}</encoding>  
                    </configuration>
                </plugin>
                 <!-- 指定使用java的那個版本進行編譯 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>2.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.2</version>
                </plugin>
                <!-- 設置資源文件的編譯 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <encoding>${project.build.sourceEncoding}</encoding>
                    </configuration>
                </plugin>
                <!-- jar包的插件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.4</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>test-jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <!-- 編譯war包的插件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.6</version>
                    <configuration>
                        <packagingExcludes>
                            WEB-INF/lib/servlet-api-*.jar,
                            WEB-INF/lib/zookeeper-*.jar
                        </packagingExcludes>
                    </configuration>
                </plugin>
                <!-- jar包依賴的插件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                </plugin>
                <!-- 源代碼打包插件 -->  
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.1.2</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <includePom>true</includePom>
                    </configuration>
                </plugin>
                <!--<plugin>-->
                <!--<groupId>org.apache.maven.plugins</groupId>-->
                <!--<artifactId>maven-failsafe-plugin</artifactId>-->
                <!--<version>2.6</version>-->
                <!--<executions>-->
                <!--<execution>-->
                <!--<goals>-->
                <!--<goal>integration-test</goal>-->
                <!--<goal>verify</goal>-->
                <!--</goals>-->
                <!--</execution>-->
                <!--</executions>-->
                <!--</plugin>-->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${maven-release.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.7.0.201403182114</version>
                    <configuration>
                        <destFile>${sonar.jacoco.reportPath}</destFile>
                        <append>true</append>
                    </configuration>
                    <executions>
                        <execution>
                            <id>agent</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
  <profiles>
        <profile>
            <id>sandbox</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>2.5.1</version>
                        <configuration>
                            <fork>true</fork>
                            <meminitial>1024m</meminitial>
                            <maxmem>2048m</maxmem>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.16</version>
                        <configuration>
                            <reportsDirectory>${project.basedir}/../target/surefire-reports</reportsDirectory>
                            <excludes>
                                <exclude>**/IT*.java</exclude>
                            </excludes>
                            <systemProperties>
                                <property>
                                    <name>useSandbox</name>
                                    <value>false</value>
                                </property>
                                <property>
                                    <name>buildCubeUsingProvidedData</name>
                                    <value>false</value>
                                </property>
                            </systemProperties>
                            <argLine>-Xms1G -Xmx2G -XX:MaxPermSize=512M</argLine>
                        </configuration>
                    </plugin>


                </plugins>
            </build>
        </profile>
        <profile>
            <!-- This profile adds/overrides few features of the 'apache-release'
                 profile in the parent pom. -->
            <id>apache-release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <configuration>
                            <skip>false</skip>
                        </configuration>
                    </plugin>
                    <!-- Override the parent assembly execution to customize the assembly
                        descriptor and final name. -->
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>source-release-assembly</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <tarLongFileMode>posix</tarLongFileMode>
                                    <runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
                                    <appendAssemblyId>true</appendAssemblyId>
                                    <descriptor>src/main/config/assemblies/source-assembly.xml</descriptor>
                                    <finalName>apache-kylin-${project.version}</finalName>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Apache-RAT checks for files without headers.
                         If run on a messy developer's sandbox, it will fail.
                         This serves as a reminder to only build a release in a clean
                         sandbox! -->
                    <plugin>
                        <groupId>org.apache.rat</groupId>
                        <artifactId>apache-rat-plugin</artifactId>
                        <configuration>
                            <!-- Exclude files/folders for apache release -->
                            <excludes>
                                <exclude>DEPENDENCIES</exclude>
                                <exclude>.settings/**</exclude>
                                <exclude>**/LICENSE*</exclude>
                                <!-- Local git repo -->
                                <exclude>.git/**</exclude>
                                <!-- IDE files -->
                                <exclude>.idea/**</exclude>
                                <exclude>**/*.iml</exclude>
                                <exclude>**/.classpath</exclude>
                                <exclude>**/.project</exclude>


                            </excludes>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.maven.doxia</groupId>
                                <artifactId>doxia-core</artifactId>
                                <version>1.6</version>
                                <exclusions>
                                    <exclusion>
                                        <groupId>xerces</groupId>
                                        <artifactId>xercesImpl</artifactId>
                                    </exclusion>
                                </exclusions>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <!--<plugin>-->
                        <!--<groupId>net.ju-n.maven.plugins</groupId>-->
                        <!--<artifactId>checksum-maven-plugin</artifactId>-->
                        <!--<version>1.2</version>-->
                        <!--<executions>-->
                            <!--<execution>-->
                                <!--<goals>-->
                                    <!--<goal>artifacts</goal>-->
                                <!--</goals>-->
                            <!--</execution>-->
                        <!--</executions>-->
                        <!--<configuration>-->
                            <!--<algorithms>-->
                                <!--<algorithm>MD5</algorithm>-->
                                <!--<algorithm>SHA-1</algorithm>-->
                            <!--</algorithms>-->
                            <!--<failOnError>false</failOnError>-->
                        <!--</configuration>-->
                    <!--</plugin>-->
                </plugins>
            </build>
        </profile>
    </profiles>

參考
http://my.oschina.net/zh119893/blog/276090

發佈了22 篇原創文章 · 獲贊 7 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章