PLUGINS that HELP YOU WORKING WITH ECLIPSE
2016-04-07 10:19
501 查看
PLUGINSthatHELPYOUWORKINGWITHECLIPSE
1PLUGINS
1.1
CheckingEclipseNetworkconfiguration
1.2
HowtofindandinstallEclipsePlugin
2
CONNECTORS
2.1
GERRIT
2.2
JIRACONNECTOR
2.3
JENKINSCONNECTOR
3
HOWtoUSEGITPLUGINandGERRITCONNECTORS
3.1
PREREQUISITE
3.2
CLONINGGITREPOSITORY
4
CREATINGYOURJIRATICKETwithMYLYN
5
CREATINGYOURGITBRANCHWITHEGITPLUGIN
6
CODINGINYOURGITBRANCHWITHEGIT
6.1
CHECKING/CONFIGURINGWHERETOPUSH
6.2
EDITING,COMMITING,PUSHINGCODEWITHEGIT
7
REBASINGVSMERGING
7.1.1
TheMergeOption
7.1.2
TheRebaseOption
7.2
MERGING
7.3
REBASING
7.3.1
STARTINGINTERACTIVEREBASE
7.3.2
ABORTINGINTERACTIVEREBASE
8
ACCESSYOUGERRITREVIEWWITHGERRITCONNECTOR
9
HOWTOACCESSJENKINSJOBSFROMECLIPSE
9.1
ConfiguringMYLYNJENKINSCONNECTOR
10
LIGHWEIGHTENVIRONMENTTODEBUG/CREATEONETESTCASE
10.1
RUNNINGONETESTCASE
10.2
GETTINGANDPARSINGLOGS
10.2.1
RSEECLISPEPLUGIN
10.2.2
USINGRSEECLISPEPLUGINtoget/parseLOGs
10.3
DEBUGGINGUSINGREMOTEPYDEVFEATURE
10.3.1
SETTINGSANDPREREQUISITE
10.3.2
CREATINGYOURREMOTEPROJECTFROMJENKINSSLAVETOYOURPC
10.3.3
MODIFYtheconfigurationtoMATCHyourENVIRONMENT
10.3.4
MODIFYINGtheMAIN()procedure
10.3.5
STARTINGDEBUGING
PLUGINS
ONLINEHELP
CheckingEclipseNetworkconfiguration
YourNEtworkconnectionshouldbelikethiswithNAtive,Dynamicoptions,inthisconfigurationEclipsewilltaketheproxyfromyourbrowsersettings.Nevertheless,ifyouhavesometroubleswiththeseoptions,pleasechangeNativeintoManualandaddproxy@andport
HowtofindandinstallEclipsePlugin
·GotoMarketplace,searchyourpluginname,clickinstall,restartEclipseFromupdatesite,clickaddcopypasteyouupdatesitelink,associateaname.thentickwantedfeatureandcliknext,followtheinstruction
Youmighthavetroubleinstallingoneplugin,sometimesversionbetweenotherplugins,eclipseandthechoosenplugindoesnotmatch.
Thenyoumightbeaskedtoresolvetheconflictmanually.
CONNECTORS
GERRIT
GIT/GERRITconnectoristheeasiestwaytoconnecttoGIT/GERRITrepositoryOpenPlanningperspectiveandclickonaddTaskRepository
ThenstartinstallingGERRITconnector,byclickingonInstallMoreconnectors.searchforgerrit,ticktheinthesquareoptionandselectFinish.Followinstructionsandrestarteclipse.
JIRACONNECTOR
PleaseseeGERRITconnectorifyouwanttoinstall,insteadofchoosingGerritthenlookforJIRA.YoumayhavesometroublesinstallingJIRAconnectorasALTASSIANdoesnotmakeanymoreevolutiononthisconnector.Theniftheautomaticprocdoesnotwork,seethemanualinstallationbelow:,seehowtoupdateusingupdatesite(
Updatesite)
Installingcertification,JIRArequirescertification,thenyou'llneedtoinsert.certinJAVAmachinetobegrantedtoJIRAviaeclipseplugin
JENKINSCONNECTOR
AniceplugintoaccessJEnkinsJobsviaEclipseisthefollowing,seehowtoinstalliteclipse_plugin
HOWtoUSEGITPLUGINandGERRITCONNECTORS
PREREQUISITE
AsaprerequesiteyouneedtoinstallEGITpluign,seeFindingandinstallingeclipseplugin
SecondstepsistoinstallGERRITconnector,see
InstallingGerritConnector
CheckyourGITconfigurationfile,openEclipsepreferences
importantthingsishttpanduserkeys,useaddentrybuttontoinsertthem.The.gitconfigshouldbelocatedunderyouaccount,hereforWindowsitisC:\users\marguero
Checkaswellenvironementvariable,onwindowsHomeOnNetisimportanttogetyouraccountunderC:\users\<your_name>,thentakeadvantageofopenningthiswindowtocheckyouPythonpathaswell
CLONINGGITREPOSITORY
GototheGItperspective(seeEclipseperspective),clickonClonearepositoryandchooseGerritconnector,thenNEXTbutton
SelecttheRepositoryyouwanttoClone,andclikNEXT.Followinstruction,selectingmasterbranch
You'llgetyourrepositoryclonedasshown:
it'stimetoimporttherepositoryinyourworkspace,selectImportprojectasageneralproject
CREATINGYOURJIRATICKETwithMYLYN
CREATINGYOURGITBRANCHWITHEGITPLUGIN
·Priortocreateabranchyouneedtomakesureyourrepositoryissync-upwithserverrepository,thenyouneedtoperformaGITPULLSeeresulthowthenameisreportedinNavigator: |
CODINGINYOURGITBRANCHWITHEGIT
Onceabranchiscreatedyouarereadytostartcodingyourowncode.ThereisnotauniquewayofdoingitbutthefollowingoneismaythesafestoneDONOTWORKinyourMASTERbranch.Itisnotcompulsarybutit'llprevent
makingmistakes.
CHECKING/CONFIGURINGWHERETOPUSH
Aswecanpushtogerritmasterbranchbutalsofordrafts,weneedtocheck/configurewherewearepushingtochangethemapping,clickonAdvanced
refs/drafts/masterifyouwanttopushintoGErritdraft.KnowingthataDraftcanbeconvertedeaslyintoaformalreviewintoMaterbranch
Doucleclickonrefs/for/mastertochange,thenfinishandsavesettings
EDITING,COMMITING,PUSHINGCODEWITHEGIT
Onceabranchiscreatedyouarereadytostartcodingyourowncode.ThereisnotauniquewayofdoingitbutthefollowingoneismaythesafestoneDONOTWORKinyourMASTERbranch.Itisnotcompulsarybutit'llprevent
makingmistakes.
YoucanstartcodingusingthePydevEditor,FilemodificationwillbeshowninNavigatorViewasfollowed,seesymbol">"
Nextstep,weneedtoCOMMITthechange,(bettertodoCOMMITfirstandthenPUSH)
ITISTHEFIRSTTIMEYOURARECOMMITINGinthisbranch
WriteinCommitmessagetheJIRAticketnumber,donotforgetasshownbelow(
donotforgetthe:,itwon'tpasstheGERRIThookotherwise),theninsertashortdescription,don'tuseexoticcharacters
Checkyouemail,ithastomatchyou'reemailaddressesdeclaredingerritserver.
Checkthefileyouarecommiting
ITISTHESECONDTIMEYOURARECOMMITINGinthisbranch
USEAPPENDbutton(right-upcornerinthepicture),oncepressedthebuttonrecallsautomaticallythepreviousmodificationandammendit.
LookinginTeam-Showhistorywecanseeourcommitinourbranch,NowweneedtopushittoGERRITserver
Youmighthaveissuewhenpushing,GERRITmightseesomeconflictwithwhatyouwanttosubmitandwhat'sintherepostitory
Mainreasonisthatdevelopperswerebeingbusyonthesamefile,orwhenyoucreatedyourbranchyoudidnotperformagitpulltore-sync.
Inanycase,ifgerritcan'tresolvetheconflictbyhimself,you'llneedarebase.Thiswouldbeaddressedlaterinthisdocument.
Finally,let'spush,herethePUSHisrejectedbecausethereviewinGErritisclosed
REBASINGVSMERGING
Now,let’ssaythatthenewcommitsinmasterarerelevanttothefeaturethatyou’reworkingon.Toincorporatethenewcommitsintoyour
featurebranch,youhavetwooptions:mergingorrebasing.
TheMergeOption
Mergingisnicebecauseit’sanon-destructiveoperation.Theexistingbranchesarenotchangedinanyway.Thisavoidsallofthepotentialpitfallsofrebasing(discussedbelow).Ontheotherhand,thisalsomeansthatthe
featurebranchwillhaveanextraneousmergecommiteverytimeyouneedtoincorporateupstreamchanges.If
masterisveryactive,thiscanpolluteyourfeaturebranch’shistoryquiteabit.Whileit’spossibletomitigatethisissuewithadvanced
gitlogoptions,itcanmakeithardforotherdeveloperstounderstandthehistoryoftheproject.
TheRebaseOption
Themajorbenefitofrebasingisthatyougetamuchcleanerprojecthistory.First,iteliminatestheunnecessarymergecommitsrequiredbygitmerge.Second,asyoucanseeintheabovediagram,rebasingalsoresultsinaperfectlylinearprojecthistory—youcanfollowthetipof
featureallthewaytothebeginningoftheprojectwithoutanyforks.Thismakesiteasiertonavigateyourprojectwithcommandslike
gitlog,
gitbisect,and
gitk.
But,therearetwotrade-offsforthispristinecommithistory:safetyandtraceability.Ifyoudon’tfollowthe
GoldenRuleofRebasing,re-writingprojecthistorycanbepotentiallycatastrophicforyourcollaborationworkflow.And,lessimportantly,rebasinglosesthecontextprovidedbyamergecommit—youcan’tseewhenupstreamchangeswereincorporatedintothe
feature.
MERGING
REBASING
STARTINGINTERACTIVEREBASE
ABORTINGINTERACTIVEREBASE
ACCESSYOUGERRITREVIEWWITHGERRITCONNECTOR
GobacktoMylynperspective(perspective)andchoosegerritcodereviewandclickNext,enternowthegerritrepository
BeforeclosingthewindowsclickonValidsettings,itwillcheckyourcredentials
Createyourquery,youcouldaskforonlyyourreviewsaswellasallopenchangesandothercustomquery.clickFinish
DoubleclcikingonareviewwillopenitintheEclipseEditor.YouareabletoperformareviewwithinEclipse
Youcanaddreviewers,addcomments,publishcomments,comparenewandformerversions.Haveaviewperuserswithopeninsearchfeature.
HOWTOACCESSJENKINSJOBSFROMECLIPSE
ConfiguringMYLYNJENKINSCONNECTOR
InyourPydevperspective=>ClickonWindow,showviewothertogettheBuilsviewfromMylynAddaJenkinsserver
Editthebuildserverproperties:EnterjenkinsserverURL,yourjenkinscrendential(loginandpassword),clickonrefreshtogetalistofJenkinsJobsandthentick
theonesyouwanttouse.ClickonValidatetoconfirmavalidconnection,thenpressFINISH
YouarereadytoworkwithMylynJenkinsconnector,nydoubleclickingononeJOByoumightseesomethingsimilartothis
Youcangetallsavedartifacts,youcanaccesstheconsole,filteringonlyfailedtestcases,seerecentGITchanges...
AnotherniceviewistheJUNITview,youwillgetquicklythefailuretraceraisedbytheTC
LASTbutnoLEASTyoucanrunajobfromthisconncetoraswell
LIGHWEIGHTENVIRONMENTTODEBUG/CREATEONETESTCASE
RUNNINGONETESTCASE
Prerequisite:JAVAandJRE+Eclipse+Pydev+EGIT+Python2.7installedonyourmachine
Onthetopofthat,GerritandJenkinsconnectorswillbeappreciated.
IfyouintendtocreateordebugoneTestcasebyprintingsomeinfointheconsole,youdon'treallyneedadebugger,neithertorunyou'repythonscriptinsideEclipse.
bettertoletJEnkinsJobrunningthetestcaseforyouwhileyou'llfocussonlyonediting/codingyourscriptwithEclipse.
Thisishowyoushouldproceed:
First,askforadevelopmentjobinjenkins,requesttobesenttoautomationteam.
E.gviewedfromJenkinsplugininEclipse
getsyncwithGITrepositoryandcreateyourowndevelopmentbranch,seechapter
egit
WhenpushingintoGIT/GERRITgofor"Drafts"==>refs/drafts/master,
seechapter
pushinginGIT
Getthereferenceofthechanges(ifGERRITconnectorisnotinstalled,grabitfromyourwebbrowser
ThenselectyoudevJOBinMylynbuildsandmodifythescriptreferencetopointoutyourdevbranch,seeabove
runningajobfromMtlynbuildconnector
jenkinsC
GETTINGANDPARSINGLOGS
RSEECLISPEPLUGIN
TogetourLogsofinterestwewilluseRSEplugin,noneedtoinstallititisalreadyinEclipse.RSEisapluginthatallowsyoutoconnectremotemachine(windowsandUnix/Linux)viamultipleprotocolessuchasTelnet,SFTP,SSH.....
Youcantransferfiles,synchronisingfolderbetweentwomachines,openingremotefiles....,comparingfilesbetweentwomachines.
ConnectaremoteTarget,inPydevperspective,openRemoteSystemsView.
ChooseSSHonly,that'sthesimplestandbestoptionforwhatwewanttodo.
InserthostnamecouldbeIPormachinename,insertaconnection,that'sgonnabethenameofyourremotemachineinRSEmenu
Eventuallyputdownadescription.
Itispossibletocopy/pastefromaremotemahcinetoyourlocaldrive
Aswellasdefiningsomefilterslikefigureabovethatwillpointsaspecificfolderinyourdirectorystructure.
HereTMPpointsoutC:\mars2\workspace\auto\TMPinanotherworditislikea
shortcut.
AnotherfeatureistocreateaRemoteproject,andthisisthe
coolestfeaturewithRSE
Youneedwriteaccess!!!tocreateyourremoteproject
Youarenowabletoopenyourremoteproject,gointoNavigatororProjectviewonopentheproject.
Youarenowseeingfilesviascpconnection,thenthinkrefreshingyourprojecttogetthelateststatus/contentofyourfiles
Closingyourproject
DeletingyourProjectfromRSEperspective.
WATCHOUT,ifyoutickDeleteProjectContentsondiskyouwillERASEremotefilesand/orfolders
USINGRSEECLISPEPLUGINtoget/parseLOGs
Asdepictedabove,itcouldbeinterestingtoget.logfromjenkinsconnectingeithertheMASTERORtheSLAVE.ConnectingtoJENKINSMASTERwillprovideoneaccesstoyourlogsoncethetestisfinished,meaningarchiveswerecompleted.
Forinstance,Ifyouinteruptthetestmanuallyartifactwon'tbesaved.
ConnectingtoJENKINSSLAVEcouldbegoodtograblogswhilethetestisstillrunning.
DEBUGGINGUSINGREMOTEPYDEVFEATURE
SETTINGSANDPREREQUISITE
YouhaveonyourPC:Eclipse+Pydevplugins(git/gerritareappreciatedbutnotcompulsary)Pydevlibmustbeinstalledontheremotetarget
Youhaveadevelopmentjob
CREATINGYOURREMOTEPROJECTFROMJENKINSSLAVETOYOURPC
MODIFYtheconfigurationtoMATCHyourENVIRONMENT
Tobeabletosetsomebreakpointyouneedtomodifythefilepydev_file_utilsPATHS_FROM_ECLIPSE_TO_PYTHON=[(r'C:\MARS2\workspace\RemoteSystemsTempFiles\LALX04SI4\home\jenkins\auto',
r'/home/jenkins/auto'),
(r'C:\MARS2\workspace\RemoteSystemsTempFiles\LALX04SI4\home\jenkins\workspace\dev-all-fv2-emarguero\src',
r'/home/jenkins/workspace/Dev-All-FV2-emarguero/src')
]
Tupplemustcontainthewaytoidentifythesrcbetweenyourtarget(JEnkinsslave)andyourPC
FirstyouneedtopointoutthefilewithintheRSEconfigwhichisunderREmoteSystemsTempFiles,theafterthatpointitdependsonyouJenkinsdevjobandhowyou'vecreatedtheremoteproject.
MODIFYINGtheMAIN()procedure
TargetPC,thenJenkinsSLAVEneedsyouPC@ipadresssinordertocommunicate.InourcasetheMainmoduleisjenkins_worker
defmain():
"""mainfunction"""
#AddpydevdtothePYTHONPATH(maybeskippedifthatpathisalreadyaddedinthePyDevconfigurations)
importsys
sys.path.append(r'/home/jenkins/auto/org.python.pydev_4.4.0.201510052309/pysrc')
printsys.path
importpydevd
pydevd.settrace("135.117.153.136",stdoutToServer=True,stderrToServer=True)
Firstyouneedtotellthepathtothepydevmodule(you'vejustmodifiedpydev_file_utils)
thenyouneedtoinsertyouip.
STARTINGDEBUGING
FirstStartPydevClientpressingthe"greenbug"inyourmenuCheckinconsole:
DebugServeratport:5678
SetenvyourPYHTONPATHandvirtualenvironement
exportPYTHONPATH=src
exportPYTHONPATH=$PYTHONPATH:~/workspace/Dev-All-FV2-emarguero/src
echo$PYTHONPATH
./home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/bin/activate
Pleasenotethatsdmvirtaulenvcanbeupgradedtoanewversion,pleaseseeyourdevjenkinsjobandlookattheconsoleoutputtogetthecurrentversion.
AswellyoushouldnotneedtoupdatetheSLAVEusingpip,butjustincasethisisthecommand:pipinstall-rrequirements.txt--proxy="
Runtheappropriatecommandeusingjenkins_worker,E.g
(sdmvirtualenv_5.0)jenkins@lalx04si4:~/workspace/Dev-All-FV2-emarguero$pythonsrc/framework/jenkins_worker.py--testenvLN-HPG8-2
2016-04-0617:49:11,181-INFO-MainThread-logger.py-120-GlobalPostBuildLogdirectoryis:
/log/20160406-CEST-174911.176741_debug.log
['/home/jenkins/workspace/Dev-All-FV2-emarguero/src/framework','/home/jenkins/workspace/Dev-All-FV2-emarguero/src','/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/lib/python2.7','/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/lib/python2.7/plat-linux2','/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/lib/python2.7/lib-tk','/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/lib/python2.7/lib-old','/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/lib/python2.7/lib-dynload','/usr/lib/python2.7','/usr/lib/python2.7/plat-linux2','/usr/lib/python2.7/lib-tk','/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/local/lib/python2.7/site-packages','/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/lib/python2.7/site-packages','/home/jenkins/auto/org.python.pydev_4.4.0.201510052309/pysrc']
Atthistimeyoushoulhaveavaliddebugsession,selectyourdebugperspective
Ifthetranslationinthepydev_file_utilsisnotcorrect,youwillhavearednotificationintheconsole.
Youcannowenjoytheremotedebugsession,usingbreakpointsandallotherfeatures.Printwillberedirectedintheterminalwindow:
ThenyoucanmodifythepythoncodedirectelyontheSLAVEusingRSEplugin,oncetheresultpleasesyou,youcanreportthischangeintoyourGIT/GERRITenvundereclipse,andthencommittingandeventuallypushingitintotherepository
OFcourseifyoustartyouJENKINSdevJobfromabrowser,youmightlooseallyourmodificationsasit'lldownloadaversionofthecodethat'smightnotcorrespondstoyourlatestlocaledition.
相关文章推荐
- Java 设计模式讲解
- Likely root cause: java.lang.IllegalStateException: jar hell!
- Likely root cause: java.lang.IllegalStateException: jar hell!
- JAVA缓存技术
- 关于在eclipse下android开发的错误:“Unable to resolve target 'android-18'"的解决方法
- activiti自定义流程之Spring整合activiti-modeler5.16实例(七):任务列表展示
- activiti自定义流程之Spring整合activiti-modeler5.16实例(七):任务列表展示
- struts2的拦截器(Interceptor)与过滤器(Filter)
- eclipse报错GC overhead limit exceed,卡顿
- Java注释详解
- Java连接SFTP服务器下载上传文件
- java中去掉html标签
- java-String中的 intern()
- Spring源代码解析(五):Spring AOP获取Proxy
- Spring源代码解析(四):Spring MVC
- Myeclipse 导入别人的项目,汉字是乱码怎么办?
- Spring源代码解析(三):Spring JDBC
- 在eclipse中查看android源码
- 64位win7系统中JDK的安装及环境变量的配置
- Spring源代码解析(二):IoC容器在Web容器中的启动