您的位置:首页 > 编程语言 > Java开发

PLUGINS that HELP YOU WORKING WITH ECLIPSE

2016-04-07 10:19 501 查看

PLUGINSthatHELPYOUWORKINGWITHECLIPSE

1
PLUGINS

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

ONLINEHELPhttps://wiki.eclipse.org/EGit/User_Guide


CheckingEclipseNetworkconfiguration

YourNEtworkconnectionshouldbelikethiswithNAtive,Dynamicoptions,inthisconfigurationEclipsewilltaketheproxyfromyourbrowsersettings.

Nevertheless,ifyouhavesometroubleswiththeseoptions,pleasechangeNativeintoManualandaddproxy@andport

global.proxy.lucent.comandport8000

HowtofindandinstallEclipsePlugin

·GotoMarketplace,searchyourpluginname,clickinstall,restartEclipse

DragandDropfromWebbrowser,selectinstallbuttonanddragitintoeclispeframe,thendrop.restartEclipseafterinstall

Fromupdatesite,clickaddcopypasteyouupdatesitelink,associateaname.thentickwantedfeatureandcliknext,followtheinstruction

Youmighthavetroubleinstallingoneplugin,sometimesversionbetweenotherplugins,eclipseandthechoosenplugindoesnotmatch.

Thenyoumightbeaskedtoresolvetheconflictmanually.

CONNECTORS

GERRIT

GIT/GERRITconnectoristheeasiestwaytoconnecttoGIT/GERRITrepository

OpenPlanningperspectiveandclickonaddTaskRepository

ThenstartinstallingGERRITconnector,byclickingonInstallMoreconnectors.searchforgerrit,ticktheinthesquareoptionandselectFinish.Followinstructionsandrestarteclipse.

JIRACONNECTOR

PleaseseeGERRITconnectorifyouwanttoinstall,insteadofchoosingGerritthenlookforJIRA.YoumayhavesometroublesinstallingJIRAconnectorasALTASSIANdoesnotmakeanymoreevolutiononthisconnector.

Theniftheautomaticprocdoesnotwork,seethemanualinstallationbelow:,seehowtoupdateusingupdatesite(

Updatesite)

Installingcertification,JIRArequirescertification,thenyou'llneedtoinsert.certinJAVAmachinetobegrantedtoJIRAviaeclipseplugin

JENKINSCONNECTOR

AniceplugintoaccessJEnkinsJobsviaEclipseisthefollowing,seehowtoinstallit

eclipse_plugin


HOWtoUSEGITPLUGINandGERRITCONNECTORS

PREREQUISITE

AsaprerequesiteyouneedtoinstallEGITpluign,see
Findingandinstallingeclipseplugin

SecondstepsistoinstallGERRITconnector,see
InstallingGerritConnector
CheckyourGITconfigurationfile,openEclipsepreferences

importantthingsishttpanduserkeys,useaddentrybuttontoinsertthem.The.gitconfigshouldbelocatedunderyouaccount,hereforWindowsitisC:\users\marguero

Checkaswellenvironementvariable,onwindowsHomeOnNetisimportanttogetyouraccountunderC:\users\<your_name>,thentakeadvantageofopenningthiswindowtocheckyouPythonpathaswell

CLONINGGITREPOSITORY

GototheGItperspective(see
Eclipseperspective),clickonClonearepositoryandchooseGerritconnector,thenNEXTbutton

SelecttheRepositoryyouwanttoClone,andclikNEXT.Followinstruction,selectingmasterbranch

You'llgetyourrepositoryclonedasshown:

it'stimetoimporttherepositoryinyourworkspace,selectImportprojectasageneralproject

·OpenyourPydevPerspective,youshouldhaveyourepositorysettledandyouarereadytoworkwithGIT/GERRIT

CREATINGYOURJIRATICKETwithMYLYN


CREATINGYOURGITBRANCHWITHEGITPLUGIN

·Priortocreateabranchyouneedtomakesureyourrepositoryissync-upwithserverrepository,thenyouneedtoperformaGITPULL

InPydevperspectiveandinNavigationview,SelectTeam,newbranch,enternameofyourbranch.(youcouldinsertinthenameyourJIRAticketforinstance).

SeeresulthowthenameisreportedinNavigator:

CODINGINYOURGITBRANCHWITHEGIT

Onceabranchiscreatedyouarereadytostartcodingyourowncode.Thereisnotauniquewayofdoingitbutthefollowingoneismaythesafestone

DONOTWORKinyourMASTERbranch.Itisnotcompulsarybutit'llprevent
makingmistakes.


CHECKING/CONFIGURINGWHERETOPUSH

Aswecanpushtogerritmasterbranchbutalsofordrafts,weneedtocheck/configurewherewearepushing

tochangethemapping,clickonAdvanced

Inthatwayyoucouldchangerefs/for/masterto
refs/drafts/masterifyouwanttopushintoGErritdraft.KnowingthataDraftcanbeconvertedeaslyintoaformalreviewintoMaterbranch

Doucleclickonrefs/for/mastertochange,thenfinishandsavesettings


EDITING,COMMITING,PUSHINGCODEWITHEGIT

Onceabranchiscreatedyouarereadytostartcodingyourowncode.Thereisnotauniquewayofdoingitbutthefollowingoneismaythesafestone

DONOTWORKinyourMASTERbranch.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.

Ifyouintendtocommitwithoutanymodification,Eclipsewouldaskyoutoamendthepreviouscommit.Thisisveruusefullwhenyouwanttomodifyeventuallyyouremailaddressordescriptionofyourcommit

LookinginTeam-Showhistorywecanseeourcommitinourbranch,NowweneedtopushittoGERRITserver

Youmighthaveissuewhenpushing,GERRITmightseesomeconflictwithwhatyouwanttosubmitandwhat'sintherepostitory

Mainreasonisthatdevelopperswerebeingbusyonthesamefile,orwhenyoucreatedyourbranchyoudidnotperformagitpulltore-sync.

Inanycase,ifgerritcan'tresolvetheconflictbyhimself,you'llneedarebase.Thiswouldbeaddressedlaterinthisdocument.

Finally,let'spush,herethePUSHisrejectedbecausethereviewinGErritisclosed

REBASINGVSMERGING

Now,let’ssaythatthenewcommitsin
master
arerelevanttothefeaturethatyou’reworkingon.Toincorporatethenewcommitsintoyour
feature
branch,youhavetwooptions:mergingorrebasing.

TheMergeOption

Mergingisnicebecauseit’sanon-destructiveoperation.Theexistingbranchesarenotchangedinanyway.Thisavoidsallofthepotentialpitfallsofrebasing(discussedbelow).

Ontheotherhand,thisalsomeansthatthe
feature
branchwillhaveanextraneousmergecommiteverytimeyouneedtoincorporateupstreamchanges.If
master
isveryactive,thiscanpolluteyourfeaturebranch’shistoryquiteabit.Whileit’spossibletomitigatethisissuewithadvanced
gitlog
options,itcanmakeithardforotherdeveloperstounderstandthehistoryoftheproject.

TheRebaseOption

Themajorbenefitofrebasingisthatyougetamuchcleanerprojecthistory.First,iteliminatestheunnecessarymergecommitsrequiredby
gitmerge
.Second,asyoucanseeintheabovediagram,rebasingalsoresultsinaperfectlylinearprojecthistory—youcanfollowthetipof
feature
allthewaytothebeginningoftheprojectwithoutanyforks.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

Inyoutask_listviewyoushouldhaveallGERRITopenchanges

DoubleclcikingonareviewwillopenitintheEclipseEditor.YouareabletoperformareviewwithinEclipse

Youcanaddreviewers,addcomments,publishcomments,comparenewandformerversions.Haveaviewperuserswithopeninsearchfeature.

HOWTOACCESSJENKINSJOBSFROMECLIPSE

ConfiguringMYLYNJENKINSCONNECTOR

InyourPydevperspective=>ClickonWindow,showviewothertogettheBuilsviewfromMylyn

·

AddaJenkinsserver

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

You'vejuststartedanewbuild,thenjustwaitforthecompletionbyclickingintoconsole

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.

Itisnowpossibletobrowsetheremotemachinelikeifyouwerelocallyonyourexplorer

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

Seeremoteproject,thisprojectmustembedyouJenkinsdevjob,thereforeyouneedtopointatleast/home/jenkins


MODIFYtheconfigurationtoMATCHyourENVIRONMENT

Tobeabletosetsomebreakpointyouneedtomodifythefilepydev_file_utils

PATHS_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"inyourmenu

Checkinconsole:

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="global.proxy.alcatel-lucent.com:8000"--quiet

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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: