大型Java项目中使用maven进行管理,pom.xml文件中build的配置

来源:互联网 发布:淘宝优惠券包括定金 编辑:程序博客网 时间:2024/05/17 22:54

这个配置文件是做某个国外的汽车网站的配置文件, 其中在build模块中, 用了些插件,是发布更加便利。

通过注释进行了简单介绍。

Xml代码 复制代码
  1.   <build>  
  2.       <finalName>dealerportal</finalName>  
  3.   
  4.  <!--    
  5.                                设置过滤文件的位置,过滤文件主要的作用是用来把过滤文件中的属性值替换被过滤文件的相同的值,   
  6.  好处是可以在项目发布的时候灵活地配置程序 -->  
  7.       <filters>  
  8.           <filter>src/main/filters/filter.properties</filter>  
  9.       </filters>  
  10.   
  11. <!--    
  12.                                               resources :   
  13.     表示发布时要打包的资源文件,需要指明,这样才会打到包中去.   
  14.  -->  
  15.       <resources>  
  16.           <resource>  
  17.               <directory>src/main/resources</directory>  
  18.           </resource>  
  19.           <resource>  
  20.               <directory>src/main/resources</directory>  
  21.               <includes>  
  22.                   <include>application.properties</include>  
  23.               </includes>  
  24.               <filtering>true</filtering>  
  25.           </resource>  
  26.       </resources>  
  27.   
  28. <!--   
  29.  
  30.     Maven 插件,用来更具domain对象生成ddl  
  31.  -->  
  32.       <plugins>  
  33.           <plugin>  
  34.               <groupId>org.apache.maven.plugins</groupId>  
  35.               <artifactId>maven-compiler-plugin</artifactId>  
  36.               <version>2.0.1</version>  
  37.               <configuration>  
  38.                   <source>1.5</source>  
  39.                   <target>1.5</target>  
  40.               </configuration>  
  41.           </plugin>  
  42.           <plugin>  
  43.               <groupId>org.codehaus.mojo</groupId>  
  44.               <artifactId>hibernate3-maven-plugin</artifactId>  
  45.               <version>2.0-alpha-2</version>  
  46.               <configuration>  
  47.                   <components>  
  48.                       <component>  
  49.                           <name>hbm2ddl</name>  
  50.                           <!-- 数据库ddl生成后的目录 -->  
  51.                           <outputDirectory>target/sql</outputDirectory>  
  52.                       </component>  
  53.                   </components>  
  54.               </configuration>  
  55.               <executions>  
  56.                   <execution>  
  57.                       <phase>process-test-resources</phase>  
  58.                       <goals>  
  59.                           <goal>hbm2ddl</goal>  
  60.                       </goals>  
  61.                       <configuration>  
  62.                           <componentProperties>  
  63.                             <!-- 这里根据hibernate.properties 及 hibernate.cfg.xml    
  64.                                 来找具体的domain对象, 以及生成ddl时的数据库dialect   
  65.                              -->  
  66.                               <propertyfile>src/main/resources/hibernate.properties</propertyfile>  
  67.                               <configurationfile>src/main/resources/hibernate.cfg.xml</configurationfile>  
  68.                               <drop>false</drop>  
  69.                               <create>false</create>  
  70.                               <update>false</update>  
  71.                               <export>false</export>  
  72.                               <!-- 生成后的ddl文件名 -->  
  73.                               <outputfilename>schema.sql</outputfilename>  
  74.                               <format>true</format>  
  75.                           </componentProperties>  
  76.                       </configuration>  
  77.                   </execution>  
  78.               </executions>  
  79.           </plugin>  
  80.              
  81.           <plugin>  
  82.               <groupId>org.apache.maven.plugins</groupId>  
  83.               <artifactId>maven-resources-plugin</artifactId>  
  84.               <version>2.2</version>  
  85.           </plugin>  
  86.              
  87.           <!-- 使用 TestNG 进行测试的插件 -->  
  88.           <plugin>  
  89.               <groupId>org.apache.maven.plugins</groupId>  
  90.               <artifactId>maven-surefire-plugin</artifactId>  
  91.               <version>2.4-SNAPSHOT</version>  
  92.               <configuration>  
  93.                   <suiteXmlFiles>  
  94.                     <!--  指明了tesgng.xml的位置 -->  
  95.                       <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>  
  96.                   </suiteXmlFiles>  
  97.               </configuration>  
  98.           </plugin>  
  99.           <plugin>  
  100.               <groupId>org.codehaus.mojo</groupId>  
  101.               <artifactId>aspectj-maven-plugin</artifactId>  
  102.               <version>1.0-beta-2</version>  
  103.               <configuration>  
  104.                   <verbose>true</verbose>  
  105.                   <complianceLevel>1.5</complianceLevel>  
  106.                   <source>1.5</source>  
  107.                   <showWeaveInfo>true</showWeaveInfo>  
  108.                   <outxml>true</outxml>  
  109.                   <aspectLibraries>  
  110.                       <aspectLibrary>  
  111.                           <groupId>org.springframework</groupId>  
  112.                           <artifactId>spring-aspects</artifactId>  
  113.                       </aspectLibrary>  
  114.                   </aspectLibraries>  
  115.                   <includes>  
  116.                       <include>**/*.java</include>  
  117.                   </includes>  
  118.               </configuration>  
  119.               <executions>  
  120.                   <execution>  
  121.                       <goals>  
  122.                           <goal>compile</goal>  
  123.                       </goals>  
  124.                   </execution>  
  125.               </executions>  
  126.           </plugin>  
  127.              
  128.           <!-- Axistools maven plugin -->  
  129.           <plugin>  
  130.               <groupId>org.codehaus.mojo</groupId>  
  131.               <artifactId>axistools-maven-plugin</artifactId>  
  132.               <version>1.1</version>  
  133.               <configuration>  
  134.                   <sourceDirectory>src/main/wsdl</sourceDirectory>  
  135.                   <packageSpace>com.trilogy.dealerportal.ws</packageSpace>  
  136.                   <testCases>false</testCases>  
  137.                   <serverSide>false</serverSide>  
  138.                   <subPackageByFileName>true</subPackageByFileName>  
  139.                   <outputDirectory>target/generated-sources</outputDirectory>  
  140.                   <timestampDirectory>target/wsdl</timestampDirectory>  
  141.               </configuration>  
  142.               <executions>  
  143.                   <execution>  
  144.                       <goals>  
  145.                           <goal>wsdl2java</goal>  
  146.                       </goals>  
  147.                   </execution>  
  148.               </executions>  
  149.           </plugin>  
  150.       </plugins>  
  151.   </build>  
原创粉丝点击