• maven build pulgin


      1 <build>
      2         <defaultGoal>compile</defaultGoal>
      3         <plugins>
      4             <!-- 生成清单文件相关 -->
      5             <plugin>
      6                 <groupId>org.apache.maven.plugins</groupId>
      7                 <artifactId>maven-jar-plugin</artifactId>
      8                 <version>2.6</version>
      9                 <configuration>
     10                     <archive>
     11                         <manifest>
     12                             <addClasspath>true</addClasspath>
     13                             <classpathPrefix>lib/</classpathPrefix>
     14                             <mainClass>cn.java.application.Application</mainClass>
     15                         </manifest>
     16                         <manifestEntries>
     17                             <Class-Path>./</Class-Path>
     18                         </manifestEntries>
     19                     </archive>
     20                     <excludes>
     21                         <!-- <exclude>**/*.xml</exclude> -->
     22                         <exclude>**/*.properties</exclude>
     23                     </excludes>
     24                 </configuration>
     25             </plugin>
     26             <!-- 拷贝依赖包相关 -->
     27             <plugin>
     28                 <groupId>org.apache.maven.plugins</groupId>
     29                 <artifactId>maven-dependency-plugin</artifactId>
     30                 <version>2.10</version>
     31                 <executions>
     32                     <execution>
     33                         <id>copy-dependencies</id>
     34                         <phase>package</phase>
     35                         <goals>
     36                             <goal>copy-dependencies</goal>
     37                         </goals>
     38                         <configuration>
     39                             <outputDirectory>${project.build.directory}/lib</outputDirectory>
     40                         </configuration>
     41                     </execution>
     42                 </executions>
     43             </plugin>
     44 
     45             <plugin>
     46                 <groupId>org.mybatis.generator</groupId>
     47                 <artifactId>mybatis-generator-maven-plugin</artifactId>
     48                 <version>${mybatis.generator.version}</version>
     49                 <configuration>
     50                     <!-- mybatis用于生成代码的配置文件 -->
     51                     <configurationFile>src/main/resources/MybatisGenerator-config.xml</configurationFile>
     52                     <verbose>true</verbose>
     53                     <overwrite>true</overwrite>
     54                 </configuration>
     55             </plugin>
     56             <!-- 测试出错测忽略 -->
     57             <plugin>
     58                 <groupId>org.apache.maven.plugins</groupId>
     59                 <artifactId>maven-surefire-plugin</artifactId>
     60                 <version>2.19.1</version>
     61                 <configuration>
     62                     <skipTests>true</skipTests>
     63                     <testFailureIgnore>true</testFailureIgnore>
     64                 </configuration>
     65             </plugin>
     66             <plugin>
     67                 <groupId>org.apache.maven.plugins</groupId>
     68                 <artifactId>maven-resources-plugin</artifactId>
     69                 <version>2.6</version>
     70                 <executions>
     71                     <!-- 拷贝资源配置文件 -->
     72                     <execution>
     73                         <id>copy-resources</id>
     74                         <phase>validate</phase>
     75                         <goals>
     76                             <goal>copy-resources</goal>
     77                         </goals>
     78                         <configuration>
     79                             <outputDirectory>${project.build.directory}/</outputDirectory>
     80                             <resources>
     81                                 <resource>
     82                                     <directory>src/main/resources</directory>
     83                                     <!-- <filtering>true</filtering> -->
     84                                     <includes>
     85                                         <include>**/*.properties</include>
     86                                     </includes>
     87                                     <filtering>false</filtering>
     88                                 </resource>
     89                             </resources>
     90                         </configuration>
     91                     </execution>
     92 
     93                 </executions>
     94                 <configuration>
     95                     <encoding>${project.build.sourceEncoding}</encoding>
     96                 </configuration>
     97             </plugin>
     98             <plugin>
     99                 <groupId>org.apache.maven.plugins</groupId>
    100                 <artifactId>maven-compiler-plugin</artifactId>
    101                 <version>3.1</version>
    102                 <configuration>
    103                     <source>${jdk.version}</source>
    104                     <target>${jdk.version}</target>
    105                     <encoding>UTF-8</encoding>
    106                 </configuration>
    107             </plugin>
    108         </plugins>
    109     </build>

    第二种

     1     <build>
     2           <resources>
     3               <resource>
     4                 <directory>src/main/resource</directory>
     5                 <targetPath>${project.build.directory}/classes</targetPath>
     6                 <filtering>true</filtering>
     7             </resource>
     8             <resource>
     9                 <directory>src/test/resource</directory>
    10                 <targetPath>${project.build.directory}/test-classes</targetPath>
    11                 <filtering>true</filtering>
    12             </resource>
    13         </resources>
    14       <plugins>
    15           <plugin>
    16             <groupId>org.apache.maven.plugins</groupId>
    17             <artifactId>maven-surefire-plugin</artifactId>
    18             <version>2.4.2</version>
    19             <configuration>
    20                 <skipTests>true</skipTests>
    21             </configuration>
    22         </plugin>
    23         <plugin>
    24             <groupId>org.apache.maven.plugins</groupId>
    25             <artifactId>maven-jar-plugin</artifactId>
    26             <version>2.6</version>
    27             <configuration>
    28                 <archive>
    29                     <addMavenDescriptor>false</addMavenDescriptor>
    30                     <manifest>
    31                         <mainClass>cn.java.application.Application</mainClass>
    32                         <addClasspath>true</addClasspath>
    33                         <classpathPrefix>lib/</classpathPrefix>
    34                         <useUniqueVersions>false</useUniqueVersions>
    35                     </manifest>
    36                     <manifestEntries>
    37                         <Class-Path>./</Class-Path>
    38                     </manifestEntries>
    39                 </archive>
    40                 <excludes>
    41                     <exclude>**/*.xml</exclude>
    42                     <exclude>**/*.properties</exclude>
    43                     <exclude>**/*.sh</exclude>
    44                     <exclude>**/*.cnf</exclude>
    45                     <exclude>**/*.pl</exclude>
    46                 </excludes>
    47                 <classesDirectory>
    48                 </classesDirectory>
    49             </configuration>
    50         </plugin>
    51         <plugin>
    52             <artifactId>maven-dependency-plugin</artifactId>
    53             <executions>
    54                 <execution>
    55                     <id>copy-dependencies</id>
    56                     <phase>package</phase>
    57                     <goals>
    58                         <goal>copy-dependencies</goal>
    59                     </goals>
    60                     <configuration>
    61                         <outputDirectory>${project.build.directory}/lib</outputDirectory>
    62                         <excludeTransitive>false</excludeTransitive>
    63                         <stripVersion>false</stripVersion>
    64                     </configuration>
    65                 </execution>
    66             </executions>
    67         </plugin>
    68         <plugin>
    69             <groupId>org.apache.maven.plugins</groupId>
    70             <artifactId>maven-resources-plugin</artifactId>
    71             <version>2.6</version>
    72             <configuration>
    73                 <directory>src/main/resources</directory>
    74                 <outputDirectory>target/classes</outputDirectory>
    75                 <encoding>UTF-8</encoding>
    76             </configuration>
    77         </plugin>
    78         <plugin>
    79             <artifactId>maven-compiler-plugin</artifactId>
    80             <version>3.1</version>
    81             <configuration>
    82                 <source>1.8</source>
    83                 <target>1.8</target>
    84                 <encoding>UTF-8</encoding>
    85             </configuration>
    86         </plugin>
    87       </plugins>
    88   </build>
    View Code
  • 相关阅读:
    linux学习笔记三
    linux学习笔记二
    linux学习笔记一
    Linux操作篇之配置DNS服务(二)
    Linux操作篇之配置DNS服务(一)
    Linux操作篇之配置DHCP服务
    Linux操作篇之配置SSH服务
    Linux操作篇之自动化安装操作系统(二)
    Linux操作篇之自动化安装操作系统(一)
    Linux的shell编程篇之环境变量配置文件
  • 原文地址:https://www.cnblogs.com/twinhead/p/9707526.html
Copyright © 2020-2023  润新知