suse11 builds a compilation environment

1. JDK installation:

    Copy jdk-6u10-linux-i586.bin to /usr/src directory and install JDK
   cp jdk-6u10-linux-i586.bin  /usr/src/jdk-6u10-linux-i586.bin
   cd /usr/src
   chmod +x jdk-6u10-linux-i586.bin
   ./jdk-6u10-linux-i586.bin

   Enter yes and press Enter

 

2. Install Tomcat

     mkdir -p / var / apache / tomcat
     cp tomcat.tar / var / apache
     cd / var / apache
     tar -xvf tomcat.tar
     cd / var / apache / tomcat / bin
     chmod +x *.sh

 

3. Install ANT

  a) Install ANT, download ANT's LINUX installation package, copy it to the /usr/src directory, and decompress it
  b) Append the environment variable at the bottom of the /etc/profile file, save it, and restart the server
JAVA_HOME=/usr/src/jdk1.6.0_10
ANT_HOME=/usr/src/apache-ant-1.8.2
PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin
  c) Need to download JDK/jre/lib to rt.jar and resource.jar to $JAVA_HOME/lib
     cp /usr/src/jdk1.6.0_10/jre/lib/rt.jar /usr/src/jdk1.6.0_10/lib
     cp /usr/src/jdk1.6.0_10/jre/lib/resource.jar /usr/src/jdk1.6.0_10/lib
    d) The jsp-api.jar and servlet-api.jar packages in Tomcat's lib need to be copied to $JAVA_HOME /lib
      cp /var/apache/tomcat/lib/jsp-api.jar /usr/src/jdk1.6.0_10/lib/
      cp /var/apache/tomcat/lib/servlet-api.jar /usr/src/jdk1.6.0_10/lib
 
     e) Install SVNANT (used to download code from SVN), unzip the SVNANT package, and copy the contents of lib to the $ANT_HOME/lib directory
   Download SVNANT1.2.X version from http://subclipse.tigris.org/svnant.html, the higher version will report an error.
 

 

    Note: source /etc/profile reloads environment variables

4. svn get the code script:

<?xml version="1.0" encoding="gb2312"?>
<project name="download" default="checkout" basedir=".">
       <!-- 1 -->
       <property name="remote.url"
              value="" />

       <!-- 2 -->
       <taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" />
       <target name="prepare"
              description="Prepare the dirs for other tasks">

       </target>
       <!-- 3-->
       <target name="checkout" depends="prepare">
              <svn javahl="true"
                         username=""
                         password="" >
                     <export srcUrl="${remote.url}" destPath="svncode" />
              </svn>

       </target>
</project>

 

5. Compile the script

#!/bin/bash

svn_username=xxx
source_path=/compile/code
module=xxx
svn_source=http://ip:port/xxx
echo -n " please input the svn_password:"
read svn_password

getSource(){
    echo get source start
    echo get source of $2 from SVN
    codepath=$source_path/$1
    
    if [ -d  "$codepath" ]  
    then
       echo code path is $source_path/$1
    else
       echo Source path $source_path/$1 is not exist, now create it
       mkdir $codepath
    be
    
    if [ -d  "$codepath" ]  
    then
        cd $codepath
	      rm -rf *   
	      wait                            
	      cp /compile/getSourceBuild.xml $codepath/build.xml
	      sed -i '5c value="'$2'" />' build.xml
	      sed -i '16c username="'$svn_username'"' build.xml
	      sed -i '17c password="'$svn_password'" >' build.xml	
	      ant
	      wait
	      rm build.xml
	      mv svncode/* .	
    else
       echo Source path $source_path/$1 is wrong
       exit 0        
    be
}

build(){
  echo start build $module...............
	cd cd /compile/code/$module
	echo `pwd`
	chmod -R 755 *
	dos2unix build_rpm.sh
	./build_rpm.sh
	wait
	echo "end RPM Process................."

}

#the main
getSource $module $svn_source


build

exit 0

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326689078&siteId=291194637