필요한 파일#

http://subclipse.tigris.org/svnant.html 에서 svnant를 다운로드 한다.

샘플#

build.properties#

# -----------------------------------------------------------------------------
# build.properties
# 이 파일은 svnant에서 제공하는 기본 build.xml 파일을 참고해서 다시 만든것입니다.
# -----------------------------------------------------------------------------
svnant.version=1.2.1

# -----------------------------------------------------------------------------
# 필요한 모든 jar파일
# -----------------------------------------------------------------------------
lib.dir=lib

####실제로 필요한 SVN 프로퍼티들 ####
svn.repository.url=https://ksug.googlecode.com/svn/trunk/
svn.project.base.path=SpringReference
svn.username=fromm0
svn.password=1111
# 태그명, 빌드전에 반드시 수정되어야 하는 값
# export하기 위해 사용됨
tag.name=SOME_TAG_NAME_12222008
# 새로운 브랜치명
# 브랜치를 새롭게 생성할 때만 사용됨
new.branch.name=NEW_BRANCH_12222008
####실제로 필요한 SVN 프로퍼티들 ####

build.xml#

<?xml version="1.0"?>
<!-- Sample build file used to retrieve svnant's sources -->
<project name="svnant" basedir="." default="checkoutLatest">

    <!--  all properties are in build.properties -->
    <property file="build.properties" />

    <!-- SVN and SVN-ANT Tasks properties -->
    <property name="svn.repository.url" value="${svn.repository.url}" />
    <property name="svn.project.base.path" value="${svn.project.base.path}" />
    <property name="svn.base.url" value="${svn.repository.url}/${svn.project.base.path}" />
    <property name="svnant.javahl" value="false" />
    <property name="svnant.svnkit" value="true" />
    <!-- SVN and SVN-ANT Tasks properties -->


    <!-- path to the svnant libraries. Usually they will be located in ANT_HOME/lib -->
    <path id="svnant.classpath">
        <fileset dir="${lib.dir}">
            <include name="**/*.jar" />
        </fileset>
    </path>

    <!-- load the svn task -->
    <typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.classpath" />

    <target name="clean">
        <delete dir="src_latest" />
    </target>

    <target name="checkoutLatest">
        <svn username="${svn.username}" password="${svn.password}">
            <checkout url="${svn.base.url}" revision="HEAD" destPath="src_latest" />
        </svn>
    </target>

    <!-- *************************************************************** -->
    <!-- tool-availability: Determine if SVN-ANT is available.           -->
    <!-- *************************************************************** -->
    <target name="tool-availability">
        <available resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.classpath" property="available.svnant" />
        <echo message="SVN-ANT is available = ${available.svnant}" />
    </target>


    <!-- **************************************************************** -->
    <!-- does-svnant-exist: depends on tool-availablility and     -->
    <!--                    displays error message                                   -->
    <!-- ***************************************************************** -->
    <target name="does-svnant-exist" depends="tool-availability">
        <fail unless="available.svnant">
      SVN-ANT is not available, cannot perform tagging or checkout/export svn ant task.
     </fail>
    </target>


    <!-- ****************************************************************** -->
    <!-- svntag: performs tagging using properties from                              -->
    <!--         build.properties and uses SVNANT tasks                              -->
    <!-- ******************************************************************* -->
    <target name="svntag" description="tags individual project using svnant task">
        <property name="svn.tag.message" value="Tagging Project ${project.name} with tag name ${tag.name} from trunk " />
        <property name="src.url" value="${svn.base.url}/${project.name}/trunk/" />
        <property name="dest.url" value="${svn.base.url}/${project.name}/tags/${tag.name}" />

        <echo message="${svn.tag.message}" />
        <echo message="${src.url}" />
        <echo message="${dest.url}" />

        <svn javahl="${svnant.javahl}" svnkit="${svnant.svnkit}" username="${svn.username}" password="${svn.password}">
            <copy srcUrl="${src.url}" destUrl="${dest.url}" message="${svn.tag.message}" />
        </svn>
    </target>


    <!-- ****************************************************************** -->
    <!-- svnexport: performs export using properties from                            -->
    <!--            build.properties and uses SVNANT tasks                           -->
    <!-- ****************************************************************** -->
    <target name="svnexport" description="exports individual project using svnant task">
        <property name="svn.tag.message" value="Exporting Project ${project.name} with tag name ${tag.name}" />
        <property name="src.url" value="${svn.base.url}/${project.name}/tags/${tag.name}" />
        <property name="destPath" value="${dest.path}" />
        <echo message="${svn.tag.message}" />
        <svn javahl="${svnant.javahl}" svnkit="${svnant.svnkit}" username="${svn.username}" password="${svn.password}">
            <export srcUrl="${src.url}" destPath="${destPath}/${project.name}" />
        </svn>
    </target>

    <!-- ****************************************************************** -->
    <!-- svnbranch: creates a new branch using properties from                       -->
    <!--            build.properties and uses SVNANT tasks                           -->
    <!-- ****************************************************************** -->
    <target name="svnbranch" description="creates a new branch for individual project using svnant task">

        <property name="svn.branch.message" value="Creating new branch for
    Project ${project.name} with new branch name ${new.branch.name} from
    trunk" />
        <property name="src.url" value="${svn.base.url}/${project.name}/trunk/" />
        <property name="dest.url" value="${svn.base.url}/${project.name}/branches/${new.branch.name}" />

        <echo message="${svn.branch.message}" />
        <echo message="${src.url}" />
        <echo message="${dest.url}" />

        <svn javahl="${svnant.javahl}" svnkit="${svnant.svnkit}" username="${svn.username}" password="${svn.password}">
            <copy srcUrl="${src.url}" destUrl="${dest.url}" message="${svn.branch.message}" />
        </svn>
    </target>
</project>

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-1) was last changed on 26-Dec-2008 13:59 by DongGukLee