2014-12-23 65 views
1

我使用frontend-maven-plugin來運行maven的grunt構建。由grunt創建的部署zip到maven存儲庫

我有以下的pom.xml

<?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> 

    <groupId>com.a.b</groupId> 
    <artifactId>kuku</artifactId> 
    <version>1.0</version> 
    <packaging>pom</packaging> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>com.github.eirslett</groupId> 
       <artifactId>frontend-maven-plugin</artifactId> 
       <!-- NB! Set <version> to the latest released version of frontend-maven-plugin, like in README.md --> 
       <version>0.0.19</version> 

       <executions> 

        <execution> 
         <id>install node and npm</id> 
         <goals> 
          <goal>install-node-and-npm</goal> 
         </goals> 
         <configuration> 
          <nodeVersion>v0.10.33</nodeVersion> 
          <npmVersion>1.4.28</npmVersion> 
         </configuration> 
        </execution> 

        <execution> 
         <id>npm install</id> 
         <goals> 
          <goal>npm</goal> 
         </goals> 
         <!-- Optional configuration which provides for running any npm command --> 
         <configuration> 
          <arguments>install</arguments> 
         </configuration> 
        </execution> 

        <execution> 
         <id>grunt build</id> 
         <goals> 
          <goal>grunt</goal> 
         </goals> 
         <configuration> 
          <arguments>build-nightly --no-color</arguments> 
         </configuration> 
        </execution> 


       </executions> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

繁重的任務創建被稱爲kuku.zip一個zip文件。我想將這個zip文件部署到一個maven倉庫。

有上部署zip文件到Maven問題:

Jenkins "Post Build Action" to deploy zip on Maven repository

但是在這裏,因爲已經創建了一個罐子的情況是不同的,我要附加一個額外的zip文件,在這裏我不還有另一件神器。

我如何用maven實現這個任務?

回答

0

我遵循maven-assembly-plugin的方法。

首先,我所限定的組件descriptor.xml

<assembly> 
<formats> 
    <format>zip</format> 
</formats> 

<fileSets> 
    <fileSet> 
     <directory>kuku</directory> 
     <includes> 
      <include>**/*</include> 
     </includes> 
    </fileSet> 
</fileSets> 
</assembly> 

,這裏是改變的POM

<?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> 

    <groupId>a.b</groupId> 
    <artifactId>kuku</artifactId> 
    <version>1.0</version> 
    <packaging>pom</packaging> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>com.github.eirslett</groupId> 
       <artifactId>frontend-maven-plugin</artifactId> 
       <!-- NB! Set <version> to the latest released version of frontend-maven-plugin, like in README.md --> 
       <version>0.0.19</version> 

       <executions> 

        <execution> 
         <id>install node and npm</id> 
         <goals> 
          <goal>install-node-and-npm</goal> 
         </goals> 
         <configuration> 
          <nodeVersion>v0.10.33</nodeVersion> 
          <npmVersion>1.4.28</npmVersion> 
         </configuration> 
        </execution> 

        <execution> 
         <id>npm install</id> 
         <goals> 
          <goal>npm</goal> 
         </goals> 
         <!-- Optional configuration which provides for running any npm command --> 
         <configuration> 
          <arguments>install</arguments> 
         </configuration> 
        </execution> 

        <execution> 
         <id>grunt build</id> 
         <goals> 
          <goal>grunt</goal> 
         </goals> 
         <configuration> 
          <arguments>build-nightly --no-color</arguments> 
         </configuration> 
        </execution> 


       </executions> 
      </plugin> 
      <plugin> 
       <artifactId>maven-assembly-plugin</artifactId> 
       <configuration> 
        <descriptor>descriptor.xml</descriptor> 
       </configuration> 
       <executions> 
        <execution> 
         <phase>package</phase> 
         <goals> 
          <goal>single</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 
</project> 
相關問題