2014-12-23 145 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> 
相关问题