Jenkins管理靜態資源

這裏咱們的前端是使用webpack來管理靜態資源的,把靜態資源上傳到svn上面來管理前端

這裏咱們把項目和靜態資源剝離開來,而後靜態資源接入CDNwebpack

咱們的svn的結構是這樣的web

咱們須要把這些目錄都進行打包,不包含兩個xml文件apache

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

 

這裏我上傳一下個人pom.xml文件內容和assembly.xml文件內容bash

 pom.xml文件內容爲:maven

<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 文件內容爲svn

<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的時候報錯入下ui

 

 打包以後的結構以下url

[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了spa

文章轉載自:

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

相關文章
相關標籤/搜索