Jenkins管理静态资源

这里我们的前端是使用webpack来管理静态资源的,把静态资源上传到svn上面来管理

这里我们把项目和静态资源剥离开来,然后静态资源接入CDN

我们的svn的结构是这样的

我们需要把这些目录都进行打包,不包含两个xml文件

assembly.xml
images/
img/
pom.xml
sso_bind/
ver/
wap/
wechat/

 

这里我上传一下我的pom.xml文件内容和assembly.xml文件内容

 pom.xml文件内容为:

<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.kongzhong.static</groupId>
    <artifactId>jrstatic</artifactId>
    <version>1.0</version>
    <packaging>pom</packaging>

    <name>kongzhong static</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <fileName>jrweb</fileName>
    </properties>
    <build>  
        <finalName>${fileName}</finalName>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
        <version>2.5.5</version>
                <configuration>
                    <descriptors>
                        <descriptor>assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

 assembly.xml 文件内容为

<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
          xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
    <id>distribution</id>   一开始我没有加上这个,在使用jenkins的时候报错了
    <formats>  
        <format>zip</format>  
    </formats>  
  
    <fileSets>   
        <fileSet>  
            <directory>images</directory>  
            <useDefaultExcludes>true</useDefaultExcludes>  
        </fileSet>
        <fileSet>  
            <directory>img</directory>  
            <useDefaultExcludes>true</useDefaultExcludes>  
        </fileSet>
        <fileSet>  
            <directory>sso_bind</directory>  
            <useDefaultExcludes>true</useDefaultExcludes>  
        </fileSet>
        <fileSet>  
            <directory>ver</directory>  
            <useDefaultExcludes>true</useDefaultExcludes>  
        </fileSet>
        <fileSet>  
            <directory>wap</directory>  
            <useDefaultExcludes>true</useDefaultExcludes>  
        </fileSet>
        <fileSet>  
            <directory>wechat</directory>  
            <useDefaultExcludes>true</useDefaultExcludes>  
        </fileSet>
    </fileSets>  
</assembly>  

 上面一开始没有加id的时候报错入下

 

 打包之后的结构如下

[root@SVN-200-15 Ting-static-jrfront]# ll
total 48
-rw-r--r--.  1 root root  1257 Apr 13 14:25 assembly.xml
drwxr-xr-x.  3 root root  4096 Apr 13 14:25 images
drwxr-xr-x. 15 root root 16384 Apr 13 14:25 img
-rw-r--r--.  1 root root  1503 Apr 13 14:25 pom.xml
drwxr-xr-x.  3 root root  4096 Apr 13 14:25 sso_bind
drwxr-xr-x.  3 root root  4096 Apr 13 14:25 target
drwxr-xr-x.  6 root root  4096 Apr 13 14:25 ver
drwxr-xr-x.  6 root root  4096 Apr 13 14:25 wap
drwxr-xr-x.  7 root root  4096 Apr 13 14:25 wechat

 

[root@SVN-200-15 Ting-static-jrfront]# cd target/
[root@SVN-200-15 target]# ll
total 127588
drwxr-xr-x. 2 root root      4096 Apr 13 14:25 archive-tmp
-rw-r--r--. 1 root root 130640564 Apr 13 14:25 jrweb-distribution.zip

 

接下来就是配置jenkins了

文章转载自:

http://blog.csdn.net/houyefeng/article/details/53164697

 

posted @ 2017-04-13 11:49  BigBao的博客  阅读(2606)  评论(0编辑  收藏  举报