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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM