{"id":348,"date":"2007-08-13T00:04:18","date_gmt":"2007-08-13T04:04:18","guid":{"rendered":"http:\/\/www.dr-chuck.com\/wordpress\/?p=348"},"modified":"2011-12-17T12:23:38","modified_gmt":"2011-12-17T16:23:38","slug":"getting-a-java-maven-2-application-on-the-nmi-testbed","status":"publish","type":"post","link":"https:\/\/www.dr-chuck.com\/csev-blog\/2007\/08\/getting-a-java-maven-2-application-on-the-nmi-testbed\/","title":{"rendered":"Getting a Java + Maven 2 Application on the NMI Testbed"},"content":{"rendered":"<p>Last week I got Sakai automatically building on the NMI test facility at Wisconsin.   Here is a status page:<br \/>\n<a href=http:\/\/grandcentral.cs.wisc.edu\/pavlo\/index.php?page=results%2Foverview&#038;opt_user=csev target=_new>http:\/\/grandcentral.cs.wisc.edu\/pavlo\/index.php?page=results%2Foverview&#038;opt_user=csev<\/a><br \/>\nHere are my scripts in SVN:<br \/>\nhttps:\/\/source.sakaiproject.org\/contrib\/csev\/trunk\/nmi\/sakaimvn\/<br \/>\nThe submit file is the master control &#8211; here is my sample:<br \/>\n$ cat sakaiMaven2.submit<br \/>\nproject = sakai<br \/>\ncomponent = Trunk Build<br \/>\ncomponent_version = 1.0.0<br \/>\ndescription = Auto-build of Sakai trunk (cron)<br \/>\nrun_type = Build<br \/>\ninputs = sakaiMaven2.scp, sakaiMaven2.svn, m2-repo.scp<br \/>\nremote_task = buildSakai.sh<br \/>\nremote_task_args = &#8220;sakai\/trunk sakai&#8221;<br \/>\nplatforms =  x86_macos_10.4<br \/>\nprereqs_x86_macos_10.4 = java-1.5.0_06<br \/>\nnotify = csev@umich.edu<br \/>\nI need Java 1.5 &#8211; the simplest is to use the mac OS 10.4 systems for my builds.  Later I will develop scripts for other operating systems.<br \/>\nThe inputs specify what you want on your execution machine and how to get it there.  I have three inputs.<br \/>\nThe first copies all my shell scripts from the current directory to the destination machine using SCP.<br \/>\n[csev@nmi-s003 sakaimvn]$ cat  sakaiMaven2.scp<br \/>\nmethod = scp<br \/>\nscp_file = \/home\/csev\/sakaimvn\/*.sh<br \/>\nrecursive = true<br \/>\nThe second input checks a particular tag out of SVN of the Sakai source.<br \/>\n[csev@nmi-s003 sakaimvn]$ cat sakaiMaven2.svn<br \/>\nmethod = svn<br \/>\nurl = https:\/\/source.sakaiproject.org\/svn\/sakai\/trunk sakai<br \/>\nThe third copies a copy of a populated Maven 2 repository from my home directory on the submitting machine to the executing machine.<br \/>\n[csev@nmi-s003 sakaimvn]$ cat  m2-repo.scp<br \/>\nmethod = scp<br \/>\nscp_file = \/home\/csev\/.m2<br \/>\nrecursive = true<br \/>\nAs the source changes the .m2 repo will become out of date so I have to tar up a full repo from my dev machine from time to time and copy it over.<br \/>\nThe script to be run is pretty complex &#8211; I will point out a few important steps.<br \/>\nIn <a href=https:\/\/source.sakaiproject.org\/contrib\/csev\/trunk\/nmi\/sakaimvn\/link-repo.sh target=_new>link-repo.sh<\/a> the key line is<br \/>\nln -s `pwd`\/.m2 ~\/.m2<br \/>\nThe input directive will insure that the .m2 directory makes it into the execution directory &#8211; by soft linking it into home, Maven 2 will find it.<br \/>\nIn <a href=https:\/\/source.sakaiproject.org\/contrib\/csev\/trunk\/nmi\/sakaimvn\/nmi-bootstrap.sh target=_new>nmi-bootstrap.sh<\/a> the code is a bit tortuous &#8211; probably the clever bit is downloading a copy of Maven 2 and using the local copy.<br \/>\nI debugged this script separately on my mac before making it work on the NMI test bed.<br \/>\nI instlal Maven 2 each time the script runs &#8211; I use:<br \/>\ncurl -O http:\/\/mirrors.ibiblio.org\/pub\/mirrors\/apache\/maven\/binaries\/maven-2.0.7-bin.tar.gz<br \/>\nThen extract it into my local directory and simply use<br \/>\n`pwd`\/maven-2.0.7\/bin\/mvn<br \/>\nAs my call to maven 2.  This way I install my own pre-requisite and don&#8217;t have to depend on anything except for Java.<br \/>\nOnce this is done, I put in a crontab to automate this:<br \/>\n[csev@nmi-s003 ~]$ crontab -l<br \/>\nMAILTO=csev@umich.edu<br \/>\n22 04 * * * $HOME\/nightly.sh<br \/>\n[csev@nmi-s003 ~]$ cat nightly.sh<br \/>\n#!\/bin\/sh<br \/>\nPATH=$PATH:\/nmi\/bin:\/usr\/local\/condor\/bin<br \/>\ncd sakaimvn<br \/>\nnmi_submit sakaiMaven2.submit<br \/>\nThanks to Jim Basney and everyone who helped walk me through the process.  it took less than a day to get it all working.<br \/>\nAlso thanks to the folks at Wisconsin who walked me through the process.<\/p>\n<p><!--more--><br \/>\nOne of the things I do in by launch script is dump out variables and check the version of Java I have just for my sanity.  Here is that part of the script:<br \/>\nwhich javac<br \/>\njavac -version<br \/>\necho<br \/>\necho shell vars<br \/>\nset<br \/>\necho Env vars<br \/>\nenv<br \/>\nHere is that output:<br \/>\nWhich java are we running<br \/>\n\/prereq\/java-1.5.0_06\/bin\/java<br \/>\nWhere is curl<br \/>\n\/usr\/bin\/curl<br \/>\nWhat about javac<br \/>\n\/usr\/bin\/javac<br \/>\nshell vars<br \/>\nBASH=\/bin\/sh<br \/>\nBASH_VERSINFO=([0]=&#8221;2&#8243; [1]=&#8221;05b&#8221; [2]=&#8221;0&#8243; [3]=&#8221;1&#8243; [4]=&#8221;release&#8221; [5]=&#8221;powerpc-apple-darwin8.0&#8243;)<br \/>\nBASH_VERSION=&#8217;2.05b.0(1)-release&#8217;<br \/>\nDIRSTACK=()<br \/>\nEUID=4294967294<br \/>\nGROUPS=()<br \/>\nHOME=\/Users\/condor\/execute\/dir_3996<br \/>\nHOSTNAME=nmi-0068.cs.wisc.edu<br \/>\nHOSTTYPE=powerpc<br \/>\nIFS=&#8217;<br \/>\n&#8216;<br \/>\nMACHTYPE=powerpc-apple-darwin8.0<br \/>\nNMI_BIN=\/Users\/condor\/execute\/dir_3996\/bin<br \/>\nNMI_CONDOR_RELEASE_DIR=NMI_PLACEHOLDER_DEFAULT_VALUE<br \/>\nNMI_GNUTAR=tar<br \/>\nNMI_PLATFORM=x86_macos_10.4<br \/>\nNMI_USER_HAWKEYE_DIR=\/tmp\/nmi-hawkeye\/<br \/>\nNMI_component=SakaielloWorld<br \/>\nNMI_component_version=1.0.0<br \/>\nNMI_description=&#8217;This is a simple example&#8217;<br \/>\nNMI_inputs=sakaiMaven2.scp<br \/>\nNMI_notify=&#8217;<csev@umich.edu>&#8216;<br \/>\nNMI_platforms=x86_macos_10.4<br \/>\nNMI_prereqs=java-1.5.0_06<br \/>\nNMI_project=sakai<br \/>\nNMI_remote_task=helloWorld.sh<br \/>\nNMI_remote_task_args='&#8221;Remote_Task Task&#8221;&#8216;<br \/>\nNMI_run_type=test<br \/>\nOPTERR=1<br \/>\nOPTIND=1<br \/>\nOSTYPE=darwin8.0<br \/>\nPATH=\/prereq\/java-1.5.0_06\/bin:\/bin:\/usr\/bin:\/Users\/condor\/execute\/dir_3996\/userdir<br \/>\nPIPESTATUS=([0]=&#8221;0&#8243;)<br \/>\nPOSIXLY_CORRECT=y<br \/>\nPPID=3998<br \/>\nPS4=&#8217;+ &#8216;<br \/>\nPWD=\/Users\/condor\/execute\/dir_3996\/userdir<br \/>\nSHELL=\/usr\/bin\/false<br \/>\nSHELLOPTS=braceexpand:hashall:interactive-comments:posix<br \/>\nSHLVL=2<br \/>\nTERM=dumb<br \/>\nUID=4294967294<br \/>\nUSER=nobody<br \/>\n_=vars<br \/>\n_CONDOR_ANCESTOR_171=8042:1186004412:1008764864<br \/>\n_CONDOR_ANCESTOR_3996=3998:1186671661:3296594176<br \/>\n_CONDOR_ANCESTOR_8042=3996:1186671660:1921037768<br \/>\n_CONDOR_SCRATCH_DIR=\/Users\/condor\/execute\/dir_3996<br \/>\n_CONDOR_SLOT=1<br \/>\n_NMI_PREREQ_java_1_5_0_06_ROOT=\/prereq\/java-1.5.0_06<br \/>\n_NMI_TASKNAME=remote_task<br \/>\nEnv vars<br \/>\nNMI_USER_HAWKEYE_DIR=\/tmp\/nmi-hawkeye\/<br \/>\n_NMI_TASKNAME=remote_task<br \/>\nNMI_inputs=sakaiMaven2.scp<br \/>\nNMI_description=This is a simple example<br \/>\n_CONDOR_SCRATCH_DIR=\/Users\/condor\/execute\/dir_3996<br \/>\nNMI_project=sakai<br \/>\nUSER=nobody<br \/>\nNMI_component=SakaielloWorld<br \/>\n_CONDOR_ANCESTOR_8042=3996:1186671660:1921037768<br \/>\nNMI_notify=<csev@umich.edu><br \/>\nPATH=\/prereq\/java-1.5.0_06\/bin:\/bin:\/usr\/bin:\/Users\/condor\/execute\/dir_3996\/userdir<br \/>\nNMI_GNUTAR=tar<br \/>\nPWD=\/Users\/condor\/execute\/dir_3996\/userdir<br \/>\nNMI_PLATFORM=x86_macos_10.4<br \/>\n_NMI_PREREQ_java_1_5_0_06_ROOT=\/prereq\/java-1.5.0_06<br \/>\nNMI_remote_task_args=&#8221;Remote_Task Task&#8221;<br \/>\n_CONDOR_SLOT=1<br \/>\nSHLVL=2<br \/>\nHOME=\/Users\/condor\/execute\/dir_3996<br \/>\nNMI_remote_task=helloWorld.sh<br \/>\nNMI_component_version=1.0.0<br \/>\n_CONDOR_ANCESTOR_3996=3998:1186671661:3296594176<br \/>\nNMI_platforms=x86_macos_10.4<br \/>\nNMI_CONDOR_RELEASE_DIR=NMI_PLACEHOLDER_DEFAULT_VALUE<br \/>\nNMI_prereqs=java-1.5.0_06<br \/>\nNMI_run_type=test<br \/>\n_CONDOR_ANCESTOR_171=8042:1186004412:1008764864<br \/>\nNMI_BIN=\/Users\/condor\/execute\/dir_3996\/bin<br \/>\n_=\/usr\/bin\/env<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week I got Sakai automatically building on the NMI test facility at Wisconsin. Here is a status page: http:\/\/grandcentral.cs.wisc.edu\/pavlo\/index.php?page=results%2Foverview&#038;opt_user=csev Here are my scripts in SVN: https:\/\/source.sakaiproject.org\/contrib\/csev\/trunk\/nmi\/sakaimvn\/ The submit file is the master control &#8211; here is my sample: $ cat sakaiMaven2.submit project = sakai component = Trunk Build component_version = 1.0.0 description = Auto-build [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-348","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/comments?post=348"}],"version-history":[{"count":1,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/348\/revisions"}],"predecessor-version":[{"id":2439,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/348\/revisions\/2439"}],"wp:attachment":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/media?parent=348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/categories?post=348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/tags?post=348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}