maven管理sshプロジェクト

3098 ワード

Mavenを使用してプロジェクトを管理する
 
1.  静的リソースのマージと圧縮
 
      pom.xmlで構成を続行するには、次の手順に従います.
  
  
 <plugin>
    <!-- YUI Compressor Maven          mvn yuicompressor:compress -->
    <groupId>net.alchim31.maven</groupId>
    <artifactId>yuicompressor-maven-plugin</artifactId>
    <version>1.3.0</version>
    <inherited>true</inherited>
    <configuration>
     <!--   js,css    UTF-8   -->
     <encoding>UTF-8</encoding>
     <!--    js      -->
     <jswarn>false</jswarn>
     <!--          ,                   ,        -->
     <force>true</force>
     <!--             -->
     <linebreakpos>-1</linebreakpos>
     <!--               -->
     <preProcessAggregates>true</preProcessAggregates>
     <!--           -->
     <suffix>.min</suffix>
     <!--    ,         -->
     <sourceDirectory>${project.build.directory}/classes/static/</sourceDirectory>
     <!--   js css   -->
     <includes>
           <include>market/css/market.css</include>
         <include>market/js/**/*.js</include>
     </includes>
     <!--              -->
     <excludes>
      <exclude>**/*.min.js</exclude>
      <exclude>**/*.min.css</exclude>
     </excludes>
     <!--           -->
     <outputDirectory>${project.build.directory}/classes/static</outputDirectory>
    </configuration>
    <executions>

      <!--      -->
     <execution>
      <id>yuicompressor</id>
      <phase>prepare-package</phase>
      <goals>
       <goal>compress</goal>
      </goals>
     </execution>
    </executions>
  </plugin>




 
2.maven管理プロジェクト、jarパッケージの構成処理:
   
<plugin>    
       <groupId>org.apache.maven.plugins</groupId>    
       <artifactId>maven-jar-plugin</artifactId>   
       <version>2.3.1</version> 
       <configuration>
        <warSourceDirectory>target/pure</warSourceDirectory>
         <packagingExcludes>
         WEB-INF/classes/static/**/*.css,
         </packagingExcludes>    
       </configuration>  
       <executions>
     <execution>
      <id>pure-jar</id>
      <phase>package</phase>
      <goals>
       <goal>jar</goal>
      </goals>
     </execution>
    </executions>
   </plugin>