suse11搭建编译环境
拷贝jdk-6u10-linux-i586.bin到/usr/src目录并安装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
? ?输入yes,回车
?
2、安装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. 安装ANT
a) 安装ANT,下载ANT的LINUX安装包,拷贝到/usr/src目录下,解压 b) 在/etc/profile文件的最下方追加环境变量,保存后,重启服务器JAVA_HOME=/usr/src/jdk1.6.0_10ANT_HOME=/usr/src/apache-ant-1.8.2PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin c) 需要将JDK/jre/lib下到rt.jar和resource.jar拷贝到$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) 需要将Tomcat的lib中的jsp-api.jar和servlet-api.jar包拷贝到$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) 安装SVNANT(用来从SVN上下载代码),将SVNANT包解压缩,并将lib中的内容拷贝到$ANT_HOME/lib目录下 http://subclipse.tigris.org/svnant.html 上下载 SVNANT1.2.X版本,高版本会报错。
?
? ? 注:source /etc/profile 重新加载环境变量
4、svn获取代码脚本:
<?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、编译脚本
#!/bin/bashsvn_username=xxxsource_path=/compile/codemodule=xxxsvn_source=http://ip:port/xxxecho -n " please input the svn_password:"read svn_passwordgetSource(){ 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 fi 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 fi}build(){ echo start build $module...............cd cd /compile/code/$moduleecho `pwd`chmod -R 755 *dos2unix build_rpm.sh./build_rpm.shwaitecho "end RPM Process................."}#the maingetSource $module $svn_sourcebuildexit 0
?
?