pax_global_header00006660000000000000000000000064151560637050014522gustar00rootroot0000000000000052 comment=92427b1ebedd8ff2a2a5cfd70f9a54aa07285176 jruby-jar-dependencies-92427b1/000077500000000000000000000000001515606370500163275ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/.envrc000066400000000000000000000000151515606370500174410ustar00rootroot00000000000000PATH_add bin jruby-jar-dependencies-92427b1/.github/000077500000000000000000000000001515606370500176675ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/.github/workflows/000077500000000000000000000000001515606370500217245ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/.github/workflows/main.yml000066400000000000000000000012021515606370500233660ustar00rootroot00000000000000name: Ruby on: push: branches: [ master ] pull_request: branches: [ master ] jobs: test: runs-on: ubuntu-latest strategy: matrix: ruby-version: [jruby-9.3, jruby-9.4, jruby-10.0] steps: - uses: actions/checkout@v5 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - name: Install dependencies run: bundle install - name: Run test run: jruby -Ilib -rbundler/setup -S rake specs - name: Run RuboCop run: jruby -Ilib -rbundler/setup -S rubocop lib jruby-jar-dependencies-92427b1/.gitignore000066400000000000000000000001331515606370500203140ustar00rootroot00000000000000pkg .ruby-version *.gem target build.log pom* specs/repository/* example/dependencies.list jruby-jar-dependencies-92427b1/.mvn/000077500000000000000000000000001515606370500172055ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/.mvn/extensions.xml000066400000000000000000000003211515606370500221220ustar00rootroot00000000000000 io.takari.polyglot polyglot-ruby 0.7.2 jruby-jar-dependencies-92427b1/.mvn/wrapper/000077500000000000000000000000001515606370500206655ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/.mvn/wrapper/maven-wrapper.jar000066400000000000000000001405361515606370500241600ustar00rootroot00000000000000PK F3org/apache/maven/wrapper/BootstrapMainStarter.classVYwV.-G$$ఙ%`gR M )B &tX K$}kyqr)}oEEhvpl99;}3sGo<1`?˸ # IS`2˸" A5s 2^ %!z9MFFFBA2r 8XڼX n( CF!Sl-e8;fq+:ɧJ /k$ՌY{U(yaH$-{!l' "7lXveK/n\v=wĖat.yC[f.$R #n%Pi˜͋x*gfe|74IZZ0\9`r7qe&Y8MOİ.'""[9:<&*:Yb-]nO g Kj%l{dvEH\׽ i5 nM0li9=d2E*Y~snUɸpT< j&ZQQR[2T,UxCśxKx0uWS2jc|B>/fnPe|3|N3<_K_uKPxuʧ-k[2zpdzU2rr#5#nG&H-c3ݬJs:Oϔ>`\w^pa]aա֕jhbMoe2I PwSˎ pC qȴfsfM6kjqJ Z^\ )[{׺pwŠ>&\A6&e(|ZscJ6iۢ [D|<5Pc*7M=JG_3\n=Qrׅb"Q )X蔉Δ&>7THY\CtU!y&-RZ[:y󁉹LAzKГ߿v65 {UdYaL2p~ /#Z\Fpm*TưR4ѱΫJ* C'ۂ2 Fp7@WzThuaى}e(QDaurE^ L<\_gG!);JFD/TS ŶQ}&Z'\IBhJdx{O[Dڕ?PKy]7TPK FIorg/apache/maven/wrapper/cli/AbstractPropertiesCommandLineConverter.classWmWE~&ٰɲRB BQjӆMi+v,a! _K*zHZlB#=9swܹgܙ׏%@BĬnf^ސ&{%bQB Kx[2>]?J@c]Py';Yr].be\7tgXd̔О m.Yw iB SU2~I)800tL*R5#c)٬fԌ\KQ$k)ȔilRimhw>p<2PXF1ұcFLL5G3ZT1[ǀjkz:gQ" bلԒuF:%[NܰP {pgbJ,I=m(ەz"5ET°p?nX c5!z& SJmjJ&䳖f.-F)*\)a䄊EB e9ɓkgufRK:I3\?"6ax/Y?$fӣHίnhC&QWziؓQW}՜HI3gMgCpnq:jxgd㌈-0D2xOY>bR4 -^'"n-cy2[2>G2>42> >W2p# p ?9p4is[ᔏ 6m90p}/>y]4h#C0u׭R^b3ng{1ۼUkz9:&T^?Dw=znGԍ_c7 =]ԗCŀgqxxwR8H/_W$j_^$}OP*;q~E l$rI6Ri$E}?ó,\H|CQW,lj{{>Ao[ՅvQ-F>J#cHD_sصdPոE ɕ(_@k1̝C7v'\PG˾C 9/Iyþw apiCHm < !Ijp= \!&("_Ae\qyZ)󴂫ƹˑs LwxOD~C44BcxDT4<]9tr s:&)"4zo졸R9" 7KIxT`qەwPKQ+j PK F?org/apache/maven/wrapper/cli/CommandLineArgumentException.classJ1'ZmłboI*) mF6%Z |J0|pPoC݆Kv O':nHeSe9(1#Pd154Ru ':^ԟ0W)L8fC"!k 2dz8K<p8 &*i7~ѧY ~)q (C,*F/7L`KhAH=YӞy1KF=&l⩱B}P,(624d<>C' dQK>UaX5ݵOPK^F?SgPK F7org/apache/maven/wrapper/cli/CommandLineConverter.classJAϘi?^$+BXA x?mdwvGٺzhaYruof|w8}}|@ N8rbR6g4d" %62ŧ}޿('*S3mN)Ev`YmufkwW2,a+҈Q7ɒ%CNG>j}ݗskӕTt^x`~_L`m uv:P]kvx&}|v;z Xth#m$PmH&/VJ]&@T$E*WQ[6R(UlYmX]Aܗ}80PK$5HPK F4org/apache/maven/wrapper/cli/CommandLineOption.classV[wUݓ4^%-P҄6]ZʥzR[E&c:% /xMyA],d-O<p}&trS!3}}$p_ez;v`ocA#nxܖq'w𮌻b[Fg%+#FY1=ȅ.WC'2 2 Yu(I^U﫩SiОsj-M`xeW\*m[`ZrA3GE&mDMR!=k j;d$D%KY(FYhiU/FF51nJnOH{lRՄzf˅e͚{Q 4]>}oUS6- +: zpڴr)fVTAZ,jV*S)98UbTX[N3U-Zӑ̽:7e%$3(W8sn0;|"+j R<dAjiEz6ڨK7|1𑫀rk蠥y pҹjo1)&1JwTf'$q?4ir_fhuXQAU0g7{zI- v5cR`L[)iW,㑂!nN%BUo)^cCb >tkSoH?oInm~)ps0j0ehX>p!Չ_0u6%0t^ \LWjyjp^֮Pwd5+o ­#MʧLkF^qMImV0 "* 9a?Ou:?3羇7{wc<ٯ#SH-= h[C0 ;9h3³yO^!8n|r֋.lG$1Ҙ &{rO1Hq4h%XỲrco%28!M֡R ø0řHou8&#U6 )ML9Ӟ؊0 ;G);kw$i 49L#MA Q/D9&qM>hqHq&r bj7d\`L~skɨxc"'ױKYLF=uј}}N: ~I ".j#=5H}LWyY\p wH\i!a%V DXn"+wE] v5B7UyѾxJ;o{"sZ<# gC^_o%G$gj'[QBpτ3Ur:3aCcsr/N: ZC- IXYQ"hˮ_F̉P>-^u? a|6K?tOPKM/oPK FIorg/apache/maven/wrapper/cli/CommandLineParser$AfterFirstSubCommand.classVNA VZ` xAH)w E$,f/5$&>1-PR@!\9>ddԡ^葉v?x(ᑄ~!!.ቄA ɐ0,!Pe/p!2\]֔5ʦyRԜ$͵5n,tCVAD7t{Am|#Tg'%^f5%_1e<7-]DH)֬1*ؙŢIahV2 F=>*U$KY2ԚF斝ۺiHehp׮cbdy=7FVؖndYy*%.No:bI"jɧ::<_^+tML =benAΘ떪i[dE݃hą Bh0&%L1C23{ j!]z++*Nng-G1jr J"91 #nǭx,O +@a&h_As0_$ڹ:cIT(ZBJ:06VBX½) `p+iϕ(gΪөXu۩؈䶎ԭDN v&>)qF6jk]kUk+=0ƽu~g;RO\7ԻbSrhTQ߭%^?Rx7Ub-y-+Uw+j"C#C:zr3+-zTzԖITr#זbJfq "r{D:7= ƒ[@Ϙz9iVt0t0G̵"JgKvTƛ:nq Ct9o)v#4QatPGEbLqQƐn(^.?\^ q%W};PGOu;I] Kii4L }FlT h<E.`Ed6tG_R@ghV^Z} +u0F> (# 9baׇ}|k 0*,Ip!~l($=TC2L-dU_ ʟ0s`;1Lp6% yv 0itK^h>W9yfd7uPKv3PK FJorg/apache/maven/wrapper/cli/CommandLineParser$BeforeFirstSubCommand.classWmWG~&YX,RB-- $!/FPAFm},cXMvs6C=mVneQ闝;w}?, %Qd+9\a2⊌evUk27qSA?VeDdz 1fH-ꚾS57SVs;WԒUiz0f7 p _2MaupLV2oi*Q"yKתw4Q1D}+prK&z4T Nl+> *|wY_N;-hS;eʸ0=ʹ䍉푖jf%Utlì:)~D]NN`Nomвg9w8;jڜZhi 0(Ei"/:xbUǰ!+sk\ʸK|ŐwY*7 W}m>4MKoKI ك[+7:oɖVNUoˊӍ$Cx7 \wd* >ͽC7J+oYl~_tQ,>;P:P!>\+Fcl&ME`wp4'* wδE拳]6+Zk(PG?âA,:H@,BZ>}=BK#2hCG!pgԅδ>ȷ! O="PJqZbį>F)rT JS0l815,|k{2=OP/`])6"rXc.s b6IB$s3$VR%-#39\J4ʮخz`t<2}0wv]Č{CYW,>q9HD$Ps;iF P+ϣ9_[RҨIʿPKqU^ PK FTorg/apache/maven/wrapper/cli/CommandLineParser$CaseInsensitiveStringComparator.classS[OAf{ٶnW J)RSBb4$)}X26[x&ogv75ćsܾs=ǧbK̑A6Ƽb㉍5.CvK*n3* $ZRAP}~%K{{4ĘOdh@@LC-U\ NS)]ZϽP[}]+]qudz:zuۋnRuϸƑQrr~(}U3Ӎ 4<>f`Sl{ ^ /Z n2P3 ra2)5o1۲x80mmA(oFڦR?Оx) 's#pk&AW԰Ђ?K9ƌg wA.a1̌a}R&kaafhN7G{GeC7$2Տ>bHgw\%݉02̲I4R?7zRDZ@<+UƙIUb.B*:inR[qG ¿"_dU.=;Ľ8pWGpE%*Q{~NJXaY3TSx/Q$Z4E`%e$J_PK`vltPK FKorg/apache/maven/wrapper/cli/CommandLineParser$KnownOptionParserState.classXk|UdL&%lI]%%I"%QHM 0i73l'FTR[Aɦ! BW?on^[&~˽{92V)!!  s?p!XBb.te|0~o$ғ8e0T5 53(!k3ǡ7bmuSD}E5k@<I&zqitgTzܳ/NAp7܏}` Q1*jnڇv{3*ؔ1Fqa|T"mhJr ms% էaji4= J6{%U-S (#UE2[q:N70).xg[w9% q6bw§}YGN>K( 堐T}Zd:ihl T@[bև\5o4$%+C$JH w{N:b.t&pl;.@RXFT+iP/lh-+ph#KOt}; pác ᔤ "(SOm9f[l+a܊P3(Ƿڧ32K3BMa4,g2l!d v;hnPQ!8Yh8)Y\MG|/PK樸PK FKorg/apache/maven/wrapper/cli/CommandLineParser$OptionAwareParserState.classUmOP~6֭+n"P .`If෻.m!~I(㹥R_zy{soϹ?a)PpM*I 7dH$e$Q0#&CJ;n5e0xkm:5Mo w\YQf{k+ۓ8"w޴L>69,|!Vɴ0,w7d:o׹c =0Ϻi[ j<_ylYSis5(QǥStۆA0 MT_ jcZrC;-A~m-.@jO맼럞Zr^wtc=0%((H#4n))1,ᎂ9%+ jJHj /=Y2׫77afQ>C8vҫ  ' s-0vr$Lwo6x|uuusEsfBbjxmf1Q虉`P)Ɉ%K13U)"J2T ur A.(l2EalYQ5"y"*"q/Nq # p6G/TInCZ\ T[QS,S{ꖂi-!2D Ih]>0sS$9MEfI"PK5PK FEorg/apache/maven/wrapper/cli/CommandLineParser$OptionComparator.classTYOQn;eJilUpӖmZ,VH0!ѷK)C3t /1ΤZ"Շ9,/c;fC=S A|l *U,rOU,K*1t1=%knZy_دAUu){J9ԫ ݊[f*WfLSYW<6]xVټRV4t"LjE9GPݳ#)B'lw  .Urwp^'#>(6N'NnRu^p@ N>iqױ, gun8_=e>g}bC0@ OaNgp1BQgE4H iD`7PKVPK FForg/apache/maven/wrapper/cli/CommandLineParser$OptionParserState.classSN@=L T}QA ,0bAS*"@ bnbF {l'X!uG!8{q=>{XQ<,3TJ%C~vs0ەJ'Sg<>Zq53eF\n<DMu$RY&t2Iչu4HfRE6|בG{F-T001WQ3ZLH}?xPg-Mf0*vZevçtCS6p6m5L e?{Կ!e* F%\أ fA* ab & 5pS\xY^ذe:cqoƈ0/xW/ԫӮY:kB'PKe=$PK FAorg/apache/maven/wrapper/cli/CommandLineParser$OptionString.classTNQNز,?Q" BPT0&&wIYlwQ|o!H4|"oD .:gf73/`ILH"'ͩ,y4LАbFnh~!UnZ}-3y\R 3g= زW ]++Vw+[ɷBVl^#3n; `|_. t%W- ժ-X^ݢ,GFq%>vjXړ6s=gp!zk "Ն )[Ga-`0' Qה%}mđk@).!e n) t!ESrDE/ҮS. <40A3p1_`ԟjk[;ϹNN(#7!n36Do1I(ȐkAO'/"B>+_7}=dmlDAGUĀOV=i'sy7PK82dPK FKorg/apache/maven/wrapper/cli/CommandLineParser$OptionStringComparator.classT]OP~Y@NLlҍJFdQC`2Cwlŭ]+p7M=]Eq3f=yޯoO XŢM*2*jP`#"/I.(XalXm2 { J90˖mt\73Yv'\KځSV!,ǮxeJN%\9.mۦ[jv$ պi4ői]jQmXE6} K?ntSԪoQ 8FC5,{),}e]w\pO'V0»f+{da&wfp'o*V|Qf # jX'mRiVG$WnIӱ{*3 qImmm˳5BOF! V^H#aj aaôk^Niˀ}($pB# I{R8H'W']0)]%"/ʜ"n)ch ¼<1J# #]J ߠxc\CbH18 |ohW4hHjqor WI\3F9H:i i}zߢqnC]bJE*:S]E?BVq0G0$Rɿo4K0C:w jnx.wwu /Th!H9HVP-UL iH@BovEIhl6EP܅M$Ca>}):Ӫ[[z)K >iU>.y)k{hyq(K]\ @T'HKUڍd\na2#RDbk=H@aaJVQ#]c/@jplPUoO0BD}码C8#&|!cH S^'~5m0$#&FeP2D(BY E2J}FRlZ&8C&&~OPbm29 %jdFd!3LTGI.5DxRڙSVT,ŠJ>29Ր kb3PN/jK2Ґ,2\QbCX&ϐQXfj+M SΔw! ps YuJt}@(\  hFջ0 )Ŧ\" T*qba;w1kh! EZkmvNDc\&\kǝUm@"A:s-.5q'ڱkH ǐ&J<(s͂9[uxٚX-5N‘zP,hh^mvD1XlƜlJ;fs 6S`#e[mvUG" B;v ٳܟa;Z2X:kNU͉TmN9J:q\E.v8^$]! x^pi9Ͷ3e]I(Z6B&QT塸vMP$X"+-[/F[e:ժhkrb+BZmXHNzCTcq[R4eRA%p׮V^4e.XKkO~?FD;T gfP^nic;+X6DMQw"-"*h4jr1\S6$V5C3J1\$\y/յv$M--%ь6FR#.M3呋kr' ^0{)wTx?V.ءI(~g[I#sߙNr%h$6;S *3 kv@rވ~*bŜKJG'#u|777Wqߩ"uS ǩ '-/_eQ_sAYN~Mr.[س\r|w=IVPރ|3{PyZ3{0lo.$pVic\Iw+x*\=*|~ ƈglZ ViV؅ݜ}e"O1{, o 0|/zQ$Cqcy`L^ey z{1NKR_ q.y:+ЍP؇Ij.y%8yƓ2#nLݘF+I0] ws.e1)f(Z#h{^[E+L/:Yz}IR iϡ|7I=ԻQЇ nTwD~evߋYkOJ$jCSI*PEFNE<vju iP ̥*ة+{i)fT,$K3rn u.A]<&0Xz)"So]gWvc~3:BT<= ~7b.T\8M8`+tbA+l3!ǰ{9=S׈}D.aXe"R)v9;r-Rq\e'=V}A^čnVGC>]7-qÈVd6| _LCxǘlj̠f;K]\:Ҧ< S8|jդg rz+>H в?aŞ3g&W]x7N'tO[o FS=ÞE(<3𼁽1f=RaRXr'8s~v37 [s90(J\仟f<|Fvf!x8'{~#}Xp0K+xԋ3<Ї joe/.-`T[w,WlVFfș)&+,fr'W$*y”` WNbuarGEg9BV+@ `~E}7ϧuYiWzIbyvoԒs/iO/9Oy z~REޗQnlA *R\@S EFI#Utg0r&Ie 9 xaao'܋L{2W "c|q/0+&Gr^xUjuَ7v)-yo[q)Jn\KtZS2Cr;;G쇘kAZ 7}mi0d1?u؈W%G=:NK^&#({#j9r?b)e/mOil]='LtWO94וo#Tog1s`DV6*4"+SRH!$1q3O?q6#bǬXGbfh},z,E=7zaf yE"Oy&]u;rң=P* !f\N- PJYUl՞)zP?WgV>Ѱ߹9dInXC2\=û(g ޼Q NjaKe-|kk9Ƴ :%ƙ" \vl;9>l?Jlz!\G~t_PKB *PK F4org/apache/maven/wrapper/cli/ParsedCommandLine.classWi{~G`ca0lE M55$8uҖ 5b41mҦomh y t> ?},Y=s9Y?TbjA?.cDYC%*XR+`Y<+6܊W⣭^*>'c؆Ot ]x6ω[%, WT|5Ѓo+hJiǗg,ə/Ꙋc2SziXAˌ/N65dA/3Ig72 Q,zdؙl\ n&j ?OT7zUL=J(W5(p<XEx͓Nj%~Чag4CNï>j ~`_`BՃW7d߁r_h9ɜqELpohoo\lITe6ܚ )9#:u׫3M@;;TDvVʖF !r^?j6 rѲtxҧO_xk#kw[{sl$n  wr8LЂJ+w C`2eT.\B]*J߅bm)u(t6:"`(b% E~PW+tA̮se͛ w9V>zЍ=8}ৼIj >#0$ w1 n1r=5gn@Č1"F'v9\VT1┊xZ$;E>.%#Z2='$^GfBb?` +w2.דe@3/kA#䝽.=uS3JЏzxkt||uӷƺLck'9B(1F'iRSTx-L76LJN?^PsFC>T²s!*;?@wۧÎ{虋<(z!p=.c>zkngI`.bmYoZ}EcࢇdF" E/|]ه=nLy>nLOyYքu ~[KVsW%鮐)x^w74-'-ZGZMB`]N\ejI+1|* mPK:cHPK F:org/apache/maven/wrapper/cli/ParsedCommandLineOption.classS]OA=ӯ"|(PeU~"*&5|Imv(M| 2]3w=sg'F^D!h$-7Lơ%nvS=|rW=bh !]\kuǝaHݦ-FN}7Zɵu:3G%Y9pn|!hUE.W|ݠHhm]`ĭĤP\Zo S{gFCZеvDeѪ׹Y+ WLj wUaʍ%Vrys:&+m氤Ղ3sx`Wua ݹYҏ8?J_Ɲ@!YvY<%sOJ$aL;5;K!S]Ҟ@E!L;  WD>{ٗh,"B5S|\Fߏ+vUCtme=  >R!KacqRGP[Dj%F'GBb^p& Q*}<J})cH^y4.Zߍ ;P"ɂOG}-3-R%H#2PK0aPK FHorg/apache/maven/wrapper/cli/ProjectPropertiesCommandLineConverter.classN@"\`\@.$ qE~ZeLi)ҕ 2B55wߙ3ͼ=!l`'YBADB1HC!bOxzn{+c3b ۓ1y1o+Lf_;5 9Z#=hd:fPr#4>jѻSnẃVw(Zo[c~ Ce㥈lhd!ǀ" \ P|gV*CѰBᎌFNhY;fShSB[o]VDOXthk2Ij #@jfnV`ja ݘPV +K4n%e -%e0[>OUPKDo5PK FGorg/apache/maven/wrapper/cli/SystemPropertiesCommandLineConverter.classN@p"( t…@\$C91mJW&.|8-1gq?wd>> 5nrgc@i d|}#G)>3X t\&5Aӥ3'A}i9J .w]#ܛ))26o}ɸG4tFMz9y6~Y{()spL a/+|*,da_Zk #P "+Pt?>V~5֛ضzsw>6οMQ *pY5‘S52U&*g^I *" EK npz^B?7DfQ=U:rm}PK,n&PK F2org/apache/maven/wrapper/DefaultDownloader$1.class= @-D\#b dL"nDP⊥3{|0|`^ @HbYZm97= -snlKX*.8D*F8 6ƈ[h.K) G4T'+g4S O 4}7P~PK*8PK FSorg/apache/maven/wrapper/DefaultDownloader$SystemPropertiesProxyAuthenticator.classSmoA~(ǵETQZ\j4BI-p#{K)JF?8 $އyyٙ&ș3]+XM`-%3&  <`p}Wd}X5hŚ7Gt-soKWGƘj!^?T+!iJW:Wd^U@6pHNO8#zj;^B_fXj K@6|n3'~_(gzPJ,Jeݶ&Cq<s/ʺqu/3gby,0aϰRSμ4BMOl(Yx-]᱁' HIIO86fiCjq 2$ vm,DIogM Ϧ^055i#*HɉDTSJT.j,ӏlAQD b.!I[ "_H Eg|`pNk4!(BV~GC:vtjc#W(h85(ObOhxU9Ђ44 3E_e<+h*&VO_Wo *[BEAyQŷUeQqQwU\R ~ ~$ehp]ӕ=qQΛ1]_8XMˤ v$4j,8=$Hq zMقY'\0rᱩӉ1vHh6Д #gJ1YÚOxNƚ&Blt\N"2VƻWgS:%G4m4g,s1cLַjd> 3n;sFH͛9i/8ttF!mMޞ\1fC8Ҙ#F>0X|*DgbӎҵjQ8m^ l5UOytXBˊٸ噎ed_ɮQ<ΓMtΙLav$S#t*L~sޱwvA(e= ?:'S[:w];:&Rw.LvͥmLQl!Ӹ">h[v;m;abS.ə3,U;4R= meV/}~ `⥨u=Yo劍Xmc*KkV۱y^(JAZ5{A®}-x-{ǀTAiX͹J1g\I6yPޖSnȑt ٳKZ)֎XGV*xM̗U mktV5(Û2+Qt=´m_85lG FYbSe(9q2*9]!A%{k(95֪gV?6 #SDTgEs>3(÷ ں!uu_G: _qƺ!M4EtkIJ ? IJ ކ|[hZ@Wku@ehm DK;|Y1 "Il)B{pn(B?ݳƲR<|!>a"xq?m#i*!.dxdŋTHMiBh,9$h]Dt")m(,oRbƘRĦX!uwMuHbrL-bs+k)cPۤm@,W%-ۋO2ޘZ^^%x[oAE{ ElCzM"1E8.?Rga |Peط3MLi:0+G1Wg0\$w+7.S]G|L N+C4`2/ӀzuVq s߸a1TZU|W_K7ƣw8q(%&9[Lhhg&u<J$݉H,H*1%T{ɖH/Vr%4bhV: "@G=eJpUq^dk9"x7KTGGbZTzXPK$ PK F)org/apache/maven/wrapper/Downloader.classEM @ _< 7q.ݪ  ΔͅPTB%/y`UZ`ȋs]/&_)O;Bcv 8cN7l.ͨ$dp`qVjdؤREbO8 rwt PcfMoPK ]StPK F(org/apache/maven/wrapper/Installer.classX |Uy?7977(pE!C@ %H@$9+{υZVkk?-XVڭXM(mnnv6ݺkvmgKϹHb%y?~oS~b¿i~jc?~.?~f?~Wu t_1^o|x]4,oqkD8$%6%R$6>+_ J|bdvK 2CNX&s.Vj' GY+)>Yh"C$ tuMr6KR-|ܐCV֏eΐz?Z&iI#rʐU~\! YG>Y&?^ur\6d~7 n٤%"bHd_ڔ`!2dv5 ]/.ٮ+w!݂@k֖ގ[{vhܻ}{[ư=$BĢINJ:pU`H4āF+n #a;x$avuN(lI&HNjξ;[6!g-6;W+v [b`vG(jw"vbEuEl !OLz`%i rPlz wP@*a9Xtt,BƭH|O(#AU`^--MPݱ/F` *D/ ҔD?D8Fv{w F=3=C9aumk/Cvpc4wG#l1ht|9v4VTtfG1*zD :Fy7өUP9#yJc|Nլ+!Ă& ΂#uB;S8Z+ܓ#:<8h XrP4hEG2b 8bak We5l Tgo￞ӦGnVw`-r) M % F~_U*ޒHX#&~Є0Ca:h,ϲt0!FbϺkM34.1ǔۡg98K43~U3c13Qz͔#*|, VqbzT'OLc)TEo -TxMڴ;l[I{1ź #Ti\gČX!J6אOi)G׎۔䳦/gfD4:)ʃ6S>T̰jCJr$>j$r!j2=&#wI|Q)QC3q`_Ry1Ӓ _^:9WGl7dr3&'MLHOCcWflY(2:[:95y]vnzeO2W݌i`=,v[O8iZd`מwdf>'6bx1c/F88tHyM쁞T8xK*f`C'u{LFR !M wƘSRҽd[$ e&3Z.{㍺N#-X8ؚKKg0xT/[d.kQ7v^obX1RJNc NŤ Q+Xisjf^"_U2W+8bRrͻ˩K*"4ڙ5>i6#O{iO<4DY sdyWDZ=_r40N#vXœ6+#fFR{xY*}%Ӂ!t|c6Ӿ3v@Ɣ*2#ү\u9g m ipLP1Vڣ1&QjܙpH"g}.\CAaD rT~>;qAaHwvv({#6/(E(* s&ކ=#nOn/L@\9 o'lOÞ\(d,<@(q_2o _:elF1g ;o J.֍GuI̧w|!d;ڀo 5WP^=F'q(Nho"jbo.ɑ@(.HR%cXs.T4YRDNMcY_r<cZms+ T1)u=3 )9_an|c!ۋQ e ̄Z_^l^lb\[т;B>8m%\J%:edK\%}%7j7n,n{p3%ʻQx/aLf{m̪B;`&06-(>i+RGjP_cc>q1>I&g̽Y 3)6G 7M,a}䳯ct1w+xN_ߖq42. (>5?4VVzBpus0E'o/g^mp-w-?ս sy s |,"9G^*Go=}1oؐˎaINQmLW{c86>%o1li.G+75ޭ};1/`+]'_(`_ h:+-Iw;_]Ses|;'hx%|u'Y7rbۃM< v%z (8jAna{w='[P/J BPJ N0q=y}!{Oi=F]%25/*<ÞZ8I~7Esu6!qob :E>Cy\:`]arr^8rTgpՓ1;G[0 OxpiusNTUi<=$M1_5(_&>ChU[Vb?:=֝zԺy[p5 sRVdUZB ,*3U͂eq3<դzхR柰0=ܳ o˄b if&J |[LD^K"$6}+pu:Ob,=l_9yj\yϒ^m3׍b]ьa` y\XDO)={*ig~ʠXgM[zlYAAS2%ӌլp^'L~Ąv^7? NkiTJoWa~ ?aPKU/~PK F/org/apache/maven/wrapper/MavenWrapperMain.classW XV, ql &:Q6 `\Z,XU{mһM[nJ:I+hhJHz}߷]! !QI;3o9o.TA\>^!T*Z^ V^W͵[U܆+x7z&fޢm*v5xwho ޥ g[E\l{>~PA/Ϊw.9||X>2^L{1#[*{psOq'|J*gxPSy9|Hn>,=%/ye_*zqU|T-/-NjJ#q{r~5/~${9T{_pHwC݃^O願nNdԜ-ࡁc=ݣuci܋ɻG\ʪ=Q3jhmtZc_5t֏ Š=E=M {DHOI#ק 3t2'F2'ߎ/}z$tO֣ s 2/-fԓK]]HZܴFJ(I˲KNF| G@d,+IOkxd>}*b$(] 6'SP}I+vX yVG,sg ,&euZnIv1!HΗ,ι60u;^.{R,\KX*D:2`Z ]4 ;txiOIoi ˒rv#'NɲGd90'y~d+SsuI#e#⮡sX.HuTWc&=)$l*{z@'é{nG%QU칫XDR6_dA TxlI t, 10G*͘BKD&< Enp(PSp ExvnࢯjMF&jRE,DX&EEN`U>ӦMF#L+$n8DX)S7MrGbz*`ǭ?ϫ?z; S;hCǯ7"&*)q&Hqe-:l/I}" +^h{VZ!緈,mQxCI-¯betdMF$:5Q<FĈ&l\I`%ED}iynL!mqtNYVghbA0).zWI2s4IlCmh6 CcB8U.y O&nRH$'3g° +ֶrAEc1vCE7*]X$_[/ +ぢڇIoI5y>ves\RA /_s%ywyyaj-5O1x2tRKJ`xKz3?]fO`U(3n3PwU6WfQ3: mW;X6,ohFc+X6Q& 8 `)XC~l6 au?k ⯦-}1hz17q:ƜS4&uͳh"h渪/%9`mCd \F3@.G#vbv9P.,T/Z`!Auh HCc ?:Jm4,r0hb`)oǥqyeoti60jF 5%S9,])k͠mbvWkʱgiPHG0Z= B=:ƶs .+2=1Zy. f4vud1.m$uqmh!5 -7 \A ੎vix:oC q W%X2F߷'@q ԕA }WeٷeKRlVw]96{8{W3u#ͥ;tArO9*n PPKdMTdj;iLLT;@ A*3x[\R(˚"y4)x#X ^t E>Ϸ|#JlIzf;S$'wq':rʀɧE 1Rb炬oq*NY[r#v'ճw)k||d0td0^K~PKo vPK F>org/apache/maven/wrapper/PathAssembler$LocalDistribution.classR]KA=wj\5~ĵv })Z-(> L1FA??QBf~sϽ?n|F\o|,X$uɏU0Y9"VYU%rSMY@(W2݈E[Ԛ2nsZR?EV5g|mhРAofuITw[U a%Hhe~5 6ǣhU*K 4z7ܚK 2 +nugsuuM9@a4Q˄O5YAHꙬB٬um8N,G=lFP*6ûߓhnDz(D=Ww0e9LM$N1JYd6bez92M%~Gk.{6ز]AI?v0gyV 8'PK<\tPK F,org/apache/maven/wrapper/PathAssembler.classV_=F`!ؕvd Pحkf`:4efMu}I״NDrCwҿy3B"Ao{ss]Foxp7C!)gĵ% 'MQV%!XGd<>|4w' >!>OnyqxA>#b/R__ BE|M}#o緂v/|Wм#i57ێ/4$(IЬjۚ-3uanl˓3SɉKꊚȩF61M}#{VBˈi؎j8sjIsej򉱑VK^]ьY[.y!YE=Bny s|#fb㺡M5.4^@S-]+>gI'iejAM/i a▥ :KY |f5g''7Uo٢ $@nKB!K.6 ͖i20;O5 a6֤>tuB.Z˪$!DnSSXwu[mYmTj#'dk颥;kה/9x%H cձմV]0)Ve`iysE4v3\$2%%gN<>{+JBzU S , ?8fVD8m&. ; mPh(ygqNƏ i xR1nYO 7$E1\sRS!3$"NC_ݯo3KW$zNeZ۶L..ki)-~ǩ=%c]?5$U]bX& G e!0%S%nm/{Fb.1L'ĢFD /lO M/֚٪ 24ټEn, ,[Qg",nGMüE,NW`ڜ&k+x_v=ZjB&\yPA1s3^Мdyp?l( bp7L(=u[-䑷|HJ_4:;Π>E(2Cs°+x DMG4Yldff2oy̿V'ou&9;~eQ)(홢km|mg+َHb̷ 9؈.Ԁ8g>;_u_r.鏕!ꊾkOи a#| ))dC@,:!,E:=%1ld>o%4KOe6 ϋW26/'.]>.%vƿ)wlxR l`|(}N7\Z1H0ǰnh=nX+xI梁Z+xFҝ&5#'~iA%7>>ň2:'p`1>=ԝb墊yUT\(ƤA|*~_ w#)3?P ;ʈEJ8@|stk0˦X;Y8m^z[$ Sf23Yq?n4UxE?}ҢkX^(xX ܁?o)!v#c.%tD<ݪv|&S=U -['T>GMa<OzA:_?{ؖNF f+dVb>@ڭ!m%4X a*p^Ahl5QIJ"YLeOAPK¾2LPK F6org/apache/maven/wrapper/SystemPropertiesHandler.classVkwU&!-P@ +*PHPt&LNh 7 '2]KcpIi& 69gsY? ` Cp@"A0NG  a)xQrB-'CR/``L%0Y ԒVTZ3S8LYX l!3N2j##|{qaYܴP>;&XƸ42#c9M5n;3igr\N:̤+)'xF:1 S]հ6?e5ofdwLt.hZ בFVC ;`nQEIsMۢQyڌa43U"k™wȔJ`8|VZnS2R_c>aEW:k+ۇr骨)(XCb R,f +!lezHIpyU-EULu&w$R&\#yW Ng {J`ZÒ 7%켓EZ[z=TzD 0&Ӽ9ryU)˫ [%YɛqՌvZj8u ]:XvxoMom;'i8hgt :$:>9ࢎT3+R+_㒎o-k2h_{maǔ[^]=iǞ*g=Z/d[)gνlrX &UêU@Q2cOG@h \cs~kEH%*ī/v6pNfBREy9O2xicrHN6? ӥ{]ϴ-Y77S*w IU!C\][6-[a_ Ț}@iў{mC<[19TFCe+9?6,ᝎہB6[] kE)?=y5<&h=^R}۾exJ r۰Q&?l#MIM 7zU۪Bc$tMhv7E\sFq\,ݡَaCC~Ʀ\bWZea Xm5\A~j!aN,b kge1!UG4T0:fꋪ3ݪm Nw\Tx}wN j/.g1RIPR |Ie.sebPhN'g$ >GDN-dzX!?EMbk~WuBHS9J%nZ4_dB$]?A|e~9w_. )koϢR`F;Q7xA An+A j r|F̄ 7<; d -8Ť L>OF uz @2H|#@W2.+AAe lɅ KJM+AWh2Ki A+A&d_  2ȯ?PK9R'$ PK F.org/apache/maven/wrapper/WrapperExecutor.classW~>YKƀ$#y IY)n6 1 г|dz:amh0BM:.`Ӹ M޻/i|;g!F~;Gu<1Tฎ1Td N:NG.I'j<tfd5)'e a!Hi9yFVF1?.'̟(i>Q|NtǐĪ/Kr_kBsNny_o.bTp ߌyG- u[R]mz:tmѹWC|̘dsz 36;ټgf]f`iX8E! uOuwtm-ֹ{[yXurV^<߾ggs8s~;C#gx1bY:Qr(J1f"J;{PCr&͜!+qMYQ\ӳ,YkfG4t6N7Զ.P$E6;trv;k,[HeC0I,lF3wj{5Sփ(\ï]4 ]o=rfofd7_,\/`ʜkLb癳}f7f-/&;7= 7&U4,EZfd3+n  jgYP9\D:Y :]芪%13X0x,NK.Ìˢ7QnR73BkCj[dݩzN|"}nVLb 3cu̾9拈'.&rsh8| üQWFQ7Xg-٭Y:?[-Ug΢~]DApA@PÊir)0zD0̸ٰOb F(ܝ"N"pэ"؅ 3 DM$c*JCū^{t<MC Hʇb]F˕/N%Ԍ"52sM+ci\r'6J~%o+XDwI_OK9oEG)2׍a9Z[+5~uWbCZ/@1qG/qsGS(wYena+X3QKZ:Z[a!+ tbgRlk9cPҠ aq1xI%{l&eKTM>"\Y<9*φP(hϟ +b,2;xef׾v]9r$1G,!H8UZSC) XOM ԅGB4Fz::_Cr-96K0WOG0O''„/pQPVoJR(si5*^,TXѹΠ֫~27)ʉ[!hxPKSZPK Forg/PKPK F org/apache/PKPK Forg/apache/maven/PKPK Forg/apache/maven/wrapper/PKPK Forg/apache/maven/wrapper/cli/PKPK F5META-INF/maven/io.takari/maven-wrapper/pom.properties+K-*ϳ533J//-L+IN,J,*LKL. &%qPKj4:9PK FMETA-INF/MANIFEST.MF} 0DC~ `7멂 XJHM6V[+*T̛vXB֥"VgykhFQjHE{pJ{/ӻ!RZζ$s lUЕ&,`mVlj) 8݆%{:/rg<<߹"sv88PK'b*PK Fn 3org/apache/maven/wrapper/BootstrapMainStarter.classPK Fy]7T?org/apache/maven/wrapper/cli/AbstractCommandLineConverter.classPK FQ+j I2 org/apache/maven/wrapper/cli/AbstractPropertiesCommandLineConverter.classPK F^F?Sg?org/apache/maven/wrapper/cli/CommandLineArgumentException.classPK F$5H7Morg/apache/maven/wrapper/cli/CommandLineConverter.classPK F0I* 4org/apache/maven/wrapper/cli/CommandLineOption.classPK FM/o6org/apache/maven/wrapper/cli/CommandLineParser$1.classPK F'P)\ Iorg/apache/maven/wrapper/cli/CommandLineParser$AfterFirstSubCommand.classPK Fv3Aorg/apache/maven/wrapper/cli/CommandLineParser$AfterOptions.classPK FqU^ Jorg/apache/maven/wrapper/cli/CommandLineParser$BeforeFirstSubCommand.classPK F`vltTB$org/apache/maven/wrapper/cli/CommandLineParser$CaseInsensitiveStringComparator.classPK FO`K0'org/apache/maven/wrapper/cli/CommandLineParser$KnownOptionParserState.classPK F樸Jx/org/apache/maven/wrapper/cli/CommandLineParser$MissingOptionArgState.classPK F5K2org/apache/maven/wrapper/cli/CommandLineParser$OptionAwareParserState.classPK FVE5org/apache/maven/wrapper/cli/CommandLineParser$OptionComparator.classPK Fe=$F)9org/apache/maven/wrapper/cli/CommandLineParser$OptionParserState.classPK F82dAS;org/apache/maven/wrapper/cli/CommandLineParser$OptionString.classPK F% K~>org/apache/maven/wrapper/cli/CommandLineParser$OptionStringComparator.classPK F+ 5@Aorg/apache/maven/wrapper/cli/CommandLineParser$ParserState.classPK FF{jM-Dorg/apache/maven/wrapper/cli/CommandLineParser$UnknownOptionParserState.classPK FB *4Gorg/apache/maven/wrapper/cli/CommandLineParser.classPK F:cH4Yorg/apache/maven/wrapper/cli/ParsedCommandLine.classPK F0a:^aorg/apache/maven/wrapper/cli/ParsedCommandLineOption.classPK FDo5Hdorg/apache/maven/wrapper/cli/ProjectPropertiesCommandLineConverter.classPK F,n&Gforg/apache/maven/wrapper/cli/SystemPropertiesCommandLineConverter.classPK F*82horg/apache/maven/wrapper/DefaultDownloader$1.classPK F:#"Siorg/apache/maven/wrapper/DefaultDownloader$SystemPropertiesProxyAuthenticator.classPK F$ 0Wlorg/apache/maven/wrapper/DefaultDownloader.classPK F ]St)torg/apache/maven/wrapper/Downloader.classPK FU/~(uorg/apache/maven/wrapper/Installer.classPK Fo v/org/apache/maven/wrapper/MavenWrapperMain.classPK F<\t>Ɛorg/apache/maven/wrapper/PathAssembler$LocalDistribution.classPK F¾2L,org/apache/maven/wrapper/PathAssembler.classPK F=N: 6org/apache/maven/wrapper/SystemPropertiesHandler.classPK F9R'$ 3.org/apache/maven/wrapper/WrapperConfiguration.classPK FSZ.org/apache/maven/wrapper/WrapperExecutor.classPK Frorg/PK F org/apache/PK Forg/apache/maven/PK F"org/apache/maven/wrapper/PK Fkorg/apache/maven/wrapper/cli/PK Fj4:95META-INF/maven/io.takari/maven-wrapper/pom.propertiesPK F'b*UMETA-INF/MANIFEST.MFPK++Ajruby-jar-dependencies-92427b1/.mvn/wrapper/maven-wrapper.properties000066400000000000000000000001561515606370500255710ustar00rootroot00000000000000distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip jruby-jar-dependencies-92427b1/.pre-commit-config.yaml000066400000000000000000000001421515606370500226050ustar00rootroot00000000000000repos: - repo: https://github.com/mattlqx/pre-commit-ruby rev: v1.3.5 hooks: - id: rubocop jruby-jar-dependencies-92427b1/.rubocop.yml000066400000000000000000000011441515606370500206010ustar00rootroot00000000000000require: - rubocop-rake - rubocop-performance AllCops: TargetRubyVersion: 2.6 NewCops: enable Metrics: Enabled: false Naming/FileName: Exclude: - lib/jar-dependencies.rb Performance/Casecmp: AutoCorrect: false Style/Alias: EnforcedStyle: prefer_alias_method Style/Documentation: Enabled: false Style/EnvHome: Enabled: false Style/FetchEnvVar: Enabled: false Style/NilComparison: Enabled: false Style/HashSyntax: EnforcedStyle: ruby19_no_mixed_keys Style/RescueStandardError: EnforcedStyle: implicit Style/TernaryParentheses: EnforcedStyle: require_parentheses_when_complex jruby-jar-dependencies-92427b1/Gemfile000066400000000000000000000004541515606370500176250ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' gemspec group :development do gem 'rake', require: false gem 'ruby-debug', '~> 0.11', require: false gem 'rubocop', '~> 1.50.0', require: false gem 'rubocop-performance', require: false gem 'rubocop-rake', require: false end jruby-jar-dependencies-92427b1/MIT-LICENSE000066400000000000000000000020431515606370500177620ustar00rootroot00000000000000Copyright (c) 2014 Christian Meier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jruby-jar-dependencies-92427b1/Mavenfile000066400000000000000000000037221515606370500201640ustar00rootroot00000000000000# frozen_string_literal: true gemfile plugin_repository id: :mavengems, url: 'mavengem:https://rubygems.org' jruby_plugin(:minitest, minispecDirectory: 'specs/*_spec.rb') do execute_goals(:spec) gem 'ruby-maven', '${ruby-maven.version}' end # retrieve the ruby-maven version gemfile_profile = @model.profiles.detect do |p| p.id.to_sym == :gemfile end || @model ruby_maven = gemfile_profile.dependencies.detect do |d| d.artifact_id == 'ruby-maven' end properties('jruby.versions' => ['${jruby.version}'].join(','), # just lock the version 'bundler.version' => '2.5.11', 'ruby-maven.version' => ruby_maven.version, 'jruby.version' => '9.4.8.0', 'jruby.plugins.version' => '3.0.2', 'push.skip' => true) plugin :invoker, '1.8' do execute_goals(:install, :run, id: 'integration-tests', projectsDirectory: 'integration', streamLogs: true, goals: ['install'], preBuildHookScript: 'setup.bsh', postBuildHookScript: 'verify.bsh', cloneProjectsTo: '${project.build.directory}', properties: { 'jar-dependencies.version' => '${project.version}', # use an old jruby with old ruby-maven here 'jruby.version' => '${jruby.version}', 'jruby.plugins.version' => '${jruby.plugins.version}', 'bundler.version' => '${bundler.version}', 'ruby-maven.version' => '${ruby-maven.version}' }) end distribution_management do repository id: :ossrh, url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' end profile id: :skip do properties 'maven.test.skip' => true, 'invoker.skip' => true end profile id: :release do properties 'maven.test.skip' => true, 'invoker.skip' => true, 'push.skip' => false build do default_goal :deploy end end jruby-jar-dependencies-92427b1/Rakefile000066400000000000000000000004341515606370500177750ustar00rootroot00000000000000# frozen_string_literal: true task default: [:specs] require 'bundler/gem_tasks' require 'rubocop/rake_task' RuboCop::RakeTask.new desc 'run specs' task :specs do $LOAD_PATH << 'specs' Dir['specs/*_spec.rb'].each do |f| require File.basename(f.sub(/.rb$/, '')) end end jruby-jar-dependencies-92427b1/Readme.md000066400000000000000000000220521515606370500200470ustar00rootroot00000000000000# jar-dependencies [![Gem Version](https://img.shields.io/gem/v/jar-dependencies)](https://rubygems.org/gems/jar-dependencies) [![Build Status](https://github.com/jruby/jar-dependencies/actions/workflows/main.yml/badge.svg)](https://github.com/jruby/jar-dependencies/actions/workflows/main.yml?query=branch%3Amaster) Add gem dependencies for jar files to ruby gems. ## Getting control back over your jar jar dependencies are declared in the gemspec of the gem using the same notation as [JBundler](https://github.com/jruby/jbundler). When using `require_jar` to load the jar into JRuby's classloader a version conflict will be detected and only **ONE** jar gets loaded. **jbundler** allows to select the version suitable for you application. Most maven-artifacts do **NOT** use versions ranges but depend on a concrete version. In such cases **jbundler** can always **overwrite** any such version. ## Vendoring your jars before packing the jar Add the following to your *Rakefile*: ```ruby require 'jars/installer' task :install_jars do Jars::Installer.vendor_jars! end ``` This will install (download) the dependent jars into **JARS_HOME** and create a file **lib/my_gem_jars.rb**, which will be an enumeration of `require_jars` statements to load all the jars. The **vendor_jars** task will copy them into the **lib** directory of the gem. The location where jars are cached is per default **$HOME/.m2/repository** the same default as Maven uses to cache downloaded jar-artifacts. It respects **$HOME/.m2/settings.xml** from Maven with mirror and other settings or the environment variable **JARS_HOME**. **IMPORTANT**: Make sure that jar-dependencies is only a **development dependency** of your gem. If it is a runtime dependency the require_jars file will be overwritten during installation. ## Reduce the download and reuse the jars from maven local repository If you do not want to vendor jars into a gem then **jar-dependency** gem can vendor them when you install the gem. In that case do not use `Jars::Installer.install_jars` from the above rake tasks. **NOTE**: Recent JRuby comes with **jar-dependencies** as default gem, for older versions for the feature to work you need to gem install **jar-dependencies** first and for bundler need to use the **bundle-with-jars** command instead. **IMPORTANT**: Make sure that jar-dependencies is a **runtime dependency** of your gem so the require_jars file will be overwritten during installation with the "correct" versions of the jars. ## For development you do not need to vendor the jars at all Set the environment variable ```shell export JARS_VENDOR=false ``` to tell the jar_installer not vendor any jars, but only create the file with the `require_jar` statements. This `require_jars` method will find the jar inside the maven local repository and load it from there. ## Some drawbacks * First you need to install the jar-dependency gem with its development dependencies installed (then ruby-maven gets installed as well) * Bundler does not install the jar-dependencies (unless JRuby adds the gem as default gem) * You need ruby-maven doing the job of dependency resolution and downloading them. gems not part of will not work currently ## JARs other than from maven-central By default all jars need to come from maven-central (), in order to use jars from any other repo you need to add it into your Maven *settings.xml* and configure it in a way that works without an interactive prompt (username + passwords needs to be part of the settings.xml file). **NOTE:** Gems depending on jars other then maven-central will **NOT** work when they get published on rubygems.org since the user of those gems will not have the right settings.xml to allow them to access the jar dependencies. ## Examples An [example with rspec and all](example/Readme.md) walks you through setup and shows how development works and shows what happens during installation. There are some more examples with the various [project setups for gems and application](examples/README.md). This includes using proper Maven for the project or ruby-maven with rake or the rake-compiler in conjunction with jar-dependencies. # Lock down versions Whenever there are version ranges for jar dependencies it is advisable to lock down the versions of dependencies. For the jar dependencies inside the gemspec declaration this can be done with: ```shell lock_jars ``` This is also working in **any** project which uses a gem with jar-dependencies. It also uses a Jarfile if present. See the [sinatra application from the examples](examples/sinatra-app/having-jarfile-and-gems-with-jar-dependencies/). This means for a project using bundler and jar-dependencies the setup is ```shell bundle install lock_jars ``` This will install both gems and jars for the project. Update a specific version is done with (use only the artifact_id) ```shell lock_jars --update slf4j-api ``` And look at the dependencies tree ```shell lock_jars --tree ``` As `lock_jars` uses ruby-maven to resolve the jar dependencies. Since jar-dependencies does not declare ruby-maven as runtime dependency (you just not need ruby-maven during runtime only when you want to setup the project it is needed) it is advicable to have it as development dependency in your Gemfile. # Proxy and mirror setup Proxies and mirrors can be set up by the usual configuration of maven itself: [settings.xml](https://maven.apache.org/settings.html) - see the mirrors and proxy sections. As jar-dependencies does only deal with jar and all jars need to come from maven central, it is only neccessary to mirror maven-central. An example of such a [settings-example.xml](setting.xml is here). You also can add such a settings.xml to your project which jar-dependencies will use instad of the default maven locations. This allows to have a per-project configuration and also removes the need to users of your Ruby project to dive into maven in case you have company policy to use a local mirror for gem and jar artifacts. jar-dependencies itself uses maven **only** for the jars and all gems are managed by RubyGems or Bundler or your favourite management tool. So any proxy/mirror settings which should affect gems need to be done in those tools. # Gradle, Maven, etc Dependency management frameworks like gradle (via jruby-gradle-plugin) or maven (via jruby-maven-plugins) can also use gem artifacts retrieved from rubygems.org. Each of these tools (including jar-dependencies) does the dependency resolution slightly different and in rare cases can produce different outcomes. But overall each tool can manage both jars and gems and their transitive dependencies. Popular gems like jrjackson or nokogiri do not declare their jars in the gemspec files and just load the bundle jars into jruby classloader, can easily create problems as the jackson and xalan/xerces libraries used by those gems are popular ones in the Java world. # Troubleshooting Since maven is used under the hood it is possible to get more insight what maven is doing. Show the regular maven output: ```shell JARS_VERBOSE=true bundle install JARS_VERBOSE=true gem install some_gem ``` Or, with maven debug enabled ```shell JARS_DEBUG=true bundle install JARS_DEBUG=true gem install some_gem ``` The maven command line which gets printed needs maven-3.9.x and the ruby DSL extension for maven: [polyglot-maven configuration](https://github.com/takari/polyglot-maven#configuration) where `${maven.multiModuleProjectDirectory}` is your current directory. # Configuration
ENVjava system propertydefaultdescription
JARS_DEBUGjars.debugfalseif set to true it will produce lots of debug out (maven -X switch)
JARS_VERBOSEjars.verbosefalseif set to true it will produce some extra output
JARS_HOMEjars.home$HOME/.m2/repositoryfilesystem location where to store the jar files and some metadata
JARS_MAVEN_SETTINGSjars.maven.settings$HOME/.m2/settings.xmlsetting.xml for maven to use
JARS_VENDORjars.vendortrueset to true means that the jars will be stored in JARS_HOME only
JARS_SKIPjars.skiptruedo **NOT** install jar dependencies at all
# Motivation In 2014, while tools such as [https://github.com/arrigonialberto86/ruby-band](https://github.com/arrigonialberto86/ruby-band) used [jbundler](https://github.com/jruby/jbundler) to manage their there was no easy or formal way to - find out which JARs were added to the JRuby classloader - to manage JRuby projects with Maven - to build Java/JRuby gem extensions with [rake-compiler](https://github.com/luislavena/rake-compiler/issues/87). With JRuby 9000 it was the right time to get jar dependencies "right". # Developing You must have the latest ruby-maven installed in your local JRuby. ./mvnw install will build the gem and run integration tests jruby-jar-dependencies-92427b1/bin/000077500000000000000000000000001515606370500170775ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/bin/rake000077500000000000000000000013461515606370500177530ustar00rootroot00000000000000#!/usr/bin/env ruby # frozen_string_literal: true # # This file was generated by Bundler. # # The application 'rake' is installed as part of a gem, and # this file is here to facilitate running it. # ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) bundle_binstub = File.expand_path('bundle', __dir__) if File.file?(bundle_binstub) if File.read(bundle_binstub, 300).include?('This file was generated by Bundler') load(bundle_binstub) else abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") end end require 'rubygems' require 'bundler/setup' load Gem.bin_path('rake', 'rake') jruby-jar-dependencies-92427b1/bin/rubocop000077500000000000000000000013571515606370500205040ustar00rootroot00000000000000#!/usr/bin/env ruby # frozen_string_literal: true # # This file was generated by Bundler. # # The application 'rubocop' is installed as part of a gem, and # this file is here to facilitate running it. # ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) bundle_binstub = File.expand_path('bundle', __dir__) if File.file?(bundle_binstub) if File.read(bundle_binstub, 300).include?('This file was generated by Bundler') load(bundle_binstub) else abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") end end require 'rubygems' require 'bundler/setup' load Gem.bin_path('rubocop', 'rubocop') jruby-jar-dependencies-92427b1/example/000077500000000000000000000000001515606370500177625ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/example/.gitignore000066400000000000000000000000371515606370500217520ustar00rootroot00000000000000*.jar *_jars.rb *.lock pkg tmp jruby-jar-dependencies-92427b1/example/Gemfile000066400000000000000000000003221515606370500212520ustar00rootroot00000000000000# frozen_string_literal: true # bundle install will download and install the jar dependencies # as well create the lib/example_jars.rb which loads the jars at # runtime source 'https://rubygems.org' gemspec jruby-jar-dependencies-92427b1/example/Rakefile000066400000000000000000000014131515606370500214260ustar00rootroot00000000000000# frozen_string_literal: true require 'rspec/core/rake_task' require 'jars/classpath' require 'rake/javaextensiontask' require 'jars/installer' task :install_jars do Jars::Installer.new.vendor_jars end desc 'Compiles extension and run specs' task default: %i[compile spec] spec = eval File.read('example.gemspec') # rubocop:disable Security/Eval desc 'compile src/main/java/** into lib/example.jar' Rake::JavaExtensionTask.new('example', spec) do |ext| ext.classpath = Jars::Classpath.new.classpath_string ext.source_version = '1.7' ext.target_version = '1.7' ext.ext_dir = 'src/main/java' end require 'rubygems/package_task' Gem::PackageTask.new(spec) do desc 'Pack gem' task package: %i[install_jars compile] end desc 'Run specs' RSpec::Core::RakeTask.new jruby-jar-dependencies-92427b1/example/Readme.md000066400000000000000000000061201515606370500215000ustar00rootroot00000000000000# walkthrough # (assume all commands will be executed via jruby !) bundle install lock_jars rake rake package * bundler will lock down the gem dependencies and generates the *_jars.rb file * lock\_jars does create JArs.lock file the version lock down of the jar dependencies. see ```lock_jars --help``` for more options. * the default rake task compile the java files and runs the specs after it * the rake task compiles the java files and builds the jar of the gem and packs everything into a gem now install the gem and look at the installed content gem install -l pkg/example-2-java.gem gem content example during installation the dependent jars get vendored (not the jar extension which is already part of the packed gem itself). to run the spec do (after ```bundle install```) bundle exec rake or bundle exec rake compile bundle exec rspec spec/*spec.rb if you look into the gem itself it just contains the following files: . ├── example.gemspec ├── lib│ | ├── example │ │ └── bc_info.rb │ ├── example.jar │ ├── example_jars.rb │ └── example.rb └── Rakefile and the installed gem looks like this . ├── Gemfile ├── Rakefile ├── example.gemspec └── lib ├── example │ └── bc_info.rb ├── example.jar ├── example.rb ├── example_jars.rb └── org ├── bouncycastle | ├── bcpkix-jdk15on │ │ └── 1.49 │ │ └── bcpkix-jdk15on-1.49.jar │ └── bcprov-jdk15on │ └── 1.49 │ └── bcprov-jdk15on-1.49.jar └── slf4j └── slf4j-api └── 1.7.7 └── slf4j-api-1.7.7.jar in order to use the jar dependencies for development you need to run rake compile which builds the **lib/example.jar** and bundle install generates the **lib/example_jars.rb**. this file adds the jar dependencies to jruby's runtime when required. during development the jars will be stored in **$HOME/.m2/repository** (the maven default location). this local-maven-repository can be configured with the settings.xml from the project or at **$HOME/.m2/settings.xml**. from the local-maven-repository the jars get loaded. whenever you install the gem via bundler or rubygems then the jars will vendored inside the gem. in case you do not want to vendor your jars during installation, then you can set the environment **export JRUBY\_JARS\_VENDOR=false**. then the installed gem looks exactly like during development. in any case the execution of the example.rb file produces the same output. the local development $ jruby -Ilib -r example/bc_info -e 'puts Example.bc_info' or via the installed gem $ jruby -r example/bc_info -e 'puts Example.bc_info' gives: BouncyCastle Security Provider v1.49 for mirror or proxy settings either use the settings.xml from the project or from $HOME/.m2/settings.xml and see maven documentions on more details on this and the settings.xml.example of here. jruby-jar-dependencies-92427b1/example/example.gemspec000066400000000000000000000041561515606370500227700ustar00rootroot00000000000000# frozen_string_literal: true Gem::Specification.new do |s| # this is only needed to retrieve the latest version of jar-dependencies # so this can run as integration-test version = ENV_JAVA['jar-dependencies.version'] || '0.3.0' s.name = 'example' s.version = '2' s.author = 'example person' s.email = ['mail@example.com'] s.summary = 'gem with jar' s.description = 'gem with empty jar and jar dependencies' # important so jar-dependencies knows it should look for # jar declarations in the requirements section ! s.platform = 'java' s.files << Dir['lib/**/*.rb'] s.files << 'lib/example.jar' s.files << Dir['*file'] s.files << 'example.gemspec' s.required_ruby_version = '>= 2.6' # constrain the version of jar-dependencies itself s.add_runtime_dependency 'jar-dependencies', "~> #{version}" # the jar declarations s.requirements << 'jar org.bouncycastle:bcpkix-jdk15on, 1.49' s.requirements << 'jar org.bouncycastle:bcprov-jdk15on, 1.49' s.requirements << 'jar org.slf4j:slf4j-api, 1.7.7' # dependency where some transitive dependency gets excluded (jruby comes # with joda-time already bundled and this can cause classloader conflicts. # better just use the version of joda-time from jruby and hope it is # compatible) s.requirements << 'jar io.dropwizard:dropwizard-logging, 0.8.0-rc5, :exclusions=> [ joda-time:joda-time ]' # a jar dependency with a classifier s.requirements << 'jar com.google.protobuf:protobuf-java, 2.2.0, :classifier => lite' # needed for the tests s.requirements << 'jar junit:junit:4.12, :scope => :test' # this is part of the test and assumed to be provided during runtime s.requirements << 'jar org.slf4j:slf4j-simple, 1.7.7, :scope => :provided' s.add_development_dependency 'rake', '~> 10.3' s.add_development_dependency 'rspec', '~> 2.14' # needed to compile src/main/java/** into lib/example.jar s.add_development_dependency 'rake-compiler', '~> 0.9' # avoids to install it on the fly when jar-dependencies needs it s.add_development_dependency 'ruby-maven', '~> 3.9', '>= 3.9.3' s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/example/lib/000077500000000000000000000000001515606370500205305ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/example/lib/example.rb000066400000000000000000000003401515606370500225050ustar00rootroot00000000000000# frozen_string_literal: true # this require will load ALL dependent jars or the jars from Jars.lock if # the lock file exeists require 'example_jars' # this is the jar compiled from src/main/java/** require 'example.jar' jruby-jar-dependencies-92427b1/example/lib/example/000077500000000000000000000000001515606370500221635ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/example/lib/example/bc_info.rb000066400000000000000000000003531515606370500241100ustar00rootroot00000000000000# frozen_string_literal: true # loads all dependent jars and exmaple.jar require 'example' java_import org.bouncycastle.jce.provider.BouncyCastleProvider module Example def self.bc_info BouncyCastleProvider.new.info end end jruby-jar-dependencies-92427b1/example/settings.xml.example000066400000000000000000000030501515606370500237740ustar00rootroot00000000000000 local-mirror external:*,!mavengems http://localhost:8081/nexus/content/groups/public local central http://central true true central http://central true true local jruby-jar-dependencies-92427b1/example/spec/000077500000000000000000000000001515606370500207145ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/example/spec/first_spec.rb000066400000000000000000000004151515606370500234020ustar00rootroot00000000000000# frozen_string_literal: true require_relative 'spec_helper' require 'example/bc_info' describe 'example using a class from the dependent jars' do it 'should load bouncy castle' do expect(Example.bc_info).to eq 'BouncyCastle Security Provider v1.49' end end jruby-jar-dependencies-92427b1/example/spec/second_spec.rb000066400000000000000000000006051515606370500235270ustar00rootroot00000000000000# frozen_string_literal: true require_relative 'spec_helper' describe 'java class App from src/main/java/**' do it 'should load bouncy castle' do expect(Java::App.bc_info).to eq 'BouncyCastle Security Provider v1.49' expect(Java::App.jruby_version).to eq JRUBY_VERSION logger = org.slf4j.LoggerFactory.get_logger('root') logger.info(Java::App.hello('world')) end end jruby-jar-dependencies-92427b1/example/spec/spec_helper.rb000066400000000000000000000003331515606370500235310ustar00rootroot00000000000000# frozen_string_literal: true # load all jars including with scope test require 'jars/classpath' Jars::Classpath.require(:test) p $CLASSPATH require 'rspec' RSpec.configure do |config| config.order = 'random' end jruby-jar-dependencies-92427b1/example/src/000077500000000000000000000000001515606370500205515ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/example/src/main/000077500000000000000000000000001515606370500214755ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/example/src/main/java/000077500000000000000000000000001515606370500224165ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/example/src/main/java/App.java000066400000000000000000000005141515606370500240010ustar00rootroot00000000000000import org.bouncycastle.jce.provider.BouncyCastleProvider; class App { public static String bcInfo() { return new BouncyCastleProvider().getInfo(); } public static String jrubyVersion() { return org.jruby.runtime.Constants.VERSION; } public static String hello(String name) { return "hello " + name; } } jruby-jar-dependencies-92427b1/examples/000077500000000000000000000000001515606370500201455ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/README.md000066400000000000000000000111041515606370500214210ustar00rootroot00000000000000# JRuby projects with jar dependencies ``` examples ├── gem-with-jar-dependencies ├── gem-with-java-extension │   ├── using-maven │   ├── using-rake-compiler │   └── using-ruby-maven ├── gem-with-java-extension-and-dependencies │   ├── using-maven │   ├── using-rake-compiler │   └── using-ruby-maven └── sinatra-app ├── having-gems-with-jar-dependencies └── having-jarfile-and-gems-with-jar-dependencies ``` to build the java extension you can do it with either proper maven, or with help of the ruby-maven gem or the rake-compiler gem. ## version ranges against a picked version jar-dependencies uses maven under the hood to resolve and install jar dependencies. maven discourages the use of version ranges and without version ranges there a deterministic version resolution, i.e. there is way to [resolve conflicts in maven](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Transitive_Dependencies) (see section 'Dependency mediation'). so if you use version ranges like rubygems does it, then lock down the versions of jar dependencies is needed. for this use the command ``` lock_jars ``` from the jar-dependencies plugin. ## gem with jar dependencies see the project here: [gem with jar dependencies](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-jar-dependencies) you need to use bundler in this example. just declare the jar dependencies inside the gemspec, run ``` bundle install ``` and then you can use them with your ruby code. with lock down of the jar versions the setup is ``` bundle install lock_jars ``` ## gem with java extension use can use maven, ruby-maven or rake-compiler to build the extension. note that there is no jar-dependencies gem involved here. ### using maven see project here: [gem with java extension using maven](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-java-extension/using-maven) you need maven 3.9.x installed to get it working and the project needs to prepare maven to use the ruby DSL for maven. this is done by adding [](.mvn/extensions.xml) to your project. or use maven wrapper []() ``` bundle install mvn prepare-package ``` to setup your project. ### using ruby-maven see project here: [gem with java extension using ruby-maven](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-java-extension/using-ruby-maven) use the ruby-maven gem instead of system installed maven. much more ruby like, no need to have anything installed on the system beside jruby, i.e. ``` bundle install rake compile ``` to setup your project. ### using rake-compiler see project here: [gem with java extension using rake-compiler](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-java-extension/using-rake-compiler) just use the rake compiler inside the Rakefile, i.e. ``` bundle install rake compile ``` to setup your project. ## gem with java extension and jar dependencies this is more since you might need the jar dependencies and its transitive dependencies for compiling the gem extension. all these examples uses the jar dependencies declaration from the gemspec file. ### using maven see project here: [gem with java extension and jar dependencies using maven](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-java-extension-and-jar-dependencies/using-maven) maven just sets up the compile classpath for building the extension jar setup with locked jars ``` bundle install lock_jars mvn prepare-package ``` ### using ruby-maven see project here: [gem with java extension and jar dependencies using ruby-maven](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-maven) like maven but using ruby-maven instrad. setup with locked jars ``` bundle install lock_jars rake compile ``` ### using rake-compiler see project here: [gem with java extension and jar dependencies using rake-compiler](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-java-extension-and-jar-dependencies/using-rake-compiler) jar-dependencies gems offers a simple way to pass on the classpath to rake-compiler. setup with locked jars ``` bundle install lock_jars rake compile ``` # summary using rake-compiler or ruby-maven is no difference for the user setting up the gem. maven is more to demostrate what is there and it allows to use a gem project as part of mutli-module maven build keeping the ruby project as ruby project but still integrate it nicely with maven. jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies-and-bundler/000077500000000000000000000000001515606370500272555ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies-and-bundler/Gemfile000066400000000000000000000001061515606370500305450ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' gemspec jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies-and-bundler/README.md000066400000000000000000000030441515606370500305350ustar00rootroot00000000000000## setup ``` bundle ``` which is important since it will create a file lib/gem-name_jars.rb and installs the jar dependencies into a local cache (local maven repository) ## lock down version of jar dependencies lock down is optional only needed when there is a version conflict actually happening. (see [gem with jar dependency]((gem-with-jar-dependencies-and-bundler/README.md#lock down version of jar dependencies)) in case you want or need to lock down your versions for the jars then execute: ``` lock_jars ``` ## pack gem ``` gem build mygem.gemspec ``` ## just run the code make sure you use jruby (via rbenv, rvm, etc) ``` ruby test.rb ``` ## pros and cons in the past there was problems with debian openjdk8 package which did not install the ca-certs in the java keystore and could not talk to maven central. the blame went naturally to the jar-dependencies project. all in all vendoring jars within the gem is the recommended way of doing things, as the eco-system of gems with such jars using jar-dependencies is not so huge to playout the pros and it is unlikely to run into extra trouble while installing the gem. ### pros - no jars get vendored inside the gem - gems and jars are more or less treated a like - you share the jars via the local maven repo between projects and/or gems ### cons - any problem with installing the jars during gem install is very hard to debug - any restricted access to the rubygems respository server needs to acompanied by the access rights for maven-central - proxy support for downloading jar might be buggy jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies-and-bundler/lib/000077500000000000000000000000001515606370500300235ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies-and-bundler/lib/mygem.rb000066400000000000000000000002371515606370500314700ustar00rootroot00000000000000# frozen_string_literal: true # can be hardcoded here but for copy the example around that is easier require Dir["#{File.dirname(__FILE__)}/*_jars.rb"].first jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies-and-bundler/mygem.gemspec000066400000000000000000000015251515606370500317430ustar00rootroot00000000000000# frozen_string_literal: true # use the version from the main project require "#{File.dirname File.expand_path(__FILE__)}/../../lib/jars/version" Gem::Specification.new do |s| s.name = File.basename(File.dirname(File.expand_path(__FILE__))) s.version = '1.0.0' s.author = ['example person'] s.email = ['mail@example.com'] s.summary = "summary of #{s.name}" s.description = "description of #{s.name}" # important to get the jars installed s.platform = 'java' s.files = Dir['lib/**/*.rb'] s.files += Dir['*file'] s.files += Dir['*.gemspec'] s.required_ruby_version = '>= 2.6' s.requirements << 'jar org.slf4j, slf4j-api, 1.7.7' s.requirements << 'jar org.slf4j, slf4j-simple, 1.7.7, :scope => :test' s.add_runtime_dependency 'jar-dependencies', "~> #{Jars::VERSION}" s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies-and-bundler/test.rb000066400000000000000000000005171515606370500305640ustar00rootroot00000000000000# frozen_string_literal: true # setup env $LOAD_PATH << 'lib' # load our gem and its jars require 'mygem' # load test jar require_jar 'org.slf4j', 'slf4j-simple', '1.7.7' # use it logger = org.slf4j.LoggerFactory.get_logger('root') logger.info('hello') logger.info("used classpath:\n\t#{$CLASSPATH.collect(&:to_s).join("\n\t")}") jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies/000077500000000000000000000000001515606370500250645ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies/Gemfile000066400000000000000000000001061515606370500263540ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' gemspec jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies/README.md000066400000000000000000000017661515606370500263550ustar00rootroot00000000000000## setup ``` vendor_jars ``` which is important since it will create a file lib/gem-name_jars.rb and installs the jar dependencies into a local cache (local maven repository) ## lock down version of jar dependencies lock down is optional and only needed once you see a warning about a version conflict. if you use maven recommended way of picking a concrete version for a jar then the need for lock_down is almost vanishing as the likelyhood of gems using the jar with different version is very small. in case you want or need to lock down your versions for the jars then execute: ``` lock_jars ``` ## pack gem ``` gem build mygem.gemspec ``` ## just run the code make sure you use jruby (via rbenv, rvm, etc) ``` ruby test.rb ``` ## alternative uses jar-dependency gem as runtime dependency in your gemspec and bundler can be an alternative way of setting up such gem: [with bundler](gem-with-jar-dependencies-and-bundler/README.md). also see the discussion on pros and cons and the end of that page. jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies/lib/000077500000000000000000000000001515606370500256325ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies/lib/mygem.rb000066400000000000000000000002371515606370500272770ustar00rootroot00000000000000# frozen_string_literal: true # can be hardcoded here but for copy the example around that is easier require Dir["#{File.dirname(__FILE__)}/*_jars.rb"].first jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies/mygem.gemspec000066400000000000000000000012731515606370500275520ustar00rootroot00000000000000# frozen_string_literal: true Gem::Specification.new do |s| s.name = File.basename(File.dirname(File.expand_path(__FILE__))) s.version = '1.0.0' s.author = ['example person'] s.email = ['mail@example.com'] s.summary = "summary of #{s.name}" s.description = "description of #{s.name}" # important to get the jars installed s.platform = 'java' s.files = Dir['lib/**/*.rb'] s.files += Dir['lib/**/*.jar'] s.files += Dir['*file'] s.files += Dir['*.gemspec'] s.required_ruby_version = '>= 2.6' s.requirements << 'jar org.slf4j, slf4j-api, 1.7.7' s.requirements << 'jar org.slf4j, slf4j-simple, 1.7.7, :scope => :test' s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/examples/gem-with-jar-dependencies/test.rb000066400000000000000000000005171515606370500263730ustar00rootroot00000000000000# frozen_string_literal: true # setup env $LOAD_PATH << 'lib' # load our gem and its jars require 'mygem' # load test jar require_jar 'org.slf4j', 'slf4j-simple', '1.7.7' # use it logger = org.slf4j.LoggerFactory.get_logger('root') logger.info('hello') logger.info("used classpath:\n\t#{$CLASSPATH.collect(&:to_s).join("\n\t")}") jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/000077500000000000000000000000001515606370500305555ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-maven/000077500000000000000000000000001515606370500330065ustar00rootroot00000000000000.mvn/000077500000000000000000000000001515606370500336055ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-mavenextensions.xml000066400000000000000000000003221515606370500365230ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-maven/.mvn io.takari.polyglot polyglot-ruby 0.1.13 Gemfile000066400000000000000000000001061515606370500342170ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-maven# frozen_string_literal: true source 'https://rubygems.org' gemspec README.md000066400000000000000000000011741515606370500342110ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-maven# using maven-3.9.x to build jar and pack gem the ruby DSL for maven is configured by .mvn/extensions.xml ## setup ``` bundle install ``` which is important since it will create a file **lib/_jars.rb** and installs the jar dependencies into a local cache (local maven-repository) ## build compile and create jar ``` mvn prepare-package ``` ## use it ``` jruby test.rb ``` ## lock down version of jar dependencies lock down may or may not be needed. in case you want to lock down your versions for the jars execute: ``` lock_jars ``` ## pack gem ``` mvn package ``` ## deploy gem to rubygems.prg ``` mvn push ```lib/000077500000000000000000000000001515606370500334755ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-mavenmygem.rb000066400000000000000000000003231515606370500351360ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-maven/lib# frozen_string_literal: true # can be hardcoded here but for copy the example around that is easier require Dir["#{File.dirname(__FILE__)}/*_jars.rb"].first require Dir["#{File.dirname(__FILE__)}/*jar"].first mygem.gemspec000066400000000000000000000015401515606370500354120ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-maven# frozen_string_literal: true # use the version from the main project require "#{File.dirname File.expand_path(__FILE__)}/../../../lib/jars/version" Gem::Specification.new do |s| s.name = File.basename(File.dirname(File.expand_path(__FILE__))) s.version = '1.0.0' s.author = ['example person'] s.email = ['mail@example.com'] s.summary = "summary of #{s.name}" s.description = "description of #{s.name}" # nice to have s.platform = 'java' s.files = Dir['lib/**/*.rb'] s.files += Dir['lib/*.jar'] s.files += Dir['*.file'] s.files += Dir['*.gemspec'] s.required_ruby_version = '>= 2.6' s.requirements << 'jar org.slf4j, slf4j-api, 1.7.7' s.requirements << 'jar org.slf4j, slf4j-simple, 1.7.7, :scope => :test' s.add_runtime_dependency 'jar-dependencies', "~> #{Jars::VERSION}" s.metadata['rubygems_mfa_required'] = 'true' end src/000077500000000000000000000000001515606370500335165ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-mavenmain/000077500000000000000000000000001515606370500344425ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-maven/srcjava/000077500000000000000000000000001515606370500353635ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-maven/src/mainApp.java000066400000000000000000000001371515606370500367470ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-maven/src/main/javaclass App { public static String hello(String name) { return "hello " + name; } } test.rb000066400000000000000000000004221515606370500342310ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-maven# frozen_string_literal: true # setup env $LOAD_PATH << 'lib' # load our gem and its jars require 'mygem' # load test jar require_jar 'org.slf4j', 'slf4j-simple', '1.7.7' # use it logger = org.slf4j.LoggerFactory.get_logger('root') logger.info(Java::App.hello('world')) using-rake-compiler/000077500000000000000000000000001515606370500343535ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies.gitignore000066400000000000000000000000311515606370500363350ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-rake-compilertmp *jar *_jars.rb *lock Gemfile000066400000000000000000000001061515606370500356430ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-rake-compiler# frozen_string_literal: true source 'https://rubygems.org' gemspec README.md000066400000000000000000000010211515606370500356240ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-rake-compiler# using ruby-maven gem build jar ## setup ``` bundle install ``` which is important since it will create a file lib/gem-name_jars.rb and installs the jar dependencies into a local cache (local maven repository) ## lock down version of jar dependencies lock down may or may not be needed (best just lock them down). in case you want to lock down your versions for the jars execute: ``` lock_jars ``` ## build compile and create jar ``` rake compile ``` ## use it ``` jruby test.rb ``` ## pack gem ``` rake package ``` Rakefile000066400000000000000000000006601515606370500360220ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-rake-compiler# frozen_string_literal: true require 'jars/classpath' require 'rake/javaextensiontask' spec = eval File.read('mygem.gemspec') # rubocop:disable Security/Eval Rake::JavaExtensionTask.new('mygem', spec) do |ext| ext.classpath = Jars::Classpath.new.classpath_string ext.ext_dir = 'ext' end task default: [:compile] require 'rubygems/package_task' Gem::PackageTask.new(spec) do desc 'Pack gem' task package: [:compile] end ext/000077500000000000000000000000001515606370500351535ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-rake-compilerApp.java000066400000000000000000000001371515606370500365370ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-rake-compiler/extclass App { public static String hello(String name) { return "hello " + name; } } lib/000077500000000000000000000000001515606370500351215ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-rake-compilermygem.rb000066400000000000000000000003231515606370500365620ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-rake-compiler/lib# frozen_string_literal: true # can be hardcoded here but for copy the example around that is easier require Dir["#{File.dirname(__FILE__)}/*_jars.rb"].first require Dir["#{File.dirname(__FILE__)}/*jar"].first mygem.gemspec000066400000000000000000000020231515606370500370330ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-rake-compiler# frozen_string_literal: true # use the version from the main project require "#{File.dirname File.expand_path(__FILE__)}/../../../lib/jars/version" Gem::Specification.new do |s| s.name = File.basename(File.dirname(File.expand_path(__FILE__))) s.version = '1.0.0' s.author = ['example person'] s.email = ['mail@example.com'] s.summary = "summary of #{s.name}" s.description = "description of #{s.name}" # important to get the jars installed s.platform = 'java' s.files = Dir['lib/**/*.rb'] s.files += Dir['lib/*.jar'] s.files += Dir['*.file'] s.files += Dir['*.gemspec'] s.required_ruby_version = '>= 2.6' s.requirements << 'jar org.slf4j, slf4j-api, 1.7.7' s.requirements << 'jar org.slf4j, slf4j-simple, 1.7.7, :scope => :test' s.add_runtime_dependency 'jar-dependencies', "~> #{Jars::VERSION}" s.add_development_dependency 'rake', '~> 10.3' # needed to compile ext/** and create jar file s.add_development_dependency 'rake-compiler', '~> 0.9' s.metadata['rubygems_mfa_required'] = 'true' end test.rb000066400000000000000000000004221515606370500356550ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-rake-compiler# frozen_string_literal: true # setup env $LOAD_PATH << 'lib' # load our gem and its jars require 'mygem' # load test jar require_jar 'org.slf4j', 'slf4j-simple', '1.7.7' # use it logger = org.slf4j.LoggerFactory.get_logger('root') logger.info(Java::App.hello('world')) using-ruby-maven/000077500000000000000000000000001515606370500337065ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependenciesGemfile000066400000000000000000000001061515606370500351760ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-maven# frozen_string_literal: true source 'https://rubygems.org' gemspec README.md000066400000000000000000000010211515606370500351570ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-maven# using ruby-maven gem build jar ## setup ``` bundle install ``` which is important since it will create a file lib/gem-name_jars.rb and installs the jar dependencies into a local cache (local maven repository) ## lock down version of jar dependencies lock down may or may not be needed (best just lock them down). in case you want to lock down your versions for the jars execute: ``` lock_jars ``` ## build compile and create jar ``` rake compile ``` ## use it ``` jruby test.rb ``` ## pack gem ``` rake package ``` Rakefile000066400000000000000000000006341515606370500353560ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-maven# frozen_string_literal: true require 'ruby-maven' desc 'Pack jar after compiling classes' task :compile do RubyMaven.exec('prepare-package') end desc 'Clean build' task :clean do RubyMaven.exec('clean') end task default: [:compile] require 'rubygems/package_task' Gem::PackageTask.new(eval(File.read('mygem.gemspec'))) do # rubocop:disable Security/Eval desc 'Pack gem' task package: [:compile] end lib/000077500000000000000000000000001515606370500344545ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-mavenmygem.rb000066400000000000000000000003231515606370500361150ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-maven/lib# frozen_string_literal: true # can be hardcoded here but for copy the example around that is easier require Dir["#{File.dirname(__FILE__)}/*_jars.rb"].first require Dir["#{File.dirname(__FILE__)}/*jar"].first mygem.gemspec000066400000000000000000000015641515606370500363770ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-maven# frozen_string_literal: true # use the version from the main project require "#{File.dirname File.expand_path(__FILE__)}/../../lib/jars/version" Gem::Specification.new do |s| s.name = File.basename(File.dirname(File.expand_path(__FILE__))) s.version = '1.0.0' s.author = ['example person'] s.email = ['mail@example.com'] s.summary = "summary of #{s.name}" s.description = "description of #{s.name}" # important to get the jars installed s.platform = 'java' s.files = Dir['lib/**/*.rb'] s.files += Dir['lib/*.jar'] s.files += Dir['*.file'] s.files += Dir['*.gemspec'] s.required_ruby_version = '>= 2.6' s.requirements << 'jar org.slf4j, slf4j-api, 1.7.7' s.requirements << 'jar org.slf4j, slf4j-simple, 1.7.7, :scope => :test' s.add_runtime_dependency 'jar-dependencies', "~> #{Jars::VERSION}" s.metadata['rubygems_mfa_required'] = 'true' end src/000077500000000000000000000000001515606370500344755ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-mavenmain/000077500000000000000000000000001515606370500354215ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-maven/srcjava/000077500000000000000000000000001515606370500363425ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-maven/src/mainApp.java000066400000000000000000000001371515606370500377260ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-maven/src/main/javaclass App { public static String hello(String name) { return "hello " + name; } } test.rb000066400000000000000000000004221515606370500352100ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-maven# frozen_string_literal: true # setup env $LOAD_PATH << 'lib' # load our gem and its jars require 'mygem' # load test jar require_jar 'org.slf4j', 'slf4j-simple', '1.7.7' # use it logger = org.slf4j.LoggerFactory.get_logger('root') logger.info(Java::App.hello('world')) jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/000077500000000000000000000000001515606370500246175ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-maven/000077500000000000000000000000001515606370500270505ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-maven/.mvn/000077500000000000000000000000001515606370500277265ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-maven/.mvn/extensions.xml000066400000000000000000000003221515606370500326440ustar00rootroot00000000000000 io.takari.polyglot polyglot-ruby 0.1.13 jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-maven/README.md000066400000000000000000000005271515606370500303330ustar00rootroot00000000000000# using maven-3.9.x to build jar and pack gem the ruby DSL for maven is configured by .mvn/extensions.xml ## build compile and create jar ``` mvn prepare-package ``` ## pack gem ``` mvn package ``` ## deploy gem tio rubygems.prg ``` mvn push ``` ## just run the code make sure you use jruby (via rbenv, rvm, etc) ``` jruby test.rb ```jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-maven/lib/000077500000000000000000000000001515606370500276165ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-maven/lib/mygem.rb000066400000000000000000000002321515606370500312560ustar00rootroot00000000000000# frozen_string_literal: true # can be hardcoded here but for copy the example around that is easier require Dir["#{File.dirname(__FILE__)}/*jar"].first jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-maven/mygem.gemspec000066400000000000000000000012261515606370500315340ustar00rootroot00000000000000# frozen_string_literal: true # use the version from the main project require "#{File.dirname File.expand_path(__FILE__)}/../../lib/jars/version" Gem::Specification.new do |s| s.name = File.basename(File.dirname(File.expand_path(__FILE__))) s.version = '1.0.0' s.author = ['example person'] s.email = ['mail@example.com'] s.summary = "summary of #{s.name}" s.description = "description of #{s.name}" # nice to have s.platform = 'java' s.required_ruby_version = '>= 2.6' s.files = Dir['lib/**/*.rb'] s.files += Dir['lib/*.jar'] s.files += Dir['*.file'] s.files += Dir['*.gemspec'] s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-maven/src/000077500000000000000000000000001515606370500276375ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-maven/src/main/000077500000000000000000000000001515606370500305635ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-maven/src/main/java/000077500000000000000000000000001515606370500315045ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-maven/src/main/java/App.java000066400000000000000000000001371515606370500330700ustar00rootroot00000000000000class App { public static String hello(String name) { return "hello " + name; } } jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-maven/test.rb000066400000000000000000000002071515606370500303530ustar00rootroot00000000000000# frozen_string_literal: true # setup env $LOAD_PATH << 'lib' # load our gem require 'mygem' # use it puts Java::App.hello('world') jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-rake-compiler/000077500000000000000000000000001515606370500304745ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-rake-compiler/.gitignore000066400000000000000000000000111515606370500324540ustar00rootroot00000000000000tmp *jar jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-rake-compiler/README.md000066400000000000000000000003241515606370500317520ustar00rootroot00000000000000# using rake and ruby-maven gem ## build compile and create jar ``` rake compile ``` ## pack gem ``` rake package ``` ## just run the code make sure you use jruby (via rbenv, rvm, etc) ``` jruby test.rb ```jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-rake-compiler/Rakefile000066400000000000000000000005711515606370500321440ustar00rootroot00000000000000# frozen_string_literal: true require 'jars/classpath' require 'rake/javaextensiontask' spec = eval File.read('mygem.gemspec') # rubocop:disable Security/Eval Rake::JavaExtensionTask.new('mygem', spec) do |ext| ext.ext_dir = 'ext' end task default: [:compile] require 'rubygems/package_task' Gem::PackageTask.new(spec) do desc 'Pack gem' task package: [:compile] end jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-rake-compiler/ext/000077500000000000000000000000001515606370500312745ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-rake-compiler/ext/App.java000066400000000000000000000001371515606370500326600ustar00rootroot00000000000000class App { public static String hello(String name) { return "hello " + name; } } jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-rake-compiler/lib/000077500000000000000000000000001515606370500312425ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-rake-compiler/lib/mygem.rb000066400000000000000000000002321515606370500327020ustar00rootroot00000000000000# frozen_string_literal: true # can be hardcoded here but for copy the example around that is easier require Dir["#{File.dirname(__FILE__)}/*jar"].first jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-rake-compiler/mygem.gemspec000066400000000000000000000014641515606370500331640ustar00rootroot00000000000000# frozen_string_literal: true # use the version from the main project require "#{File.dirname File.expand_path(__FILE__)}/../../../lib/jars/version" Gem::Specification.new do |s| s.name = File.basename(File.dirname(File.expand_path(__FILE__))) s.version = '1.0.0' s.author = ['example person'] s.email = ['mail@example.com'] s.summary = "summary of #{s.name}" s.description = "description of #{s.name}" # nice to have s.platform = 'java' s.files = Dir['lib/**/*.rb'] s.files += Dir['lib/*.jar'] s.files += Dir['*.file'] s.files += Dir['*.gemspec'] s.required_ruby_version = '>= 2.6' s.add_development_dependency 'rake', '~> 10.3' # needed to compile ext/** and create jar file s.add_development_dependency 'rake-compile', '~> 0.9' s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-rake-compiler/test.rb000066400000000000000000000002071515606370500317770ustar00rootroot00000000000000# frozen_string_literal: true # setup env $LOAD_PATH << 'lib' # load our gem require 'mygem' # use it puts Java::App.hello('world') jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-ruby-maven/000077500000000000000000000000001515606370500300275ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-ruby-maven/README.md000066400000000000000000000006111515606370500313040ustar00rootroot00000000000000# using rake and ruby-maven gem ## setup ``` bundle install ``` which is important since it will create a file lib/gem-name_jars.rb and installs the jar dependencies into a local cache (local maven repository) ## build compile and create jar ``` rake compile ``` ## pack gem ``` rake package ``` ## just run the code make sure you use jruby (via rbenv, rvm, etc) ``` jruby test.rb ```jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-ruby-maven/Rakefile000066400000000000000000000006341515606370500314770ustar00rootroot00000000000000# frozen_string_literal: true require 'ruby-maven' desc 'Pack jar after compiling classes' task :compile do RubyMaven.exec('prepare-package') end desc 'Clean build' task :clean do RubyMaven.exec('clean') end task default: [:compile] require 'rubygems/package_task' Gem::PackageTask.new(eval(File.read('mygem.gemspec'))) do # rubocop:disable Security/Eval desc 'Pack gem' task package: [:compile] end jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-ruby-maven/lib/000077500000000000000000000000001515606370500305755ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-ruby-maven/lib/mygem.rb000066400000000000000000000002321515606370500322350ustar00rootroot00000000000000# frozen_string_literal: true # can be hardcoded here but for copy the example around that is easier require Dir["#{File.dirname(__FILE__)}/*jar"].first jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-ruby-maven/mygem.gemspec000066400000000000000000000017621515606370500325200ustar00rootroot00000000000000# frozen_string_literal: true # use the version from the main project require "#{File.dirname File.expand_path(__FILE__)}/../../lib/jars/version" Gem::Specification.new do |s| s.name = File.basename(File.dirname(File.expand_path(__FILE__))) s.version = '1.0.0' s.author = ['example person'] s.email = ['mail@example.com'] s.summary = "summary of #{s.name}" s.description = "description of #{s.name}" # important to get the jars installed s.platform = 'java' s.files = Dir['lib/**/*.rb'] s.files += Dir['lib/*.jar'] s.files += Dir['*.file'] s.files += Dir['*.gemspec'] s.required_ruby_version = '>= 2.6' # declare the jar dependencies s.requirements << 'jar org.slf4j, slf4j-api, 1.7.7' s.requirements << 'jar org.slf4j, slf4j-simple, 1.7.7, :scope => :test' s.add_development_dependency 'rake', '~> 10.3' # needed to compile src/main/java/** and create jar file s.add_development_dependency 'ruby-maven', '~> 3.9' s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-ruby-maven/src/000077500000000000000000000000001515606370500306165ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-ruby-maven/src/main/000077500000000000000000000000001515606370500315425ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-ruby-maven/src/main/java/000077500000000000000000000000001515606370500324635ustar00rootroot00000000000000App.java000066400000000000000000000001371515606370500337700ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-ruby-maven/src/main/javaclass App { public static String hello(String name) { return "hello " + name; } } jruby-jar-dependencies-92427b1/examples/gem-with-java-extension/using-ruby-maven/test.rb000066400000000000000000000002071515606370500313320ustar00rootroot00000000000000# frozen_string_literal: true # setup env $LOAD_PATH << 'lib' # load our gem require 'mygem' # use it puts Java::App.hello('world') jruby-jar-dependencies-92427b1/examples/sinatra-app/000077500000000000000000000000001515606370500223645ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-gems-with-jar-dependencies/000077500000000000000000000000001515606370500307405ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-gems-with-jar-dependencies/Gemfile000066400000000000000000000003331515606370500322320ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' gem 'leafy-complete', '0.6.2' gem 'sinatra', '~> 1.4' group :development do gem 'jar-dependencies', '0.3.0' gem 'ruby-maven', '~> 3.9', '>= 3.9.3' end jruby-jar-dependencies-92427b1/examples/sinatra-app/having-gems-with-jar-dependencies/Gemfile.lock000066400000000000000000000020001515606370500331520ustar00rootroot00000000000000GEM remote: https://rubygems.org/ specs: jar-dependencies (0.3.0) leafy-complete (0.6.2-java) leafy-health (~> 0.6.2) leafy-logger (~> 0.6.2) leafy-metrics (~> 0.6.2) leafy-rack (~> 0.6.2) leafy-health (0.6.2-java) jar-dependencies (~> 0.1) leafy-logger (0.6.2-java) jar-dependencies (~> 0.1) leafy-metrics (~> 0.6.2) leafy-metrics (0.6.2-java) jar-dependencies (~> 0.1) leafy-rack (0.6.2-java) jar-dependencies (~> 0.1) leafy-health (~> 0.6.2) leafy-logger (~> 0.6.2) leafy-metrics (~> 0.6.2) rack (1.6.13) rack-protection (1.5.5) rack ruby-maven (3.9.3) ruby-maven-libs (~> 3.9.9) ruby-maven-libs (3.9.9) sinatra (1.4.8) rack (~> 1.5) rack-protection (~> 1.4) tilt (>= 1.3, < 3) tilt (2.4.0) PLATFORMS universal-java-24 DEPENDENCIES jar-dependencies (= 0.3.0) leafy-complete (= 0.6.2) ruby-maven (~> 3.9, >= 3.9.3) sinatra (~> 1.4) BUNDLED WITH 2.5.11 jruby-jar-dependencies-92427b1/examples/sinatra-app/having-gems-with-jar-dependencies/Jars.lock000066400000000000000000000033541515606370500325160ustar00rootroot00000000000000io.dropwizard.metrics:metrics-healthchecks:3.1.0:compile: org.slf4j:slf4j-api:1.7.7:compile: io.dropwizard.metrics:metrics-jvm:3.1.0:compile: io.dropwizard.metrics:metrics-core:3.1.0:compile: io.dropwizard.metrics:metrics-graphite:3.1.0:compile: io.dropwizard:dropwizard-logging:0.8.0-rc5:compile: io.dropwizard:dropwizard-jackson:0.8.0-rc5:compile: com.google.guava:guava:18.0:compile: io.dropwizard:dropwizard-util:0.8.0-rc5:compile: com.google.code.findbugs:jsr305:3.0.0:compile: com.fasterxml.jackson.core:jackson-core:2.5.1:compile: com.fasterxml.jackson.datatype:jackson-datatype-jdk7:2.5.1:compile: com.fasterxml.jackson.datatype:jackson-datatype-guava:2.5.1:compile: com.fasterxml.jackson.module:jackson-module-afterburner:2.5.1:compile: com.fasterxml.jackson.datatype:jackson-datatype-joda:2.5.1:compile: io.dropwizard:dropwizard-validation:0.8.0-rc5:compile: org.hibernate:hibernate-validator:5.1.3.Final:compile: javax.validation:validation-api:1.1.0.Final:compile: org.jboss.logging:jboss-logging:3.1.3.GA:compile: com.fasterxml:classmate:1.0.0:compile: org.glassfish:javax.el:3.0.0:compile: io.dropwizard.metrics:metrics-logback:3.1.0:compile: org.slf4j:jul-to-slf4j:1.7.10:compile: ch.qos.logback:logback-core:1.1.2:compile: ch.qos.logback:logback-classic:1.1.2:compile: org.slf4j:log4j-over-slf4j:1.7.10:compile: org.slf4j:jcl-over-slf4j:1.7.10:compile: org.eclipse.jetty:jetty-util:9.2.9.v20150224:compile: io.dropwizard:dropwizard-configuration:0.8.0-rc5:compile: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.5.1:compile: org.apache.commons:commons-lang3:3.3.2:compile: io.dropwizard.metrics:metrics-json:3.1.0:compile: com.fasterxml.jackson.core:jackson-databind:2.4.2:compile: com.fasterxml.jackson.core:jackson-annotations:2.4.0:compile: jruby-jar-dependencies-92427b1/examples/sinatra-app/having-gems-with-jar-dependencies/README.md000066400000000000000000000006401515606370500322170ustar00rootroot00000000000000assuming jruby is used via rbenv, rvm, etc ## setup ``` bundle install ``` which is important since it will create a file lib/gem-name_jars.rb and installs the jar dependencies into a local cache (local maven repository) ## use it ``` rackup ``` ## lock down version of jar dependencies lock down may or may not be needed. in case you want to lock down your versions for the jars execute: ``` lock_jars ``` jruby-jar-dependencies-92427b1/examples/sinatra-app/having-gems-with-jar-dependencies/app/000077500000000000000000000000001515606370500315205ustar00rootroot00000000000000hellowarld.rb000066400000000000000000000027611515606370500341310ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-gems-with-jar-dependencies/app# frozen_string_literal: true require 'sinatra' require 'json' require 'ostruct' require 'leafy/metrics' require 'leafy/health' require 'leafy/instrumented/instrumented' require 'leafy/instrumented/collected_instrumented' require 'leafy/rack/admin' require 'leafy/rack/instrumented' Data = Struct.new(:surname, :firstname) data = Data.new('meier', 'christian') configure do metrics = Leafy::Metrics::Registry.new health = Leafy::Health::Registry.new use(Leafy::Rack::Admin, metrics, health) use(Leafy::Rack::Metrics, metrics) use(Leafy::Rack::Health, health) use(Leafy::Rack::Ping) use(Leafy::Rack::ThreadDump) use(Leafy::Rack::Instrumented, Leafy::Instrumented::Instrumented.new(metrics, 'webapp')) use(Leafy::Rack::Instrumented, Leafy::Instrumented::CollectedInstrumented.new(metrics, 'collected')) metrics.register_gauge('app.data_length') do data.surname.length + data.firstname.length end health.register('app.health') do 'stored names are too short' if data.surname.length + data.firstname.length < 4 end set :histogram, metrics.register_histogram('app.name_length') end get '/app' do p @person = data erb :person end get '/person' do p @person = data content_type 'application/json' { surname: data.surname, firstname: data.firstname }.to_json end patch '/person' do payload = JSON.parse request.body.read data.send :"#{payload.keys.first}=", payload.values.first settings.histogram.update(data.surname.length + data.firstname.length) status 205 end jruby-jar-dependencies-92427b1/examples/sinatra-app/having-gems-with-jar-dependencies/app/views/000077500000000000000000000000001515606370500326555ustar00rootroot00000000000000person.erb000066400000000000000000000025001515606370500345730ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-gems-with-jar-dependencies/app/views <%= @person.firstname %> <%= @person.surname %>

person

Firstname
Surname
jruby-jar-dependencies-92427b1/examples/sinatra-app/having-gems-with-jar-dependencies/config.ru000066400000000000000000000002311515606370500325510ustar00rootroot00000000000000# frozen_string_literal: true $LOAD_PATH.unshift(__dir__) require 'bundler/setup' require 'app/hellowarld' map '/' do run Sinatra::Application end jruby-jar-dependencies-92427b1/examples/sinatra-app/having-jarfile-and-gems-with-jar-dependencies/000077500000000000000000000000001515606370500331125ustar00rootroot00000000000000Gemfile000066400000000000000000000003331515606370500343250ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-jarfile-and-gems-with-jar-dependencies# frozen_string_literal: true source 'https://rubygems.org' gem 'leafy-complete', '0.6.2' gem 'sinatra', '~> 1.4' group :development do gem 'jar-dependencies', '0.3.0' gem 'ruby-maven', '~> 3.9', '>= 3.9.3' end Gemfile.lock000066400000000000000000000020001515606370500352450ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-jarfile-and-gems-with-jar-dependenciesGEM remote: https://rubygems.org/ specs: jar-dependencies (0.3.0) leafy-complete (0.6.2-java) leafy-health (~> 0.6.2) leafy-logger (~> 0.6.2) leafy-metrics (~> 0.6.2) leafy-rack (~> 0.6.2) leafy-health (0.6.2-java) jar-dependencies (~> 0.1) leafy-logger (0.6.2-java) jar-dependencies (~> 0.1) leafy-metrics (~> 0.6.2) leafy-metrics (0.6.2-java) jar-dependencies (~> 0.1) leafy-rack (0.6.2-java) jar-dependencies (~> 0.1) leafy-health (~> 0.6.2) leafy-logger (~> 0.6.2) leafy-metrics (~> 0.6.2) rack (1.6.13) rack-protection (1.5.5) rack ruby-maven (3.9.3) ruby-maven-libs (~> 3.9.9) ruby-maven-libs (3.9.9) sinatra (1.4.8) rack (~> 1.5) rack-protection (~> 1.4) tilt (>= 1.3, < 3) tilt (2.4.0) PLATFORMS universal-java-24 DEPENDENCIES jar-dependencies (= 0.3.0) leafy-complete (= 0.6.2) ruby-maven (~> 3.9, >= 3.9.3) sinatra (~> 1.4) BUNDLED WITH 2.5.11 Jarfile000066400000000000000000000001061515606370500343270ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-jarfile-and-gems-with-jar-dependencies# frozen_string_literal: true jar 'org.slf4j:slf4j-simple', '1.7.12' Jars.lock000066400000000000000000000035251515606370500346110ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-jarfile-and-gems-with-jar-dependenciescom.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.5.1:compile: com.fasterxml.jackson.core:jackson-core:2.5.1:compile: com.fasterxml.jackson.core:jackson-databind:2.4.2:compile: com.fasterxml.jackson.core:jackson-annotations:2.4.0:compile: org.yaml:snakeyaml:1.14:compile: io.dropwizard.metrics:metrics-healthchecks:3.1.0:compile: org.slf4j:slf4j-api:1.7.7:compile: io.dropwizard:dropwizard-jackson:0.8.0-rc5:compile: com.google.guava:guava:18.0:compile: io.dropwizard:dropwizard-util:0.8.0-rc5:compile: com.google.code.findbugs:jsr305:3.0.0:compile: joda-time:joda-time:2.7:compile: com.fasterxml.jackson.datatype:jackson-datatype-jdk7:2.5.1:compile: com.fasterxml.jackson.datatype:jackson-datatype-guava:2.5.1:compile: com.fasterxml.jackson.module:jackson-module-afterburner:2.5.1:compile: com.fasterxml.jackson.datatype:jackson-datatype-joda:2.5.1:compile: ch.qos.logback:logback-classic:1.1.2:compile: ch.qos.logback:logback-core:1.1.2:compile: com.fasterxml:classmate:1.0.0:compile: org.slf4j:slf4j-simple:1.7.13:compile: io.dropwizard:dropwizard-configuration:0.8.0-rc5:compile: io.dropwizard:dropwizard-validation:0.8.0-rc5:compile: org.hibernate:hibernate-validator:5.1.3.Final:compile: javax.validation:validation-api:1.1.0.Final:compile: org.jboss.logging:jboss-logging:3.1.3.GA:compile: org.glassfish:javax.el:3.0.0:compile: org.apache.commons:commons-lang3:3.3.2:compile: io.dropwizard.metrics:metrics-json:3.1.0:compile: io.dropwizard.metrics:metrics-core:3.1.0:compile: io.dropwizard.metrics:metrics-graphite:3.1.0:compile: io.dropwizard.metrics:metrics-jvm:3.1.0:compile: org.slf4j:jcl-over-slf4j:1.7.10:compile: org.slf4j:log4j-over-slf4j:1.7.10:compile: org.slf4j:jul-to-slf4j:1.7.10:compile: io.dropwizard:dropwizard-logging:0.8.0-rc5:compile: io.dropwizard.metrics:metrics-logback:3.1.0:compile: org.eclipse.jetty:jetty-util:9.2.9.v20150224:compile: README.md000066400000000000000000000007511515606370500343150ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-jarfile-and-gems-with-jar-dependenciesassuming jruby is used via rbenv, rvm, etc ## setup it needs to install/lockdown the gems and the jars in with two commands ### install/lockdown the gems ``` bundle install ``` which is important since it will create a file lib/gem-name_jars.rb and installs the jar dependencies into a local cache (local maven repository) ### install/lockdown the jars since there is Jarfile the jar dependencies from there only get installed with ``` lock_jars ``` ## use it ``` rackup ``` app/000077500000000000000000000000001515606370500336135ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-jarfile-and-gems-with-jar-dependencieshellowarld.rb000066400000000000000000000027611515606370500363030ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-jarfile-and-gems-with-jar-dependencies/app# frozen_string_literal: true require 'sinatra' require 'json' require 'ostruct' require 'leafy/metrics' require 'leafy/health' require 'leafy/instrumented/instrumented' require 'leafy/instrumented/collected_instrumented' require 'leafy/rack/admin' require 'leafy/rack/instrumented' Data = Struct.new(:surname, :firstname) data = Data.new('meier', 'christian') configure do metrics = Leafy::Metrics::Registry.new health = Leafy::Health::Registry.new use(Leafy::Rack::Admin, metrics, health) use(Leafy::Rack::Metrics, metrics) use(Leafy::Rack::Health, health) use(Leafy::Rack::Ping) use(Leafy::Rack::ThreadDump) use(Leafy::Rack::Instrumented, Leafy::Instrumented::Instrumented.new(metrics, 'webapp')) use(Leafy::Rack::Instrumented, Leafy::Instrumented::CollectedInstrumented.new(metrics, 'collected')) metrics.register_gauge('app.data_length') do data.surname.length + data.firstname.length end health.register('app.health') do 'stored names are too short' if data.surname.length + data.firstname.length < 4 end set :histogram, metrics.register_histogram('app.name_length') end get '/app' do p @person = data erb :person end get '/person' do p @person = data content_type 'application/json' { surname: data.surname, firstname: data.firstname }.to_json end patch '/person' do payload = JSON.parse request.body.read data.send :"#{payload.keys.first}=", payload.values.first settings.histogram.update(data.surname.length + data.firstname.length) status 205 end views/000077500000000000000000000000001515606370500347505ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-jarfile-and-gems-with-jar-dependencies/appperson.erb000066400000000000000000000025001515606370500367450ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-jarfile-and-gems-with-jar-dependencies/app/views <%= @person.firstname %> <%= @person.surname %>

person

Firstname
Surname
config.ru000066400000000000000000000002311515606370500346440ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/examples/sinatra-app/having-jarfile-and-gems-with-jar-dependencies# frozen_string_literal: true $LOAD_PATH.unshift(__dir__) require 'bundler/setup' require 'app/hellowarld' map '/' do run Sinatra::Application end jruby-jar-dependencies-92427b1/exe/000077500000000000000000000000001515606370500171105ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/exe/lock_jars000077500000000000000000000030351515606370500210060ustar00rootroot00000000000000#!/usr/bin/env ruby # frozen_string_literal: true require 'jar_dependencies' require 'optparse' options = {} optparse = OptionParser.new do |opts| opts.banner = "Usage: #{File.basename(__FILE__)} [options]" opts.separator '' opts.separator 'Options:' opts.separator '' opts.on('-v', '--verbose', 'Output more information') do |t| options[:verbose] = t end opts.on('-d', '--debug', 'Output debug information') do |t| options[:debug] = t end opts.on('-f', '--force', 'Force creation of Jars.lock') do |t| options[:force] = t end opts.on('-t', '--tree', 'Show dependency tree') do |t| options[:tree] = t end opts.on('-u', '--update JAR_COORDINATE', 'Resolves given dependency and use latest version. ' \ 'JAR_COORDINATE is either artifact_id or group_id:artifact_id') do |u| options[:update] = u end opts.on('--vendor-dir DIRECTORY', 'Vendor directory where to copy the installed jars.' \ 'add this directory to $LOAD_PATH or set JARS_HOME respectively.') do |dir| options[:vendor_dir] = dir end opts.on('-h', '--help', 'Display this screen') do puts opts exit end opts.separator '' opts.separator 'THIS IS A EXPERIMETAL FEATURE !!!' opts.separator '' opts.separator '* load jars "Jars.lock" from current working directory: `Jars.require_jars_lock!`' opts.separator '* classpath features: see `Jars::Classpath' end optparse.parse! Jars.lock_down(debug: options.delete(:debug), verbose: options.delete(:verbose), **options) jruby-jar-dependencies-92427b1/exe/vendor_jars000077500000000000000000000001521515606370500213500ustar00rootroot00000000000000#!/usr/bin/env ruby # frozen_string_literal: true require 'jars/installer' Jars::Installer.vendor_jars! jruby-jar-dependencies-92427b1/integration/000077500000000000000000000000001515606370500206525ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/bundle_with_path/000077500000000000000000000000001515606370500241725ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/bundle_with_path/Gemfile000066400000000000000000000001061515606370500254620ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' gemspec jruby-jar-dependencies-92427b1/integration/bundle_with_path/Mavenfile000066400000000000000000000017121515606370500260240ustar00rootroot00000000000000# frozen_string_literal: true repository id: 'mavengems', url: 'mavengem:https://rubygems.org' plugin('org.codehaus.mojo:exec-maven-plugin', '3.5.0', executable: :java, environmentVariables: { 'GEM_HOME' => '${gem.home}', 'GEM_PATH' => '${gem.home}', 'JARS_VERBOSE' => true }) do execute_goal(:exec, phase: :compile, arguments: ['-classpath', xml(''), 'org.jruby.Main', 'bundle.rb']) end properties('gem.home' => '${project.basedir}/../rubygems', 'gem.path' => '${gem.home}') jar 'org.jruby:jruby-complete', '${jruby.version}' gem 'jar-dependencies', '${jar-dependencies.version}' gem 'bundler', '${bundler.version}' gem 'ruby-maven', '${ruby-maven.version}' jruby_plugin :gem, '${jruby.plugins.version}' do execute_goal :initialize end jruby-jar-dependencies-92427b1/integration/bundle_with_path/bundle.rb000066400000000000000000000004611515606370500257710ustar00rootroot00000000000000# frozen_string_literal: true require_relative '../../lib/jars/version' # force to use prereleased gem gem 'jar-dependencies', Jars::VERSION require 'jar-dependencies' require 'bundler/friendly_errors' Bundler.with_friendly_errors do require 'bundler/cli' Bundler::CLI.start(ARGV, debug: true) end jruby-jar-dependencies-92427b1/integration/bundle_with_path/invoker.properties000066400000000000000000000000151515606370500277610ustar00rootroot00000000000000goal=compile jruby-jar-dependencies-92427b1/integration/bundle_with_path/mygem.gemspec000066400000000000000000000005661515606370500266640ustar00rootroot00000000000000# frozen_string_literal: true Gem::Specification.new do |s| s.name = 'foo' s.version = '0.0.1' s.authors = ['foo'] s.summary = 'foo' s.requirements << 'jar io.dropwizard.metrics:metrics-healthchecks, 3.1.0' s.platform = 'java' s.required_ruby_version = '>= 2.6' s.add_runtime_dependency 'jar-dependencies' s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/integration/bundle_with_path/pom.xml000066400000000000000000000002551515606370500255110ustar00rootroot00000000000000 jar-dependencies.its bundle_with_path 0.0.0 jruby-jar-dependencies-92427b1/integration/bundle_with_path/verify.bsh000066400000000000000000000014561515606370500262020ustar00rootroot00000000000000import java.io.*; import org.codehaus.plexus.util.FileUtils; String log = FileUtils.fileRead( new File( basedir, "build.log" ) ); String expected = "jar dependencies for foo-0.0.1-java.gemspec"; if ( !log.contains( expected ) ) { throw new RuntimeException( "log file does not contain '" + expected + "'" ); } expected = "lib/foo_jars.rb"; if ( ! new File( basedir, expected ).exists() ) { throw new RuntimeException( "log file does not exists '" + expected + "'" ); } // expected = "lib/io"; // if ( ! new File( basedir, expected ).exists() ) // { // throw new RuntimeException( "log file does exists '" + expected + "'" ); // } // expected = "lib/org"; // if ( ! new File( basedir, expected ).exists() ) // { // throw new RuntimeException( "log file does exists '" + expected + "'" ); // } jruby-jar-dependencies-92427b1/integration/bundle_with_path_to_gemspec/000077500000000000000000000000001515606370500263775ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/bundle_with_path_to_gemspec/Gemfile000066400000000000000000000001661515606370500276750ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' gem 'foo', path: File.dirname(__FILE__), require: false jruby-jar-dependencies-92427b1/integration/bundle_with_path_to_gemspec/Mavenfile000066400000000000000000000006041515606370500302300ustar00rootroot00000000000000# frozen_string_literal: true plugin_repository id: 'mavengems', url: 'mavengem:https://rubygems.org' properties('gem.home' => '${project.basedir}/../../pkg/rubygems', 'gem.path' => '${gem.home}') jruby_plugin :gem, filename: 'bundle', args: 'install' do execute_goal :exec gem 'bundler', '${bundler.version}' gem 'jar-dependencies', '${jar-dependencies.version}' end jruby-jar-dependencies-92427b1/integration/bundle_with_path_to_gemspec/invoker.properties000066400000000000000000000000301515606370500321630ustar00rootroot00000000000000invoker.goals = gem:execjruby-jar-dependencies-92427b1/integration/bundle_with_path_to_gemspec/mygem.gemspec000066400000000000000000000004701515606370500310630ustar00rootroot00000000000000# frozen_string_literal: true Gem::Specification.new do |s| s.name = 'foo' version = '0.0.1' mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version s.authors = ['foo'] s.summary = 'foo' s.required_ruby_version = '>= 2.6' s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/integration/bundle_with_path_to_gemspec/pom.xml000066400000000000000000000002701515606370500277130ustar00rootroot00000000000000 jar-dependencies.its bundle_with_path_to_gemspec 0.0.0 jruby-jar-dependencies-92427b1/integration/bundle_with_two_gemspecs/000077500000000000000000000000001515606370500257355ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/bundle_with_two_gemspecs/Gemfile000066400000000000000000000001771515606370500272350ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' gemspec name: 'wat_two_gemspecs' gemspec name: 'another_gemspec' jruby-jar-dependencies-92427b1/integration/bundle_with_two_gemspecs/Mavenfile000066400000000000000000000006041515606370500275660ustar00rootroot00000000000000# frozen_string_literal: true plugin_repository id: 'mavengems', url: 'mavengem:https://rubygems.org' properties('gem.home' => '${project.basedir}/../../pkg/rubygems', 'gem.path' => '${gem.home}') jruby_plugin :gem, filename: 'bundle', args: 'install' do execute_goal :exec gem 'bundler', '${bundler.version}' gem 'jar-dependencies', '${jar-dependencies.version}' end jruby-jar-dependencies-92427b1/integration/bundle_with_two_gemspecs/another_gemspec.gemspec000066400000000000000000000013751515606370500324530ustar00rootroot00000000000000# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'another_gemspec/version' Gem::Specification.new do |spec| spec.name = 'another_gemspec' spec.version = AnotherGemspec::VERSION spec.authors = ['Jason R. Clark'] spec.email = ['jclark@newrelic.com'] spec.summary = 'Wat, two gemspecs?' spec.description = 'Are you crazy?' spec.homepage = '' spec.license = 'MIT' spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ['lib'] spec.metadata['rubygems_mfa_required'] = 'true' spec.required_ruby_version = '>= 2.6' end jruby-jar-dependencies-92427b1/integration/bundle_with_two_gemspecs/invoker.properties000066400000000000000000000000301515606370500315210ustar00rootroot00000000000000invoker.goals = gem:execjruby-jar-dependencies-92427b1/integration/bundle_with_two_gemspecs/lib/000077500000000000000000000000001515606370500265035ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/bundle_with_two_gemspecs/lib/another_gemspec/000077500000000000000000000000001515606370500316465ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/bundle_with_two_gemspecs/lib/another_gemspec/version.rb000066400000000000000000000001151515606370500336550ustar00rootroot00000000000000# frozen_string_literal: true module AnotherGemspec VERSION = '0.0.1' end jruby-jar-dependencies-92427b1/integration/bundle_with_two_gemspecs/lib/wat_two_gemspecs.rb000066400000000000000000000001701515606370500324000ustar00rootroot00000000000000# frozen_string_literal: true require 'wat_two_gemspecs/version' module WatTwoGemspecs # Your code goes here... end jruby-jar-dependencies-92427b1/integration/bundle_with_two_gemspecs/lib/wat_two_gemspecs/000077500000000000000000000000001515606370500320555ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/bundle_with_two_gemspecs/lib/wat_two_gemspecs/version.rb000066400000000000000000000001151515606370500340640ustar00rootroot00000000000000# frozen_string_literal: true module WatTwoGemspecs VERSION = '0.0.1' end jruby-jar-dependencies-92427b1/integration/bundle_with_two_gemspecs/pom.xml000066400000000000000000000002651515606370500272550ustar00rootroot00000000000000 jar-dependencies.its bundle_with_two_gemspecs 0.0.0 jruby-jar-dependencies-92427b1/integration/bundle_with_two_gemspecs/wat_two_gemspecs.gemspec000066400000000000000000000015501515606370500326550ustar00rootroot00000000000000# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'wat_two_gemspecs/version' Gem::Specification.new do |spec| spec.name = 'wat_two_gemspecs' spec.version = WatTwoGemspecs::VERSION spec.authors = ['Jason R. Clark'] spec.email = ['jclark@newrelic.com'] spec.summary = 'Wat, two gemspecs?' spec.description = 'Are you crazy?' spec.homepage = '' spec.license = 'MIT' spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ['lib'] s.required_ruby_version = '>= 2.6' spec.add_development_dependency 'bundler', '~> 1.7' spec.add_development_dependency 'rake', '~> 10.0' spec.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/integration/depending_gems/000077500000000000000000000000001515606370500236225ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/depending_gems/Mavenfile000066400000000000000000000011751515606370500254570ustar00rootroot00000000000000# frozen_string_literal: true group_id 'jar-dependencies' packaging 'pom' modules %w[simplelib biglib] properties('gem.home' => '${project.basedir}/pkg/rubygems', 'gem.path' => '${project.basedir}/pkg/rubygems') phase :test do execute 'verify' do |ctx| log = File.read("#{ctx.basedir.to_pathname}/build.log") ['io.dropwizard.metrics:metrics-json:3.1.0', 'io.dropwizard.metrics:metrics-jvm:3.1.0', 'io.dropwizard.metrics:metrics-core:3.1.0'].each do |expected| raise "log does not contain '#{expected}'" unless /#{expected}/.match?(log) puts "log contains '#{expected}'" end end end jruby-jar-dependencies-92427b1/integration/depending_gems/biglib/000077500000000000000000000000001515606370500250525ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/depending_gems/biglib/Gemfile000066400000000000000000000001551515606370500263460ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' gem 'simplelib', path: '../simplelib' gemspec jruby-jar-dependencies-92427b1/integration/depending_gems/biglib/Mavenfile000066400000000000000000000017771515606370500267170ustar00rootroot00000000000000# frozen_string_literal: true properties('gem.home' => '${basedir}/../pkg', 'gem.path' => '${gem.home}') repository id: 'mavengems', url: 'mavengem:https://rubygems.org' pom 'org.jruby:jruby', '${jruby.version}' gem 'jar-dependencies', '${jar-dependencies.version}' gem 'bundler', '${bundler.version}' gem 'ruby-maven', '${ruby-maven.version}' gem 'ruby-maven-libs', '3.9.3' jruby_plugin :gem, '${jruby.plugins.version}' do execute_goal :initialize end plugin('org.codehaus.mojo:exec-maven-plugin', '3.5.0', executable: :java, environmentVariables: { 'GEM_HOME' => '${gem.home}', 'GEM_PATH' => '${gem.home}', 'PATH' => '${gem.home}/bin${path.separator}${env.PATH}' }) do execute_goal(:exec, phase: :test, arguments: ['-classpath', xml(''), 'org.jruby.Main', '-S', 'bundle', 'install']) end jruby-jar-dependencies-92427b1/integration/depending_gems/biglib/biglib.gemspec000066400000000000000000000011551515606370500276510ustar00rootroot00000000000000# frozen_string_literal: true Gem::Specification.new do |s| s.name = 'biglib' s.version = '1' s.author = 'christian meier' s.email = ['m.kristian@web.de'] s.platform = 'java' s.license = 'MIT' s.summary = 'biglib' s.homepage = 'https://example.com' s.description = 'more examples' s.required_ruby_version = '>= 2.6' s.requirements << 'jar io.dropwizard.metrics:metrics-json, 3.1.0' s.requirements << 'jar io.dropwizard.metrics:metrics-jvm, 3.1.0' s.add_runtime_dependency 'jar-dependencies' s.add_development_dependency 'simplelib', '1' s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/integration/depending_gems/pom.xml000066400000000000000000000002531515606370500251370ustar00rootroot00000000000000 jar-dependencies.its depending_gems 0.0.0 jruby-jar-dependencies-92427b1/integration/depending_gems/simplelib/000077500000000000000000000000001515606370500256025ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/depending_gems/simplelib/Mavenfile000066400000000000000000000001751515606370500274360ustar00rootroot00000000000000# frozen_string_literal: true properties('gem.home' => '${basedir}/../pkg', 'gem.path' => '${gem.home}') gemspec jruby-jar-dependencies-92427b1/integration/depending_gems/simplelib/simplelib.gemspec000066400000000000000000000010001515606370500311160ustar00rootroot00000000000000# frozen_string_literal: true Gem::Specification.new do |s| s.name = 'simplelib' s.version = '1' s.author = 'christian meier' s.email = ['m.kristian@web.de'] s.platform = 'java' s.license = 'MIT' s.summary = 'simplelib' s.homepage = 'https://example.com' s.description = 'more examples' s.required_ruby_version = '>= 2.6' s.requirements << 'jar io.dropwizard.metrics:metrics-core, 3.1.0' s.add_runtime_dependency 'jar-dependencies' s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/integration/gemspec_with_classifier_and_exclusions/000077500000000000000000000000001515606370500306325ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/gemspec_with_classifier_and_exclusions/Gemfile000066400000000000000000000001051515606370500321210ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' gemspec jruby-jar-dependencies-92427b1/integration/gemspec_with_classifier_and_exclusions/Mavenfile000066400000000000000000000027511515606370500324700ustar00rootroot00000000000000# frozen_string_literal: true repository id: 'mavengems', url: 'mavengem:https://rubygems.org' plugin('org.codehaus.mojo:exec-maven-plugin', '3.5.0', executable: :java, environmentVariables: { 'GEM_HOME' => '${gem.home}', 'GEM_PATH' => '${gem.home}', 'JARS_VERBOSE' => true }) do execute_goal(:exec, id: 'Jars::Classpath.require', phase: :compile, arguments: ['-classpath', xml(''), 'org.jruby.Main', '-rjars/classpath', '-e', 'Jars::Classpath.require(:test);$CLASSPATH.each { |c| p c }']) execute_goal(:exec, id: 'lock_jars --tree', phase: :compile, arguments: ['-classpath', xml(''), 'org.jruby.Main', '${gem.home}/bin/lock_jars', '--tree']) # TODO: more tests on Jars::Classpath.require(:test) etc end properties('gem.home' => '${project.basedir}/../rubygems', 'gem.path' => '${gem.home}') jar 'org.jruby:jruby-complete', '${jruby.version}' gem 'jar-dependencies', '${jar-dependencies.version}' gem 'bundler', '${bundler.version}' gem 'ruby-maven', '${ruby-maven.version}' jruby_plugin :gem, '${jruby.plugins.version}' do execute_goal :initialize end jruby-jar-dependencies-92427b1/integration/gemspec_with_classifier_and_exclusions/mygem.gemspec000066400000000000000000000011711515606370500333150ustar00rootroot00000000000000# frozen_string_literal: true Gem::Specification.new do |s| s.name = 'mygem' s.version = '0.0.1' s.authors = ['foo'] s.summary = 'foo' s.requirements << 'jar io.dropwizard:dropwizard-logging, 0.8.0-rc5, :exclusions=> [ joda-time:joda-time ]' s.requirements << 'jar com.google.protobuf:protobuf-java, 2.2.0, :classifier => lite' s.requirements << 'jar org.slf4j:slf4j-simple:1.7.7, :scope => :provided' s.requirements << 'jar junit:junit:4.12, :scope => :test' s.platform = 'java' s.required_ruby_version = '>= 2.6' s.add_runtime_dependency 'jar-dependencies' s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/integration/gemspec_with_classifier_and_exclusions/setup.bsh000066400000000000000000000001051515606370500324640ustar00rootroot00000000000000import java.io.*; new File(basedir, "Jars.lock").delete() || true; jruby-jar-dependencies-92427b1/integration/gemspec_with_classifier_and_exclusions/verify.bsh000066400000000000000000000007501515606370500326360ustar00rootroot00000000000000import java.io.*; import org.codehaus.plexus.util.FileUtils; String log = FileUtils.fileRead( new File( basedir, "build.log" ) ); String expected = "org.slf4j:slf4j-simple:jar:1.7.7:provide"; if ( !log.contains( expected ) ) { throw new RuntimeException( "log file does not contain '" + expected + "'" ); } expected = "org.hamcrest:hamcrest-core:jar:1.3:test"; if ( !log.contains( expected ) ) { throw new RuntimeException( "log file does not contain '" + expected + "'" ); } jruby-jar-dependencies-92427b1/integration/gemspec_with_system_jar/000077500000000000000000000000001515606370500255705ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/gemspec_with_system_jar/Mavenfile000066400000000000000000000005001515606370500274140ustar00rootroot00000000000000# frozen_string_literal: true id 'jar-dependencies:gemspec_with_system_jar:0' packaging 'pom' name 'aggregator' modules %w[gem verify] properties('gem.home' => '${project.basedir}/../rubygems', 'gem.path' => '${gem.home}') jruby_plugin :gem, '${jruby.plugins.version}' do execute_goal :initialize end jruby-jar-dependencies-92427b1/integration/gemspec_with_system_jar/gem/000077500000000000000000000000001515606370500263405ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/gemspec_with_system_jar/gem/Mavenfile000066400000000000000000000006671515606370500302020ustar00rootroot00000000000000# frozen_string_literal: true inherit 'jar-dependencies:gemspec_with_system_jar:0' do # TODO: should not be needed with ruby-maven relative_path '../Mavenfile' end gemspec # use the current jar dependencies gem model.dependencies.each do |d| d.version = '${jar-dependencies.version}' if d.artifact_id == 'jar-dependencies' end properties('gem.home' => '${project.basedir}/../../rubygems', 'gem.path' => '${gem.home}') jruby-jar-dependencies-92427b1/integration/gemspec_with_system_jar/gem/lib/000077500000000000000000000000001515606370500271065ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/gemspec_with_system_jar/gem/lib/first.rb000066400000000000000000000000761515606370500305650ustar00rootroot00000000000000# frozen_string_literal: true require 'with-system-jar_jars' jruby-jar-dependencies-92427b1/integration/gemspec_with_system_jar/gem/with-system-jar.gemspec000066400000000000000000000011211515606370500327470ustar00rootroot00000000000000# frozen_string_literal: true require_relative '../../../lib/jars/version' Gem::Specification.new do |s| s.name = 'with-system-jar' s.version = '1.1.1' s.author = 'example person' s.email = ['mail@example.com'] s.summary = 'first gem with jars vendored during installation' s.platform = 'java' s.files = Dir['lib/**/*.rb'] + Dir['*.gemspec'] s.required_ruby_version = '>= 2.6' s.add_runtime_dependency 'jar-dependencies', Jars::VERSION s.requirements << "jar 'org.apache.hbase:hbase-annotations', '=0.98.7-hadoop2'" s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/integration/gemspec_with_system_jar/pom.xml000066400000000000000000000002641515606370500271070ustar00rootroot00000000000000 jar-dependencies.its gemspec_with_system_jar 0.0.0 jruby-jar-dependencies-92427b1/integration/gemspec_with_system_jar/verify/000077500000000000000000000000001515606370500270745ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/gemspec_with_system_jar/verify/Mavenfile000066400000000000000000000016241515606370500307300ustar00rootroot00000000000000# frozen_string_literal: true inherit 'jar-dependencies:gemspec_with_system_jar:0' do # TODO: should not be needed with ruby-maven relative_path '../Mavenfile' end packaging 'pom' gem 'jar-dependencies', '${jar-dependencies.version}' jruby_plugin :gem, '${jruby.plugins.version}' do execute_goal :initialize end pom 'org.jruby:jruby', '${jruby.version}' plugin('org.codehaus.mojo:exec-maven-plugin', '3.5.0', executable: :java, environmentVariables: { 'GEM_HOME' => '${gem.home}', 'GEM_PATH' => '${gem.home}' }) do execute_goal(:exec, phase: :test, arguments: ['-classpath', xml(''), 'org.jruby.Main', 'test.rb']) end properties('gem.home' => '${project.basedir}/../../rubygems', 'gem.path' => '${gem.home}') jruby-jar-dependencies-92427b1/integration/gemspec_with_system_jar/verify/test.rb000066400000000000000000000005771515606370500304110ustar00rootroot00000000000000# frozen_string_literal: true require_relative '../../../lib/jars/version' # force to use prereleased gem gem 'jar-dependencies', Jars::VERSION require 'jar-dependencies' Gem.install(File.expand_path('../gem/pkg/with-system-jar-1.1.1.gem', __dir__)) require 'first' raise "missing tools.jar, not found in #{$CLASSPATH.inspect}" unless $CLASSPATH.detect { |c| c =~ /tools.jar/ } jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/000077500000000000000000000000001515606370500270745ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/Mavenfile000066400000000000000000000001631515606370500307250ustar00rootroot00000000000000# frozen_string_literal: true id 'jar-dependencies:install-ruby-maven:0' packaging 'pom' modules %w[gem verify] jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/gem/000077500000000000000000000000001515606370500276445ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/gem/Mavenfile000066400000000000000000000006621515606370500315010ustar00rootroot00000000000000# frozen_string_literal: true inherit 'jar-dependencies:install-ruby-maven:0' do # TODO: should not be needed with ruby-maven relative_path '../Mavenfile' end gemspec # use the current jar dependencies gem model.dependencies.each do |d| d.version = '${jar-dependencies.version}' if d.artifact_id == 'jar-dependencies' end properties('gem.home' => '${project.basedir}/../../rubygems', 'gem.path' => '${gem.home}') jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/gem/lib/000077500000000000000000000000001515606370500304125ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/gem/lib/my.rb000066400000000000000000000000611515606370500313610ustar00rootroot00000000000000# frozen_string_literal: true require 'my_jars' jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/gem/lib/my_jars.rb000066400000000000000000000003751515606370500324100ustar00rootroot00000000000000# frozen_string_literal: true # this is a generated file, to avoid over-writing it just delete this comment require 'jar_dependencies' require_jar('org.bouncycastle', 'bcpkix-jdk15on', '1.49') require_jar('org.bouncycastle', 'bcprov-jdk15on', '1.49') jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/gem/my.gemspec000066400000000000000000000007741515606370500316460ustar00rootroot00000000000000# frozen_string_literal: true Gem::Specification.new do |s| s.name = 'my' s.version = '1.1.1' s.author = 'example person' s.email = ['mail@example.com'] s.summary = 'test gem' s.files << Dir['lib/**/*.rb'] s.files << Dir['*file'] s.files << 'my.gemspec' s.required_ruby_version = '>= 2.6' s.add_runtime_dependency 'jar-dependencies' s.platform = 'java' s.requirements << "jar 'com.fasterxml.jackson.core:jackson-core', '2.3.0'" s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/pom.xml000066400000000000000000000002731515606370500304130ustar00rootroot00000000000000 jar-dependencies.its install_ruby_maven_when_needed 0.0.0 jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/verify.bsh000066400000000000000000000004461515606370500311020ustar00rootroot00000000000000import java.io.*; import org.codehaus.plexus.util.FileUtils; String log = FileUtils.fileRead( new File( basedir, "build.log" ) ); String expected = "my-1.1.1-java/deps.lst"; if ( !log.contains( expected ) ) { throw new RuntimeException( "log file does not contain '" + expected + "'" ); } jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/verify/000077500000000000000000000000001515606370500304005ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/verify/Gemfile000066400000000000000000000001251515606370500316710ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' gemspec path: '../gem' jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/verify/Mavenfile000066400000000000000000000027631515606370500322410ustar00rootroot00000000000000# frozen_string_literal: true inherit 'jar-dependencies:install-ruby-maven:0' do # TODO: should not be needed with ruby-maven relative_path '../Mavenfile' end packaging 'pom' jar 'org.jruby:jruby-complete', '${jruby.version}' plugin('org.codehaus.mojo:exec-maven-plugin', '3.5.0', executable: :java, environmentVariables: { 'GEM_HOME' => '${gem.home}', 'GEM_PATH' => '${gem.home}', 'JARS_VERBOSE' => true, 'BUNDLER_GEMFILE' => '${basedir}/Gemfile', 'PATH' => '${gem.home}/bin${path.separator}${env.PATH}' }) do execute_goal(:exec, id: 'gem install', phase: :test, arguments: ['-classpath', xml(''), 'org.jruby.Main', 'test_gem.rb', '${jar-dependencies.version}']) execute_goal(:exec, id: 'bundle install', phase: :test, arguments: ['-classpath', xml(''), 'org.jruby.Main', 'test_bundler.rb', '${jar-dependencies.version}']) end properties('gem.home' => '${project.basedir}/../../rubygems', 'gem.path' => '${gem.home}') repository id: 'mavengems', url: 'mavengem:https://rubygems.org' gem 'jar-dependencies', '${jar-dependencies.version}' gem 'bundler', '${bundler.version}' jruby_plugin :gem, '${jruby.plugins.version}' do execute_goal :initialize end jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/verify/test_bundler.rb000066400000000000000000000007551515606370500334260ustar00rootroot00000000000000# frozen_string_literal: true gemspecs = File.join(Gem.dir, 'specifications', 'ruby-maven-*gemspec') Dir[gemspecs].each do |f| File.delete(f) rescue nil end version = ARGV[0] gem 'jar-dependencies', version.sub(/-SNAPSHOT/, '') Kernel.at_exit do raise "did not find two ruby-maven gems installed #{Dir[gemspecs]}" if Dir[gemspecs].size != 2 end # this is like: gem install --ignore-dependencies, ../gem/pkg/my-1.1.1.gem ARGV.replace(['install']) load File.join(Gem.bindir, 'bundle') jruby-jar-dependencies-92427b1/integration/install_ruby_maven_when_needed/verify/test_gem.rb000066400000000000000000000011331515606370500325320ustar00rootroot00000000000000# frozen_string_literal: true gemspecs = File.join(Gem.dir, 'specifications', 'ruby-maven-*gemspec') Dir[gemspecs].each do |f| File.delete(f) rescue nil end version = ARGV[0] gem 'jar-dependencies', version.sub(/-SNAPSHOT/, '') Kernel.at_exit do raise "did not find two ruby-maven gems installed #{Dir[gemspecs]}" if Dir[gemspecs].size != 2 end # this is like: gem install --ignore-dependencies, ../gem/pkg/my-1.1.1.gem ARGV.replace(['install', '--ignore-dependencies', File.expand_path('../gem/pkg/my-1.1.1.gem', __dir__)]) load File.join(JRuby.runtime.instance_config.jruby_home, 'bin/gem') jruby-jar-dependencies-92427b1/integration/jars_lock_gemfile/000077500000000000000000000000001515606370500243115ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/jars_lock_gemfile/Gemfile000066400000000000000000000001331515606370500256010ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' gem 'leafy-metrics', '0.6.1' jruby-jar-dependencies-92427b1/integration/jars_lock_gemfile/Jarfile000066400000000000000000000001021515606370500256010ustar00rootroot00000000000000# frozen_string_literal: true jar 'org.slf4j:slf4j-simple:1.7.7' jruby-jar-dependencies-92427b1/integration/jars_lock_gemfile/Jars.lock.old000066400000000000000000000002771515606370500266450ustar00rootroot00000000000000io.dropwizard.metrics:metrics-core:3.1.0:compile: io.dropwizard.metrics:metrics-graphite:3.1.0:compile: io.dropwizard.metrics:metrics-jvm:3.1.0:compile: org.slf4j:slf4j-simple:1.7.7:compile: jruby-jar-dependencies-92427b1/integration/jars_lock_gemfile/Mavenfile000066400000000000000000000030721515606370500261440ustar00rootroot00000000000000# frozen_string_literal: true repository id: 'mavengems', url: 'mavengem:https://rubygems.org' # gemfile gem 'leafy-metrics', '0.6.1' gem! 'bundler', '${bundler.version}' phase :test do plugin('org.codehaus.mojo:exec-maven-plugin', '3.5.0', executable: :java, environmentVariables: { 'GEM_HOME' => '${gem.home}', 'GEM_PATH' => '${gem.home}', 'JARS_VERBOSE' => true }) do execute_goal(:exec, id: 'jruby -S lock_jars', arguments: ['-classpath', xml(''), 'org.jruby.Main', '${gem.home}/bin/lock_jars', '--tree']) execute_goal(:exec, id: 'jruby test.rb', arguments: ['-classpath', xml(''), 'org.jruby.Main', 'test.rb']) execute_goal(:exec, id: 'jruby -r jars/setup test.rb', arguments: ['-classpath', xml(''), 'org.jruby.Main', '-rjars/setup', 'test.rb']) end end properties('gem.home' => '${project.basedir}/../rubygems', 'gem.path' => '${gem.home}') jar 'org.jruby:jruby-complete', '${jruby.version}' gem 'jar-dependencies', '${jar-dependencies.version}' gem 'ruby-maven', '${ruby-maven.version}' jruby_plugin :gem, '${jruby.plugins.version}' do execute_goal :initialize end jruby-jar-dependencies-92427b1/integration/jars_lock_gemfile/pom.xml000066400000000000000000000002561515606370500256310ustar00rootroot00000000000000 jar-dependencies.its jars_lock_gemfile 0.0.0 jruby-jar-dependencies-92427b1/integration/jars_lock_gemfile/setup.bsh000066400000000000000000000001461515606370500261500ustar00rootroot00000000000000import java.io.*; new File(basedir, "Jars.lock.old").renameTo(new File(basedir, "Jars.lock")); true; jruby-jar-dependencies-92427b1/integration/jars_lock_gemfile/test.rb000066400000000000000000000003121515606370500256110ustar00rootroot00000000000000# frozen_string_literal: true unless defined? Jars # trigger to require of Jars.lock require 'leafy-metrics' end raise "wrong number of entries in classpath #{$CLASSPATH}" if $CLASSPATH.size != 5 jruby-jar-dependencies-92427b1/integration/jars_lock_gemfile/verify.bsh000066400000000000000000000014571515606370500263220ustar00rootroot00000000000000import java.io.*; import org.codehaus.plexus.util.FileUtils; String log = FileUtils.fileRead( new File( basedir, "build.log" ) ); String expected = "Jars.lock updated"; if ( !log.contains( expected ) ) throw new RuntimeException( "log file does not contain '" + expected + "'" ); String unexpected = "org.jruby:jruby-core:jar:1.7.20:provided"; if ( log.contains( unexpected ) ) throw new RuntimeException( "log file does contain unexpected '" + unexpected + "'" ); expected = "org.slf4j:slf4j-simple:jar:1.7.7:compile"; if ( !log.contains( expected ) ) throw new RuntimeException( "log file does not contain '" + expected + "'" ); expected = "io.dropwizard.metrics:metrics-core:jar:3.1.0:compile"; if ( !log.contains( expected ) ) throw new RuntimeException( "log file does not contain '" + expected + "'" ); jruby-jar-dependencies-92427b1/integration/jars_lock_gemspec_with_jars/000077500000000000000000000000001515606370500263765ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/jars_lock_gemspec_with_jars/Mavenfile000066400000000000000000000036531515606370500302360ustar00rootroot00000000000000# frozen_string_literal: true repository id: 'mavengems', url: 'mavengem:https://rubygems.org' phase :test do plugin('org.codehaus.mojo:exec-maven-plugin', '3.5.0', executable: :java, environmentVariables: { 'GEM_HOME' => '${gem.home}', 'GEM_PATH' => '${gem.home}', 'JARS_VERBOSE' => true }) do # need to uninstall bundler otherwise it finds the Gemfile from the project # root. bundler does descend the directory until it finds a Gemfile. execute_goal(:exec, id: 'jruby -S gem uninstall -a bundler', arguments: ['-classpath', xml(''), 'org.jruby.Main', '-S', 'gem', 'uninstall', '-a', 'bundler']) execute_goal(:exec, id: 'jruby -S lock_jars', arguments: ['-classpath', xml(''), 'org.jruby.Main', '${gem.home}/bin/lock_jars', '--tree']) execute_goal(:exec, id: 'jruby test.rb', arguments: ['-classpath', xml(''), 'org.jruby.Main', 'test.rb']) execute_goal(:exec, id: 'jruby -r jars/setup test.rb', arguments: ['-classpath', xml(''), 'org.jruby.Main', '-rjars/setup', 'test.rb']) end end properties('gem.home' => '${project.basedir}/../rubygems', 'gem.path' => '${gem.home}') jar 'org.jruby:jruby-complete', '${jruby.version}' gem 'jar-dependencies', '${jar-dependencies.version}' gem 'ruby-maven', '${ruby-maven.version}' jruby_plugin :gem, '${jruby.plugins.version}' do execute_goal :initialize end jruby-jar-dependencies-92427b1/integration/jars_lock_gemspec_with_jars/first.gemspec000066400000000000000000000011621515606370500310720ustar00rootroot00000000000000# frozen_string_literal: true Gem::Specification.new do |s| s.name = 'first' s.version = '1.1.1' s.author = 'example person' s.email = ['mail@example.com'] s.summary = 'first gem with jars vendored during installation' s.files << Dir['*file'] s.files << 'first.gemspec' s.platform = 'java' s.required_ruby_version = '>= 2.6' s.add_runtime_dependency 'jar-dependencies', '~> 0.1' s.requirements << "jar 'org.apache.hbase:hbase-annotations', '=0.98.7-hadoop2', ['junit:junit']" s.requirements << 'jar org.jruby:jruby, 1.7.20, :scope => :provided' s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/integration/jars_lock_gemspec_with_jars/pom.xml000066400000000000000000000002701515606370500277120ustar00rootroot00000000000000 jar-dependencies.its jars_lock_gemspec_with_jars 0.0.0 jruby-jar-dependencies-92427b1/integration/jars_lock_gemspec_with_jars/setup.bsh000066400000000000000000000001021515606370500302250ustar00rootroot00000000000000import java.io.*; new File(basedir, "Jars.lock").delete(); true; jruby-jar-dependencies-92427b1/integration/jars_lock_gemspec_with_jars/test.rb000066400000000000000000000007321515606370500277040ustar00rootroot00000000000000# frozen_string_literal: true unless defined? Jars require 'jar-dependencies' # trigger to require of Jars.lock require_jar('org.apache.hbase', 'hbase-annotations', '0.98.7-hadoop2') end ['hbase-annotations-0.98.7-hadoop2.jar', '/tools.jar', 'findbugs-annotations-1.3.9-1.jar', 'log4j-1.2.17.jar'].each do |jar| raise "missing #{jar}" unless $CLASSPATH.detect { |c| c =~ /#{jar}/ } end raise "too many entries in classpath #{$CLASSPATH}" if $CLASSPATH.size != 4 jruby-jar-dependencies-92427b1/integration/jars_lock_gemspec_with_jars/verify.bsh000066400000000000000000000020571515606370500304040ustar00rootroot00000000000000import java.io.*; import org.codehaus.plexus.util.FileUtils; String log = FileUtils.fileRead( new File( basedir, "build.log" ) ); String expected = "Jars.lock created"; if ( !log.contains( expected ) ) throw new RuntimeException( "log file does not contain '" + expected + "'" ); expected = "org.apache.hbase:hbase-annotations:jar:"; if ( !log.contains( expected ) ) throw new RuntimeException( "log file does not contain '" + expected + "'" ); expected = "jdk.tools:jdk.tools:jar:"; if ( !log.contains( expected ) ) throw new RuntimeException( "log file does not contain '" + expected + "'" ); expected = "com.github.stephenc.findbugs:findbugs-annotations:jar:"; if ( !log.contains( expected ) ) throw new RuntimeException( "log file does not contain '" + expected + "'" ); expected = "log4j:log4j:jar:"; if ( !log.contains( expected ) ) throw new RuntimeException( "log file does not contain '" + expected + "'" ); expected = "org.jruby:jruby:jar:"; if ( !log.contains( expected ) ) throw new RuntimeException( "log file does not contain '" + expected + "'" ); jruby-jar-dependencies-92427b1/integration/lock_jars/000077500000000000000000000000001515606370500226215ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/lock_jars/Gemfile000066400000000000000000000002151515606370500241120ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' # needed otherwise the integration test find the one from the parent directory jruby-jar-dependencies-92427b1/integration/lock_jars/Jarfile000066400000000000000000000001121515606370500241120ustar00rootroot00000000000000# frozen_string_literal: true jar 'org.bouncycastle:bcpkix-jdk15on:1.54' jruby-jar-dependencies-92427b1/integration/lock_jars/Jars.lock000066400000000000000000000001341515606370500243700ustar00rootroot00000000000000org.bouncycastle:bcpkix-jdk15on:1.54:compile: org.bouncycastle:bcprov-jdk15on:1.54:compile: jruby-jar-dependencies-92427b1/integration/lock_jars/Mavenfile000066400000000000000000000021621515606370500244530ustar00rootroot00000000000000# frozen_string_literal: true extension 'org.jruby.maven.mojo:mavengem-wagon:2.0.2' repository id: :mavengems, url: 'mavengem:https://rubygems.org' phase :test do plugin('org.codehaus.mojo:exec-maven-plugin', '3.5.0', executable: :java, environmentVariables: { 'JARS_LOCAL_MAVEN_REPO' => '${basedir}/repository', 'GEM_HOME' => '${gem.home}', 'GEM_PATH' => '${gem.home}', 'JARS_VERBOSE' => true }) do execute_goal(:exec, id: 'jruby -S lock_jars', arguments: ['-classpath', xml(''), 'org.jruby.Main', '${gem.home}/bin/lock_jars', '--tree']) end end properties('gem.home' => '${project.basedir}/../rubygems', 'gem.path' => '${gem.home}') jar 'org.jruby:jruby-complete', '${jruby.version}' gem 'jar-dependencies', '${jar-dependencies.version}' gem 'ruby-maven', '${ruby-maven.version}' jruby_plugin :gem, '${jruby.plugins.version}' do execute_goal :initialize end jruby-jar-dependencies-92427b1/integration/lock_jars/setup.bsh000066400000000000000000000006651515606370500244660ustar00rootroot00000000000000import java.io.*; new File(basedir, "repository/org/bouncycastle/bcpkix-jdk15on/1.54/bcpkix-jdk15on-1.54.jar").delete(); new File(basedir, "repository/org/bouncycastle/bcpkix-jdk15on/1.54/bcpkix-jdk15on-1.54.pom").delete(); new File(basedir, "repository/org/bouncycastle/bcprov-jdk15on/1.54/bcprov-jdk15on-1.54.jar").delete(); new File(basedir, "repository/org/bouncycastle/bcprov-jdk15on/1.54/bcprov-jdk15on-1.54.pom").delete(); true; jruby-jar-dependencies-92427b1/integration/lock_jars/verify.bsh000066400000000000000000000017661515606370500246350ustar00rootroot00000000000000import java.io.*; import org.codehaus.plexus.util.FileUtils; String log = FileUtils.fileRead( new File( basedir, "build.log" ) ); String expected = "Jars.lock is up to date"; if ( !log.contains( expected ) ) throw new RuntimeException( "log file does not contain '" + expected + "'" ); File f = new File(basedir, "repository/org/bouncycastle/bcpkix-jdk15on/1.54/bcpkix-jdk15on-1.54.jar"); if (!f.exists()) throw new RuntimeException( "file " + f + " does not exists" ); f = new File(basedir, "repository/org/bouncycastle/bcpkix-jdk15on/1.54/bcpkix-jdk15on-1.54.pom"); if (!f.exists()) throw new RuntimeException( "file " + f + " does not exists" ); f = new File(basedir, "repository/org/bouncycastle/bcprov-jdk15on/1.54/bcprov-jdk15on-1.54.jar"); if (!f.exists()) throw new RuntimeException( "file " + f + " does not exists" ); f = new File(basedir, "repository/org/bouncycastle/bcprov-jdk15on/1.54/bcprov-jdk15on-1.54.pom"); if (!f.exists()) throw new RuntimeException( "file " + f + " does not exists" ); jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/000077500000000000000000000000001515606370500275625ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/Mavenfile000066400000000000000000000014371515606370500314200ustar00rootroot00000000000000# frozen_string_literal: true packaging 'jar' gem 'jar-dependencies', '${jar-dependencies.version}' jruby_plugin :gem, '${jruby.plugins.version}' do execute_goal :initialize end pom 'org.jruby:jruby', '${jruby.version}' plugin('org.codehaus.mojo:exec-maven-plugin', '3.5.0', executable: :java, environmentVariables: { 'GEM_HOME' => '${gem.home}', 'GEM_PATH' => '${gem.home}' }) do execute_goal(:exec, id: 'no more warnings', phase: :test, arguments: ['-classpath', xml(''), 'org.jruby.Main', 'test.rb']) end properties('gem.home' => '${project.basedir}/pkg/rubygems', 'gem.path' => '${gem.home}') jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/jline/000077500000000000000000000000001515606370500306635ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/jline/jline/000077500000000000000000000000001515606370500317645ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/jline/jline/2.11/000077500000000000000000000000001515606370500323455ustar00rootroot00000000000000jline-2.11.jar000066400000000000000000000005251515606370500344460ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/jline/jline/2.11PKҤEC META-INF/PKPKҤECMETA-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMu *h%&*8%krrPKGCDPKҤEC META-INF/PKҤECGCD=META-INF/MANIFEST.MFPK}jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/org/000077500000000000000000000000001515606370500303515ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/org/example/000077500000000000000000000000001515606370500320045ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/org/example/nested/000077500000000000000000000000001515606370500332665ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/org/example/nested/1.0/000077500000000000000000000000001515606370500335645ustar00rootroot00000000000000nested-1.0.jar000066400000000000000000000007331515606370500357640ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/org/example/nested/1.0PK]]G META-INF/PKPK]]GMETA-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMu Xě*h%&*8%krrPK6K^CDPK]]G Jars.lockKFzV9V\PK]PK]]G META-INF/PK]]G6K^CD=META-INF/MANIFEST.MFPK]]G] Jars.lockPKjruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/src/000077500000000000000000000000001515606370500303515ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/src/main/000077500000000000000000000000001515606370500312755ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/src/main/resources/000077500000000000000000000000001515606370500333075ustar00rootroot00000000000000Jars.lock000066400000000000000000000000371515606370500350010ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/src/main/resourcesorg.example:nested:1.0:compile:jruby-jar-dependencies-92427b1/integration/nested_jars_lock_from_classloader/test.rb000066400000000000000000000006141515606370500310670ustar00rootroot00000000000000# frozen_string_literal: true require 'jar-dependencies' require 'minitest/autorun' basedir = ENV_JAVA['jars.home'] = __dir__ describe Jars do it 'requires Jars.lock from required jars' do Jars.require_jars_lock $CLASSPATH.collect do |c| c.sub(%r{file:#{basedir}/}, '') end.must_equal ['org/example/nested/1.0/nested-1.0.jar', 'jline/jline/2.11/jline-2.11.jar'] end end jruby-jar-dependencies-92427b1/integration/require_tests/000077500000000000000000000000001515606370500235505ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/require_tests/Mavenfile000066400000000000000000000026661515606370500254130ustar00rootroot00000000000000# frozen_string_literal: true packaging 'pom' gem 'jar-dependencies', '${jar-dependencies.version}' jruby_plugin :gem, '${jruby.plugins.version}' do execute_goal :initialize end pom 'org.jruby:jruby', '${jruby.version}' plugin('org.codehaus.mojo:exec-maven-plugin', '3.5.0', executable: :java, environmentVariables: { 'GEM_HOME' => '${gem.home}', 'GEM_PATH' => '${gem.home}' }) do execute_goal(:exec, id: 'no more warnings', phase: :test, arguments: ['-classpath', xml(''), 'org.jruby.Main', 'test_no_more_warnings.rb']) execute_goal(:exec, id: 'freeze loading', phase: :test, arguments: ['-classpath', xml(''), 'org.jruby.Main', 'test_freeze_loading.rb']) execute_goal(:exec, id: 'ignore gemspec on require_jar', phase: :test, arguments: ['-classpath', xml(''), 'org.jruby.Main', '-I.', '-rjar-dependencies', '-e', 'require_jar "jline", "jline", "2.11"']) end properties('gem.home' => '${project.basedir}/pkg/rubygems', 'gem.path' => '${gem.home}') jruby-jar-dependencies-92427b1/integration/require_tests/jline/000077500000000000000000000000001515606370500246515ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/require_tests/jline/jline/000077500000000000000000000000001515606370500257525ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/require_tests/jline/jline/2.11/000077500000000000000000000000001515606370500263335ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/require_tests/jline/jline/2.11/jline-2.11.jar000066400000000000000000000005251515606370500305130ustar00rootroot00000000000000PKҤEC META-INF/PKPKҤECMETA-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMu *h%&*8%krrPKGCDPKҤEC META-INF/PKҤECGCD=META-INF/MANIFEST.MFPK}jruby-jar-dependencies-92427b1/integration/require_tests/test_freeze_loading.rb000066400000000000000000000005341515606370500301130ustar00rootroot00000000000000# frozen_string_literal: true require 'jar-dependencies' Jars.freeze_loading raise 'expected no env variable for freeze' if ENV[Jars::NO_REQUIRE] raise 'expected no bouncycastle jars in classpath' if $CLASSPATH.detect { |c| c.include?('bouncycastle') } begin require 'openssl' raise 'expected LoadError' rescue LoadError # expected end jruby-jar-dependencies-92427b1/integration/require_tests/test_no_more_warnings.rb000066400000000000000000000010541515606370500305020ustar00rootroot00000000000000# frozen_string_literal: true require 'jar-dependencies' Jars.no_more_warnings raise 'expected no env variable for freeze' if ENV[Jars::NO_REQUIRE] raise 'expected no bouncycastle jars in classpath' if $CLASSPATH.detect { |c| c.include?('bouncycastle') } require 'openssl' raise 'did not find bouncycastle jars' unless $CLASSPATH.detect { |c| c.include?('bouncycastle') } $stderr = StringIO.new require_jar 'org.bouncycastle', 'bcpkix-jdk15on', '1.46' raise 'no warning on jar conflics after freeze' unless $stderr.string.empty? $stderr = STDERR jruby-jar-dependencies-92427b1/integration/vendor_jars/000077500000000000000000000000001515606370500231665ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/vendor_jars/Gemfile000066400000000000000000000002151515606370500244570ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' # needed otherwise the integration test find the one from the parent directory jruby-jar-dependencies-92427b1/integration/vendor_jars/Mavenfile000066400000000000000000000017741515606370500250300ustar00rootroot00000000000000# frozen_string_literal: true extension 'org.jruby.maven.mojo:mavengem-wagon:2.0.2' repository id: :mavengems, url: 'mavengem:https://rubygems.org' phase :test do plugin('org.codehaus.mojo:exec-maven-plugin', '3.5.0', executable: :java, environmentVariables: { 'GEM_HOME' => '${gem.home}', 'GEM_PATH' => '${gem.home}', 'JARS_VERBOSE' => true }) do execute_goal(:exec, id: 'jruby test.rb', arguments: ['-classpath', xml(''), 'org.jruby.Main', 'test.rb']) end end properties('gem.home' => '${project.basedir}/../rubygems', 'gem.path' => '${gem.home}') jar 'org.jruby:jruby-complete', '${jruby.version}' gem 'jar-dependencies', '${jar-dependencies.version}' gem 'ruby-maven', '${ruby-maven.version}' jruby_plugin :gem, '${jruby.plugins.version}' do execute_goal :initialize end jruby-jar-dependencies-92427b1/integration/vendor_jars/lib/000077500000000000000000000000001515606370500237345ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/vendor_jars/lib/.empty000066400000000000000000000000001515606370500250610ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/integration/vendor_jars/my.gemspec000066400000000000000000000041561515606370500251660ustar00rootroot00000000000000# frozen_string_literal: true Gem::Specification.new do |s| # this is only needed to retrieve the latest version of jar-dependencies # so this can run as integration-test version = ENV_JAVA['jar-dependencies.version'] || '0.3.0' s.name = 'example' s.version = '2' s.author = 'example person' s.email = ['mail@example.com'] s.summary = 'gem with jar' s.description = 'gem with empty jar and jar dependencies' # important so jar-dependencies knows it should look for # jar declarations in the requirements section ! s.platform = 'java' s.files << Dir['lib/**/*.rb'] s.files << 'lib/example.jar' s.files << Dir['*file'] s.files << 'example.gemspec' s.required_ruby_version = '>= 2.6' # constrain the version of jar-dependencies itself s.add_runtime_dependency 'jar-dependencies', "~> #{version}" # the jar declarations s.requirements << 'jar org.bouncycastle:bcpkix-jdk15on, 1.49' s.requirements << 'jar org.bouncycastle:bcprov-jdk15on, 1.49' s.requirements << 'jar org.slf4j:slf4j-api, 1.7.7' # dependency where some transitive dependency gets excluded (jruby comes # with joda-time already bundled and this can cause classloader conflicts. # better just use the version of joda-time from jruby and hope it is # compatible) s.requirements << 'jar io.dropwizard:dropwizard-logging, 0.8.0-rc5, :exclusions=> [ joda-time:joda-time ]' # a jar dependency with a classifier s.requirements << 'jar com.google.protobuf:protobuf-java, 2.2.0, :classifier => lite' # needed for the tests s.requirements << 'jar junit:junit:4.12, :scope => :test' # this is part of the test and assumed to be provided during runtime s.requirements << 'jar org.slf4j:slf4j-simple, 1.7.7, :scope => :provided' s.add_development_dependency 'rake', '~> 10.3' s.add_development_dependency 'rspec', '~> 2.14' # needed to compile src/main/java/** into lib/example.jar s.add_development_dependency 'rake-compiler', '~> 0.9' # avoids to install it on the fly when jar-dependencies needs it s.add_development_dependency 'ruby-maven', '~> 3.9', '>= 3.9.3' s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/integration/vendor_jars/setup.bsh000066400000000000000000000006271515606370500250310ustar00rootroot00000000000000import java.io.*; new File(basedir, "lib/com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar").delete(); new File(basedir, "lib/com/google/guava/guava/18.0/guava-18.0.jar").delete(); new File(basedir, "lib/org/glassfish/javax.el/3.0.0/javax.el-3.0.0.jar").delete(); new File(basedir, "lib/com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar").delete(); new File(basedir, "lib/example_jars.rb").delete(); true; jruby-jar-dependencies-92427b1/integration/vendor_jars/test.rb000066400000000000000000000001251515606370500244700ustar00rootroot00000000000000# frozen_string_literal: true require 'jars/installer' Jars::Installer.vendor_jars! jruby-jar-dependencies-92427b1/integration/vendor_jars/verify.bsh000066400000000000000000000020551515606370500251720ustar00rootroot00000000000000import java.io.*; import org.codehaus.plexus.util.FileUtils; String log = FileUtils.fileRead( new File( basedir, "build.log" ) ); String expected = "exclusions: joda-time:joda-time"; if ( !log.contains( expected ) ) throw new RuntimeException( "log file does not contain '" + expected + "'" ); File f = new File(basedir, "lib/example_jars.rb"); if (!f.exists()) throw new RuntimeException( "file " + f + " does not exists" ); f = new File(basedir, "lib/com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar"); if (!f.exists()) throw new RuntimeException( "file " + f + " does not exists" ); f = new File(basedir, "lib/com/google/guava/guava/18.0/guava-18.0.jar"); if (!f.exists()) throw new RuntimeException( "file " + f + " does not exists" ); f = new File(basedir, "lib/org/glassfish/javax.el/3.0.0/javax.el-3.0.0.jar"); if (!f.exists()) throw new RuntimeException( "file " + f + " does not exists" ); f = new File(basedir, "lib/com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar"); if (!f.exists()) throw new RuntimeException( "file " + f + " does not exists" ); jruby-jar-dependencies-92427b1/jar-dependencies.gemspec000066400000000000000000000026121515606370500230750ustar00rootroot00000000000000# frozen_string_literal: true require_relative 'lib/jars/version' Gem::Specification.new do |s| s.name = 'jar-dependencies' s.version = Jars::VERSION s.author = 'christian meier' s.email = ['mkristian@web.de'] s.summary = 'manage jar dependencies for gems' s.homepage = 'https://github.com/jruby/jar-dependencies' s.bindir = 'exe' s.executables = [lock_jars = 'lock_jars'] s.license = 'MIT' s.files = Dir['{lib}/**/*'] + %w[Mavenfile Rakefile Readme.md jar-dependencies.gemspec MIT-LICENSE] s.description = <<~TEXT manage jar dependencies for gems and keep track which jar was already loaded using maven artifact coordinates. it warns on version conflicts and loads only ONE jar assuming the first one is compatible to the second one otherwise your project needs to lock down the right version by providing a Jars.lock file. TEXT s.required_ruby_version = '>= 2.6' s.add_development_dependency 'minitest', '~> 5.10' s.add_development_dependency 'ruby-maven', ruby_maven_version = '~> 3.9' s.post_install_message = <<~TEXT if you want to use the executable #{lock_jars} then install ruby-maven gem before using #{lock_jars} $ gem install ruby-maven -v '#{ruby_maven_version}' or add it as a development dependency to your Gemfile gem 'ruby-maven', '#{ruby_maven_version}' TEXT s.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/lib/000077500000000000000000000000001515606370500170755ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/lib/jar-dependencies.rb000066400000000000000000000022031515606370500226170ustar00rootroot00000000000000# frozen_string_literal: true # # Copyright (C) 2014 Christian Meier # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of # the Software, and to permit persons to whom the Software is furnished to do so, # subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # require 'jar_dependencies' jruby-jar-dependencies-92427b1/lib/jar_dependencies.rb000066400000000000000000000254041515606370500227110ustar00rootroot00000000000000# frozen_string_literal: true # # Copyright (C) 2014 Christian Meier # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of # the Software, and to permit persons to whom the Software is furnished to do so, # subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # module Jars unless defined? Jars::SKIP_LOCK MAVEN_SETTINGS = 'JARS_MAVEN_SETTINGS' LOCAL_MAVEN_REPO = 'JARS_LOCAL_MAVEN_REPO' # lock file to use LOCK = 'JARS_LOCK' # where the locally stored jars are search for or stored HOME = 'JARS_HOME' # skip the gem post install hook SKIP = 'JARS_SKIP' # skip Jars.lock mainly to run lock_jars SKIP_LOCK = 'JARS_SKIP_LOCK' # do not require any jars if set to false REQUIRE = 'JARS_REQUIRE' # @private NO_REQUIRE = 'JARS_NO_REQUIRE' # no more warnings on conflict. this still requires jars but will # not warn. it is needed to load jars from (default) gems which # do contribute to any dependency manager (maven, gradle, jbundler) QUIET = 'JARS_QUIET' # show maven output VERBOSE = 'JARS_VERBOSE' # maven debug DEBUG = 'JARS_DEBUG' # vendor jars inside gem when installing gem VENDOR = 'JARS_VENDOR' # string used when the version is unknown UNKNOWN = 'unknown' end autoload :MavenSettings, 'jars/maven_settings' autoload :Classpath, 'jars/classpath' @jars_lock = false @jars = {} class << self def lock_down(debug: false, verbose: false, **kwargs) ENV[SKIP_LOCK] = 'true' require 'jars/lock_down' # do this lazy to keep things clean Jars::LockDown.new(debug, verbose).lock_down(kwargs.delete(:vendor_dir), **kwargs) ensure ENV[SKIP_LOCK] = nil end if defined? JRUBY_VERSION def to_prop(key) key = key.tr('_', '.') ENV_JAVA[(key.downcase! key)] || ENV[(key.tr!('.', '_') key.upcase! key)] end else def to_prop(key) ENV[key.tr('.', '_').upcase] end end def to_boolean(key) return nil if (prop = to_prop(key)).nil? prop.empty? || prop.eql?('true') end def skip? to_boolean(SKIP) end def require? if @require.nil? if (require = to_boolean(REQUIRE)).nil? no_require = to_boolean(NO_REQUIRE) @require = no_require.nil? ? true : !no_require else @require = require end end @require end attr_writer :require def quiet? @quiet = to_boolean(QUIET) if @quiet.nil? @quiet end def no_more_warnings @quiet = true end def jarfile ENV['JARFILE'] || ENV_JAVA['jarfile'] || ENV['JBUNDLER_JARFILE'] || ENV_JAVA['jbundler.jarfile'] || 'Jarfile' end def verbose? to_boolean(VERBOSE) end def debug? to_boolean(DEBUG) end def vendor? to_boolean(VENDOR) end def freeze_loading self.require = false end def skip_lock? to_prop(SKIP_LOCK) || false end def lock @lock ||= to_prop(LOCK) || 'Jars.lock' end def jars_lock_from_class_loader return unless defined?(JRUBY_VERSION) if JRuby::Util.respond_to?(:class_loader_resources) JRuby::Util.class_loader_resources('Jars.lock') else require 'jruby' JRuby.runtime.jruby_class_loader.get_resources('Jars.lock').collect(&:to_s) end end def lock_path(basedir = nil) return lock if File.exist?(lock) basedir ||= '.' ['.', 'jars', 'vendor/jars'].each do |dir| file = File.join(basedir, dir, lock) return file if File.exist?(file) end nil end def reset instance_variables.each do |var| next if var == :@jars_lock instance_variable_set(var, nil) end Jars::MavenSettings.reset @jars = {} end def maven_local_settings Jars::MavenSettings.local_settings end def maven_user_settings Jars::MavenSettings.user_settings end def maven_settings Jars::MavenSettings.settings end def maven_global_settings Jars::MavenSettings.global_settings end def local_maven_repo @local_maven_repo ||= absolute(to_prop(LOCAL_MAVEN_REPO)) || detect_local_repository(maven_local_settings) || detect_local_repository(maven_user_settings) || detect_local_repository(maven_global_settings) || File.join(user_home, '.m2', 'repository') end def home @home ||= absolute(to_prop(HOME)) || local_maven_repo end def require_jars_lock!(scope = :runtime) urls = jars_lock_from_class_loader if to_prop(LOCK).nil? if urls && !urls.empty? @jars_lock = true done = [] while done != urls urls.each do |url| next if done.member?(url) Jars.debug { "--- load jars from uri #{url}" } classpath = Jars::Classpath.new(nil, "uri:#{url}") classpath.require(scope) done << url end end no_more_warnings elsif (jars_lock = Jars.lock_path) Jars.debug { "--- load jars from #{jars_lock}" } @jars_lock = jars_lock classpath = Jars::Classpath.new(nil, jars_lock) classpath.require(scope) no_more_warnings end Jars.debug do loaded = @jars.collect { |k, v| "#{k}:#{v}" } "--- loaded jars ---\n\t#{loaded.join("\n\t")}" end end def setup(options = nil) case options when Symbol require_jars_lock!(options) when Hash @home = options[:jars_home] @lock = options[:jars_lock] require_jars_lock!(options[:scope] || :runtime) else require_jars_lock! end end def require_jars_lock return if @jars_lock require_jars_lock! @jars_lock ||= true # rubocop:disable Naming/MemoizedInstanceVariableName end def mark_as_required(group_id, artifact_id, *classifier_version) require_jar_with_block(group_id, artifact_id, *classifier_version) do # ignore end end def require_jar(group_id, artifact_id, *classifier_version) require_jars_lock unless skip_lock? if classifier_version.empty? && block_given? classifier_version = [yield].compact return mark_as_required(group_id, artifact_id, UNKNOWN) || false if classifier_version.empty? end require_jar_with_block(group_id, artifact_id, *classifier_version) do |gid, aid, version, classifier| do_require(gid, aid, version, classifier) end end def warn(msg = nil) return if (verbose? == nil && quiet?) || (verbose? == false && !debug?) Kernel.warn(msg || yield) end def debug(msg = nil) return unless debug? msg = "#{msg.inspect}\n\t#{(msg.backtrace || []).join("\n\t")}" if msg.is_a?(Exception) Kernel.warn(msg || yield) end def absolute(file) File.expand_path(file) if file end def user_home ENV['HOME'] || begin user_home = Dir.home if Dir.respond_to?(:home) user_home = ENV_JAVA['user.home'] if !user_home && Object.const_defined?(:ENV_JAVA) user_home end end private def require_jar_with_block(group_id, artifact_id, *classifier_version) version = classifier_version[-1] classifier = classifier_version[-2] coordinate = +"#{group_id}:#{artifact_id}" coordinate << ":#{classifier}" if classifier if @jars.key? coordinate if @jars[coordinate] == version false else @jars[coordinate] # version of already registered jar end else yield group_id, artifact_id, version, classifier @jars[coordinate] = version true end end def detect_local_repository(settings) return nil unless settings doc = File.read(settings) # TODO: filter out xml comments local_repo = doc.sub(%r{.*}m, '').sub(/.*/m, '') # replace maven like system properties embedded into the string local_repo.gsub!(/\$\{[a-zA-Z.]+\}/) do |a| ENV_JAVA[a[2..-2]] || a end local_repo = nil if local_repo.empty? || !File.exist?(local_repo) local_repo rescue => e Jars.debug(e) Jars.warn "error reading or parsing local settings from: #{settings}" nil end def to_jar(group_id, artifact_id, version, classifier = nil) file = +"#{group_id.tr('.', '/')}/#{artifact_id}/#{version}/#{artifact_id}-#{version}" file << "-#{classifier}" if classifier file << '.jar' file end def do_require(*args) jar = to_jar(*args) # use jar from PWD/vendor/jars if exists if File.exist?(vendor = File.join(Dir.pwd, 'vendor', 'jars', jar)) require vendor # use jar from PWD/jars if exists elsif File.exist?(local = File.join(Dir.pwd, 'jars', jar)) require local # use jar from local repository if exists elsif File.exist?(file = File.join(home, jar)) require file else # otherwise try to find it on the load path require jar end rescue LoadError => e raise "\n\n\tyou might need to reinstall the gem which depends on the " \ 'missing jar or in case there is Jars.lock then resolve the jars with ' \ "`lock_jars` command\n\n#{e.message} (LoadError)" end end end def require_jar(*args, &block) return nil unless Jars.require? result = Jars.require_jar(*args, &block) if result.is_a? String args << (yield || Jars::UNKNOWN) if args.size == 2 && block Jars.warn do "--- jar coordinate #{args[0..-2].join(':')} already loaded with version #{result} - omit version #{args[-1]}" end Jars.debug { " try to load from #{caller.join("\n\t")}" } return false end Jars.debug { " register #{args.inspect} - #{result == true}" } result end jruby-jar-dependencies-92427b1/lib/jar_install_post_install_hook.rb000066400000000000000000000022101515606370500255320ustar00rootroot00000000000000# frozen_string_literal: true # # Copyright (C) 2014 Christian Meier # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of # the Software, and to permit persons to whom the Software is furnished to do so, # subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # require 'jars/post_install_hook' jruby-jar-dependencies-92427b1/lib/jars/000077500000000000000000000000001515606370500200345ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/lib/jars/attach_jars_pom.rb000066400000000000000000000012201515606370500235120ustar00rootroot00000000000000# frozen_string_literal: true # this file is maven DSL 10_000.times do |i| coord = ENV_JAVA["jars.#{i}"] break unless coord artifact = Maven::Tools::Artifact.from_coordinate(coord) exclusions = [] 10_000.times do |j| exclusion = ENV_JAVA["jars.#{i}.exclusions.#{j}"] break unless exclusion exclusions << exclusion end scope = ENV_JAVA["jars.#{i}.scope"] artifact.scope = scope if scope classifier = ENV_JAVA["jars.#{i}.classifier"] artifact.classifier = classifier if classifier # declare the artifact inside the POM dependency_artifact(artifact) do exclusions.each do |ex| exclusion ex end end end jruby-jar-dependencies-92427b1/lib/jars/classpath.rb000066400000000000000000000037471515606370500223560ustar00rootroot00000000000000# frozen_string_literal: true require 'jars/maven_exec' require 'jars/lock' require 'fileutils' module Jars class Classpath # convenient method def self.require(scope = nil) new.require(scope) end # convenient method def self.classpath(scope = nil) new.classpath(scope) end # convenient method def self.classpath_string(scope = nil) new.classpath_string(scope) end def initialize(spec = nil, deps = nil) @spec = spec @deps = deps end def mvn @mvn ||= MavenExec.new(@spec) end def workdir(dirname) dir = File.join(mvn.basedir, dirname) dir if File.directory?(dir) end def dependencies_list if @deps.nil? deps = Jars.lock_path(mvn.basedir) @deps = deps if deps && File.exist?(deps) end @deps || resolve_dependencies end private :dependencies_list DEPENDENCY_LIST = 'dependencies.list' def resolve_dependencies basedir = workdir('pkg') || workdir('target') || workdir('') deps = File.join(basedir, DEPENDENCY_LIST) mvn.resolve_dependencies_list(deps) deps end private :resolve_dependencies def require(scope = nil) process(scope) do |jar| if jar.scope == :system Kernel.require jar.path else require_jar(*jar.gacv) end end return unless scope.nil? || scope == :runtime process(:provided) do |jar| Jars.mark_as_required(*jar.gacv) end end def classpath(scope = nil) classpath = [] process(scope) do |jar| classpath << jar.file end classpath end def process(scope, &block) deps = dependencies_list Lock.new(deps).process(scope, &block) ensure # just delete the temporary file if it exists FileUtils.rm_f(DEPENDENCY_LIST) end private :process def classpath_string(scope = nil) classpath(scope).join(File::PATH_SEPARATOR) end end end jruby-jar-dependencies-92427b1/lib/jars/gemspec_artifacts.rb000066400000000000000000000132571515606370500240540ustar00rootroot00000000000000# frozen_string_literal: true module Jars class MavenVersion < String class << self def new(*args) if args.empty? || (args.size == 1 && args[0].nil?) nil else low, high = convert(args[0]) low, high = convert(args[1], low, high) if /[=~><]/.match?(args[1]) if low == high low else super "#{low || '[0'},#{high || ')'}" end end end private def convert(arg, low = nil, high = nil) if arg.include?('~>') val = arg.sub(/~>\s*/, '') last = val.include?('.') ? val.sub(/\.[0-9]*[a-z]+.*$/, '').sub(/\.[^.]+$/, '.99999') : '99999' ["[#{snapshot_version(val)}", "#{snapshot_version(last)}]"] elsif arg.include?('>=') val = arg.sub(/>=\s*/, '') ["[#{snapshot_version(val)}", (nil || high)] elsif arg.include?('<=') val = arg.sub(/<=\s*/, '') [(nil || low), "#{snapshot_version(val)}]"] # treat '!' the same way as '>' since maven can not describe such range elsif /[!>]/.match?(arg) val = arg.sub(/[!>]\s*/, '') ["(#{snapshot_version(val)}", (nil || high)] elsif arg.include?('<') val = arg.sub(/<\s*/, '') [(nil || low), "#{snapshot_version(val)})"] elsif arg.include?('=') val = arg.sub(/=\s*/, '') # for prereleased version pick the maven version (no version range) if /[a-z]|[A-Z]/.match?(val) [val, val] else ["[#{val}", "#{val}.0.0.0.0.1)"] end else # no conversion here, i.e. assume maven version [arg, arg] end end def snapshot_version(val) if val.match(/[a-z]|[A-Z]/) && !val.match(/-SNAPSHOT|[${}]/) "#{val}-SNAPSHOT" else val end end end end class GemspecArtifacts class Exclusion attr_reader :group_id, :artifact_id def initialize(line) @group_id, @artifact_id = line.gsub(/['"]/, '').strip.split(':') @artifact_id.strip! end def to_s "#{@group_id}:#{@artifact_id}" end end class Exclusions < Array def to_s "[#{join(', ')}]" end def initialize(line) super() line.gsub(/'"|^\s*\[|\]\s*$/, '').split(/,\s*/).each do |exclusion| self << Exclusion.new(exclusion) end freeze end end class Artifact attr_reader :type, :group_id, :artifact_id, :classifier, :version, :scope, :exclusions ALLOWED_TYPES = %w[jar pom].freeze def initialize(options, *args) @type, @group_id, @artifact_id, @classifier, @version, @exclusions = *args options.each do |k, v| instance_variable_set(:"@#{k}", v) end end def self.new(line) line = line.strip index = line.index(/\s/) return nil if index.nil? type = line[0..index].strip return nil unless ALLOWED_TYPES.member?(type) line = line[index..] line.gsub!(/['"]/, '') line.strip! options = {} line.sub!(/,\s*:exclusions\s*(:|=>)\s*(\[[^\]]+\])/) do options[:exclusions] = Exclusions.new(Regexp.last_match(2).strip) '' end line.sub!(/,\s*:([a-z]+)\s*(:|=>)\s*(:?[a-zA-Z0-9_]+)/) do options[Regexp.last_match(1).to_sym] = Regexp.last_match(3).sub(/^:/, '') '' end exclusions = nil line.sub!(/[,:]\s*\[(.+:.+,?\s*)+\]$/) do |a| exclusions = Exclusions.new(a[1..].strip) '' end line.strip! line.gsub!(/,\s*/, ':') if /[\[()\]]/.match?(line) index = line.index(/[\[(].+$/) version = line[index..].sub(/:/, ', ') line = line[0..index - 1].strip.sub(/:$/, '') else index = line.index(/:[^:]+$/) version = line[index + 1..] line = line[0..index - 1].strip end case line.count(':') when 2 group_id, artifact_id, classifier = line.split(':') when 1 group_id, artifact_id = line.split(':') classifier = nil else warn line return nil end super(options, type, group_id, artifact_id, classifier, version, exclusions) end def to_s args = [@group_id, @artifact_id] args << @classifier if @classifier args << @version args << @exclusions.to_s if @exclusions "#{@type} #{group_id}:#{args[1..].join(', ')}" end def to_gacv args = [@group_id, @artifact_id] args << @classifier if @classifier args << @version args.join(':') end def to_coord_no_classifier args = [@group_id, @artifact_id] args << @type args << MavenVersion.new(@version) args.join(':') end def to_coord args = [@group_id, @artifact_id] args << @classifier if @classifier args << @type args << MavenVersion.new(@version) args.join(':') end def key args = [@group_id, @artifact_id] args << @classifier if @classifier args.join(':') end end attr_reader :artifacts def initialize(spec) @artifacts = [] spec.requirements.each do |req| req.split("\n").each do |line| if (a = Artifact.new(line)) @artifacts << a end end end @artifacts.freeze end def [](index) @artifacts[index] end def each(&block) @artifacts.each(&block) end def size @artifacts.size end end end jruby-jar-dependencies-92427b1/lib/jars/gemspec_pom.rb000066400000000000000000000004411515606370500226560ustar00rootroot00000000000000# frozen_string_literal: true # this file is maven DSL and used by maven via jars/maven_exec.rb def eval_file(file) file = File.join(__dir__, file) eval(File.read(file), nil, file) # rubocop:disable Security/Eval end eval_file('attach_jars_pom.rb') eval_file('output_jars_pom.rb') jruby-jar-dependencies-92427b1/lib/jars/installer.rb000066400000000000000000000143211515606370500223570ustar00rootroot00000000000000# frozen_string_literal: true require 'jar_dependencies' require 'jars/maven_exec' module Jars class Installer class Dependency attr_reader :path, :file, :gav, :scope, :type, :coord def self.new(line) super if /:jar:|:pom:/.match?(line) end def setup_type(line) if line.index(':pom:') @type = :pom elsif line.index(':jar:') @type = :jar end end private :setup_type def setup_scope(line) @scope = case line when /:provided:/ :provided when /:test:/ :test else :runtime end end private :setup_scope REG = /:jar:|:pom:|:test:|:compile:|:runtime:|:provided:|:system:/.freeze EMPTY = '' def initialize(line) # remove ANSI escape sequences and module section (https://issues.apache.org/jira/browse/MDEP-974) line = line.gsub(/\e\[\d*m/, '') line = line.gsub(/ -- module.*/, '') setup_type(line) line.strip! @coord = line.sub(/:[^:]+:([A-Z]:\\)?[^:]+$/, EMPTY) first, second = @coord.split(/:#{type}:/) group_id, artifact_id = first.split(':') parts = group_id.split('.') parts << artifact_id parts << second.split(':')[-1] @file = line.slice(@coord.length, line.length).sub(REG, EMPTY).strip last = @file.reverse.index(%r{\\|/}) parts << line[-last..] @path = File.join(parts).strip setup_scope(line) @system = !line.index(':system:').nil? @gav = @coord.sub(REG, ':') end def system? @system end end def self.install_jars(write_require_file: false) new.install_jars(write_require_file: write_require_file) end def self.load_from_maven(file) result = [] File.read(file).each_line do |line| dep = Dependency.new(line) result << dep if dep && dep.scope == :runtime end result end def self.vendor_file(dir, dep) return unless !dep.system? && dep.type == :jar && dep.scope == :runtime vendored = File.join(dir, dep.path) FileUtils.mkdir_p(File.dirname(vendored)) FileUtils.cp(dep.file, vendored) end def self.print_require_jar(file, dep, fallback: false) return if dep.type != :jar || dep.scope != :runtime if dep.system? file&.puts("require '#{dep.file}'") elsif dep.scope == :runtime if fallback file&.puts(" require '#{dep.path}'") else file&.puts(" require_jar '#{dep.gav.gsub(':', "', '")}'") end end end COMMENT = '# this is a generated file, to avoid over-writing it just delete this comment' def self.needs_to_write?(require_filename) require_filename && (!File.exist?(require_filename) || File.read(require_filename).match(COMMENT)) end def self.write_require_jars(deps, require_filename) return unless needs_to_write?(require_filename) FileUtils.mkdir_p(File.dirname(require_filename)) File.open(require_filename, 'w') do |f| f.puts COMMENT f.puts 'begin' f.puts " require 'jar_dependencies'" f.puts 'rescue LoadError' deps.each do |dep| # do not use require_jar method print_require_jar(f, dep, fallback: true) end f.puts 'end' f.puts f.puts 'if defined? Jars' deps.each do |dep| print_require_jar(f, dep) end f.puts 'end' end end def self.vendor_jars(deps, dir) deps.each do |dep| vendor_file(dir, dep) end end def initialize(spec = nil) @mvn = MavenExec.new(spec) end def spec @mvn.spec end def vendor_jars(vendor_dir = nil, write_require_file: true) return unless jars? if Jars.to_prop(Jars::VENDOR) == 'false' vendor_dir = nil else vendor_dir ||= spec.require_path end do_install(vendor_dir, write_require_file) end def self.vendor_jars!(vendor_dir = nil) new.vendor_jars!(vendor_dir) end def vendor_jars!(vendor_dir = nil, write_require_file: true) vendor_dir ||= spec.require_path do_install(vendor_dir, write_require_file) end def install_jars(write_require_file: true) return unless jars? do_install(nil, write_require_file) end def ruby_maven_install_options=(options) @mvn.ruby_maven_install_options = options end def jars? # first look if there are any requirements in the spec # and then if gem depends on jar-dependencies for runtime. # only then install the jars declared in the requirements result = (spec = self.spec) && !spec.requirements.empty? && spec.dependencies.detect { |d| d.name == 'jar-dependencies' && d.type == :runtime } if result && spec.platform.to_s != 'java' Jars.warn "\njar dependencies found on non-java platform gem - do not install jars\n" false else result end end private def do_install(vendor_dir, write_require_file) if !spec.require_paths.include?(vendor_dir) && vendor_dir raise "vendor dir #{vendor_dir} not in require_paths of gemspec #{spec.require_paths}" end target_dir = File.join(@mvn.basedir, vendor_dir || spec.require_path) jars_file = File.join(target_dir, "#{spec.name}_jars.rb") # write out new jars_file it write_require_file is true or # check timestamps: # do not generate file if specfile is older then the generated file if !write_require_file && File.exist?(jars_file) && File.mtime(@mvn.specfile) < File.mtime(jars_file) # leave jars_file as is jars_file = nil end deps = install_dependencies self.class.write_require_jars(deps, jars_file) self.class.vendor_jars(deps, target_dir) if vendor_dir end def install_dependencies deps = File.join(@mvn.basedir, 'deps.lst') puts " jar dependencies for #{spec.spec_name} . . ." unless Jars.quiet? @mvn.resolve_dependencies_list(deps) self.class.load_from_maven(deps) ensure FileUtils.rm_f(deps) if deps end end end jruby-jar-dependencies-92427b1/lib/jars/lock.rb000066400000000000000000000030311515606370500213060ustar00rootroot00000000000000# frozen_string_literal: true require 'jars/maven_exec' module Jars class JarDetails < Array def scope self[-2].to_sym end def file file = self[-1].strip file.empty? ? path : file end def group_id self[0] end def artifact_id self[1] end def version self[-3] end def classifier return nil if size == 5 self[2] end def gacv classifier ? self[0..3] : self[0..2] end def path if scope == :system # replace maven like system properties embedded into the string self[-1].gsub(/\$\{[a-zA-Z.]+\}/) do |a| ENV_JAVA[a[2..-2]] || a end else File.join(Jars.home, group_id.gsub(/[.]/, '/'), artifact_id, version, "#{gacv[1..].join('-')}.jar") end end end class Lock def initialize(file) @file = file end def process(scope) scope ||= :runtime File.read(@file).each_line do |line| next unless /:.+:/.match?(line) jar = JarDetails.new(line.strip.sub(/:jar:/, ':').sub(/:$/, ': ').split(':')) case scope when :all, :test yield jar when :compile # jar.scope is maven scope yield jar if jar.scope != :test when :provided # jar.scope is maven scope yield jar if jar.scope == :provided when :runtime # jar.scope is maven scope yield jar if (jar.scope != :test) && (jar.scope != :provided) end end end end end jruby-jar-dependencies-92427b1/lib/jars/lock_down.rb000066400000000000000000000057601515606370500223500ustar00rootroot00000000000000# frozen_string_literal: true require 'fileutils' require 'jar_dependencies' require 'jars/version' require 'jars/maven_factory' require 'jars/gemspec_artifacts' module Jars class LockDown attr_reader :debug, :verbose def initialize(debug, verbose) @debug = debug @verbose = verbose end def maven_new factory = MavenFactory.new({}, @debug, @verbose) pom = File.expand_path('lock_down_pom.rb', __dir__) m = factory.maven_new(pom) m['jruby.plugins.version'] = Jars::JRUBY_PLUGINS_VERSION m['dependency.plugin.version'] = Jars::DEPENDENCY_PLUGIN_VERSION m['jars.basedir'] = File.expand_path(basedir) jarfile = File.expand_path(Jars.jarfile) m['jars.jarfile'] = jarfile if File.exist?(jarfile) attach_jar_coordinates_from_bundler_dependencies(m) m end private :maven_new def maven @maven ||= maven_new end def basedir File.expand_path('.') end def attach_jar_coordinates_from_bundler_dependencies(maven) load_path = $LOAD_PATH.dup require 'bundler' # TODO: make this group a commandline option Bundler.setup('default') maven.property('jars.bundler', true) cwd = File.expand_path('.') Gem.loaded_specs.each do |_name, spec| # if gemspec is local then include all dependencies maven.attach_jars(spec, all_dependencies: cwd == spec.full_gem_path) end rescue LoadError => e if Jars.verbose? warn e.message warn 'no bundler found - ignore Gemfile if exists' end rescue Bundler::GemfileNotFound # do nothing then as we have bundler but no Gemfile rescue Bundler::GemNotFound warn "can not setup bundler with #{Bundler.default_lockfile}" raise ensure $LOAD_PATH.replace(load_path) end def lock_down(vendor_dir = nil, force: false, update: false, tree: nil) out = File.expand_path('.jars.output') tree_provided = tree tree ||= File.expand_path('.jars.tree') maven.property('jars.outputFile', out) maven.property('maven.repo.local', Jars.local_maven_repo) maven.property('jars.home', File.expand_path(vendor_dir)) if vendor_dir maven.property('jars.lock', File.expand_path(Jars.lock)) maven.property('jars.force', force) maven.property('jars.update', update) if update # tell not to use Jars.lock as part of POM when running mvn maven.property('jars.skip.lock', true) args = ['gem:jars-lock'] args += ['dependency:tree', '-P -gemfile.lock', "-DoutputFile=#{tree}"] if tree_provided puts puts '-- jar root dependencies --' puts status = maven.exec(*args) exit 1 unless status if File.exist?(tree) puts puts '-- jar dependency tree --' puts puts File.read(tree) puts end puts puts File.read(out).gsub("#{File.dirname(out)}/", '') puts ensure FileUtils.rm_f out FileUtils.rm_f tree end end end jruby-jar-dependencies-92427b1/lib/jars/lock_down_pom.rb000066400000000000000000000015161515606370500232160ustar00rootroot00000000000000# frozen_string_literal: true # this file is maven DSL and used by maven via jars/lock_down.rb basedir(ENV_JAVA['jars.basedir']) def eval_file(file) file = File.join(__dir__, file) eval(File.read(file), nil, file) # rubocop:disable Security/Eval end eval_file('attach_jars_pom.rb') jfile = ENV_JAVA['jars.jarfile'] jarfile(jfile) if jfile # need to fix the version of this plugin for gem:jars_lock goal jruby_plugin :gem, ENV_JAVA['jruby.plugins.version'] # if you use bundler we collect all root jar dependencies # from each gemspec file. otherwise we need to resolve # the gemspec artifact in the maven way unless ENV_JAVA['jars.bundler'] begin gemspec rescue nil end end properties('project.build.sourceEncoding' => 'utf-8') plugin :dependency, ENV_JAVA['dependency.plugin.version'] eval_file('output_jars_pom.rb') jruby-jar-dependencies-92427b1/lib/jars/maven_exec.rb000066400000000000000000000047471515606370500225070ustar00rootroot00000000000000# frozen_string_literal: true require 'jar_dependencies' require 'jars/maven_factory' module Jars class MavenExec def find_spec(allow_no_file) specs = Dir['*.gemspec'] case specs.size when 0 raise 'no gemspec found' unless allow_no_file when 1 specs.first else raise 'more then one gemspec found. please specify a specfile' unless allow_no_file end end private :find_spec attr_reader :basedir, :spec, :specfile def initialize(spec = nil) @options = {} setup(spec) rescue StandardError, LoadError => e # If spec load fails, skip looking for jar-dependencies warn "jar-dependencies: #{e}" warn e.backtrace.join("\n") if Jars.verbose? end def setup(spec = nil, allow_no_file: false) spec ||= find_spec(allow_no_file) case spec when String @specfile = File.expand_path(spec) @basedir = File.dirname(@specfile) Dir.chdir(@basedir) do spec = eval(File.read(@specfile), TOPLEVEL_BINDING, @specfile) # rubocop:disable Security/Eval end when Gem::Specification if File.exist?(spec.loaded_from) @basedir = spec.gem_dir @specfile = spec.loaded_from else # this happens with bundle and local gems # there the spec_file is "not installed" but inside # the gem_dir directory Dir.chdir(spec.gem_dir) do setup(nil, allow_no_file: true) end end when nil # ignore else Jars.debug('spec must be either String or Gem::Specification. ' \ 'File an issue on github if you need it.') end @spec = spec end def ruby_maven_install_options=(options) @options = options end def resolve_dependencies_list(file) factory = MavenFactory.new(@options) maven = factory.maven_new(File.expand_path('gemspec_pom.rb', __dir__)) is_local_file = File.expand_path(File.dirname(@specfile)) == File.expand_path(Dir.pwd) maven.attach_jars(@spec, all_dependencies: is_local_file) maven['jars.specfile'] = @specfile.to_s maven['outputAbsoluteArtifactFilename'] = 'true' maven['includeTypes'] = 'jar' maven['outputScope'] = 'true' maven['useRepositoryLayout'] = 'true' maven['outputDirectory'] = Jars.home.to_s maven['outputFile'] = file.to_s maven.exec('dependency:copy-dependencies', 'dependency:list') end end end jruby-jar-dependencies-92427b1/lib/jars/maven_factory.rb000066400000000000000000000100051515606370500232120ustar00rootroot00000000000000# frozen_string_literal: true require 'jar_dependencies' require 'jars/gemspec_artifacts' module Jars class MavenFactory module AttachJars def attach_jars(spec, all_dependencies: false) @index ||= 0 @done ||= [] deps = GemspecArtifacts.new(spec) deps.artifacts.each do |a| # for this gemspec we want to include all artifacts but # for all others we want to exclude provided and test artifacts next unless !@done.include?(a.key) && (all_dependencies || ((a.scope != 'provided') && (a.scope != 'test'))) # ruby dsl is not working reliably for classifier self["jars.#{@index}"] = a.to_coord_no_classifier if a.exclusions jndex = 0 a.exclusions.each do |ex| self["jars.#{@index}.exclusions.#{jndex}"] = ex.to_s jndex += 1 end end self["jars.#{@index}.scope"] = a.scope if a.scope self["jars.#{@index}.classifier"] = a.classifier if a.classifier @index += 1 @done << a.key end end end attr_reader :debug, :verbose def initialize(options = nil, debug = Jars.debug?, verbose = Jars.verbose?) @options = (options || {}).dup @options.delete(:ignore_dependencies) @debug = debug @verbose = verbose @installed_maven = false end def maven_new(pom) lazy_load_maven maven = setup(Maven::Ruby::Maven.new) maven.extend AttachJars # TODO: copy pom to tmp dir in case it is not a real file maven.options['-f'] = pom maven end private def setup(maven) maven.verbose = @verbose maven.options['-X'] = nil if @debug if @verbose maven.options['-e'] = nil elsif !@debug maven.options['--quiet'] = nil end maven['verbose'] = (@debug || @verbose) == true maven.options['-s'] = Jars::MavenSettings.effective_settings if Jars.maven_settings maven['maven.repo.local'] = java.io.File.new(Jars.local_maven_repo).absolute_path.to_s maven end def lazy_load_maven add_gem_to_load_path('ruby-maven') add_gem_to_load_path('ruby-maven-libs') if @installed_maven puts puts 'using maven for the first time results in maven' puts 'downloading all its default plugin and can take time.' puts 'as those plugins get cached on disk and further execution' puts 'of maven is much faster then the first time.' puts end require 'maven/ruby/maven' end def find_spec_via_rubygems(name, req) require 'rubygems/dependency' dep = Gem::Dependency.new(name, req) dep.matching_specs(true).last end def add_gem_to_load_path(name) # if the gem is already activated => good return if Gem.loaded_specs[name] # just install gem if needed and add it to the load_path # and leave activated gems as they are req = requirement(name) unless (spec = find_spec_via_rubygems(name, req)) spec = install_gem(name, req) end raise "failed to resolve gem '#{name}' if you're using Bundler add it as a dependency" unless spec path = File.join(spec.full_gem_path, spec.require_path) $LOAD_PATH << path unless $LOAD_PATH.include?(path) end def requirement(name) jars = Gem.loaded_specs['jar-dependencies'] dep = jars&.dependencies&.detect { |d| d.name == name } dep.nil? ? Gem::Requirement.create('>0') : dep.requirement end def install_gem(name, req) @installed_maven = true puts "Installing gem '#{name}' . . ." require 'rubygems/dependency_installer' inst = Gem::DependencyInstaller.new(@options ||= {}) inst.install(name, req).first rescue => e if Jars.verbose? warn e.inspect warn e.backtrace.join("\n") end raise "there was an error installing '#{name} (#{req})' " \ "#{@options[:domain]}. please install it manually: #{e.inspect}" end end end jruby-jar-dependencies-92427b1/lib/jars/maven_settings.rb000066400000000000000000000110301515606370500234020ustar00rootroot00000000000000# frozen_string_literal: true module Jars class MavenSettings LINE_SEPARATOR = ENV_JAVA['line.separator'] class << self def local_settings @_jars_maven_local_settings_ = nil unless instance_variable_defined?(:@_jars_maven_local_settings_) if @_jars_maven_local_settings_.nil? settings = Jars.absolute('settings.xml') @_jars_maven_local_settings_ = if settings && File.exist?(settings) settings else false end end @_jars_maven_local_settings_ || nil end def user_settings @_jars_maven_user_settings_ = nil unless instance_variable_defined?(:@_jars_maven_user_settings_) if @_jars_maven_user_settings_.nil? if (settings = Jars.absolute(Jars.to_prop(MAVEN_SETTINGS))) unless File.exist?(settings) Jars.warn { "configured ENV['#{MAVEN_SETTINGS}'] = '#{settings}' not found" } settings = false end else # use maven default (user) settings settings = File.join(Jars.user_home, '.m2', 'settings.xml') settings = false unless File.exist?(settings) end @_jars_maven_user_settings_ = settings end @_jars_maven_user_settings_ || nil end def effective_settings @_jars_effective_maven_settings_ = nil unless instance_variable_defined?(:@_jars_effective_maven_settings_) if @_jars_effective_maven_settings_.nil? begin require 'rubygems/request' http = Gem::Request.proxy_uri(Gem.configuration[:http_proxy] || Gem::Request.get_proxy_from_env('http')) https = Gem::Request.proxy_uri(Gem.configuration[:https_proxy] || Gem::Request.get_proxy_from_env('https')) rescue Jars.debug('ignore rubygems proxy configuration as rubygems is too old') end @_jars_effective_maven_settings_ = if http.nil? && https.nil? settings else setup_interpolated_settings(http, https) || settings end end @_jars_effective_maven_settings_ end def cleanup File.unlink(effective_settings) if effective_settings != settings ensure reset end def reset instance_variables.each { |var| instance_variable_set(var, nil) } end def settings @_jars_maven_settings_ = nil unless instance_variable_defined?(:@_jars_maven_settings_) local_settings || user_settings if @_jars_maven_settings_.nil? end def global_settings @_jars_maven_global_settings_ = nil unless instance_variable_defined?(:@_jars_maven_global_settings_) if @_jars_maven_global_settings_.nil? if (mvn_home = ENV['M2_HOME'] || ENV['MAVEN_HOME']) settings = File.join(mvn_home, 'conf/settings.xml') settings = false unless File.exist?(settings) else settings = false end @_jars_maven_global_settings_ = settings end @_jars_maven_global_settings_ || nil end private def setup_interpolated_settings(http, https) proxy = raw_proxy_settings_xml(http, https).gsub("\n", LINE_SEPARATOR) if settings.nil? raw = "#{LINE_SEPARATOR}#{proxy}" else raw = File.read(settings) if raw.include?('') Jars.warn("can not interpolated proxy info for #{settings}") return else raw.sub!('', "#{LINE_SEPARATOR}#{proxy}") end end tempfile = java.io.File.create_temp_file('settings', '.xml') tempfile.delete_on_exit File.write(tempfile.path, raw) tempfile.path end def raw_proxy_settings_xml(http, https) raw = File.read(File.join(File.dirname(__FILE__), 'settings.xml')) if http raw.sub!('__HTTP_ACTIVE__', 'true') raw.sub!('__HTTP_SERVER__', http.host) raw.sub!('__HTTP_PORT__', http.port.to_s) else raw.sub!('__HTTP_ACTIVE__', 'false') end if https raw.sub!('__HTTPS_ACTIVE__', 'true') raw.sub!('__HTTPS_SERVER__', https.host) raw.sub!('__HTTPS_PORT__', https.port.to_s) else raw.sub!('__HTTPS_ACTIVE__', 'false') end raw end end end end jruby-jar-dependencies-92427b1/lib/jars/output_jars_pom.rb000066400000000000000000000006671515606370500236240ustar00rootroot00000000000000# frozen_string_literal: true # this file is maven DSL if ENV_JAVA['jars.quiet'] != 'true' model.dependencies.each do |d| puts " #{d.group_id}:#{d.artifact_id}" \ "#{d.classifier ? ":#{d.classifier}" : ''}" \ ":#{d.version}:#{d.scope || 'compile'}" next if d.exclusions.empty? puts " exclusions: #{d.exclusions.collect do |e| "#{e.group_id}:#{e.artifact_id}" end.join}" end end jruby-jar-dependencies-92427b1/lib/jars/post_install_hook.rb000066400000000000000000000027201515606370500241150ustar00rootroot00000000000000# frozen_string_literal: true # # Copyright (C) 2014 Christian Meier # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of # the Software, and to permit persons to whom the Software is furnished to do so, # subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # if defined?(JRUBY_VERSION) && Gem.post_install_hooks.empty? Gem.post_install do |gem_installer| if ENV['JARS_SKIP'] != 'true' && ENV_JAVA['jars.skip'] != 'true' require 'jars/installer' jars = Jars::Installer.new(gem_installer.spec) jars.ruby_maven_install_options = gem_installer.options || {} jars.vendor_jars end end end jruby-jar-dependencies-92427b1/lib/jars/settings.xml000066400000000000000000000010371515606370500224170ustar00rootroot00000000000000 __HTTP_ACTIVE__ http __HTTP_SERVER__ __HTTP_PORT__ __HTTPS_ACTIVE__ https __HTTPS_SERVER__ __HTTPS_PORT__ jruby-jar-dependencies-92427b1/lib/jars/setup.rb000066400000000000000000000003531515606370500215220ustar00rootroot00000000000000# frozen_string_literal: true # to do as bundler does and allow to load Jars.lock via # require 'jars/setup'. can be useful via commandline -rjars/setup # or tell bundler autorequire to load it require 'jar_dependencies' Jars.setup jruby-jar-dependencies-92427b1/lib/jars/version.rb000066400000000000000000000002111515606370500220400ustar00rootroot00000000000000# frozen_string_literal: true module Jars VERSION = '0.5.7' JRUBY_PLUGINS_VERSION = '3.0.2' DEPENDENCY_PLUGIN_VERSION = '2.8' end jruby-jar-dependencies-92427b1/lib/rubygems_plugin.rb000066400000000000000000000022101515606370500226300ustar00rootroot00000000000000# frozen_string_literal: true # # Copyright (C) 2014 Christian Meier # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of # the Software, and to permit persons to whom the Software is furnished to do so, # subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # require 'jars/post_install_hook' jruby-jar-dependencies-92427b1/mvnw000077500000000000000000000157101515606370500172500ustar00rootroot00000000000000#!/bin/sh # ---------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- # Maven2 Start Up Batch script # # Required ENV vars: # ------------------ # JAVA_HOME - location of a JDK home dir # # Optional ENV vars # ----------------- # M2_HOME - location of maven2's installed home dir # MAVEN_OPTS - parameters passed to the Java VM when running Maven # e.g. to debug Maven itself, use # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 # MAVEN_SKIP_RC - flag to disable loading of mavenrc files # ---------------------------------------------------------------------------- if [ -z "$MAVEN_SKIP_RC" ] ; then if [ -f /etc/mavenrc ] ; then . /etc/mavenrc fi if [ -f "$HOME/.mavenrc" ] ; then . "$HOME/.mavenrc" fi fi # OS specific support. $var _must_ be set to either true or false. cygwin=false; darwin=false; mingw=false case "`uname`" in CYGWIN*) cygwin=true ;; MINGW*) mingw=true;; Darwin*) darwin=true # # Look for the Apple JDKs first to preserve the existing behaviour, and then look # for the new JDKs provided by Oracle. # if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then # # Apple JDKs # export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home fi if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then # # Apple JDKs # export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home fi if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then # # Oracle JDKs # export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home fi if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then # # Apple JDKs # export JAVA_HOME=`/usr/libexec/java_home` fi ;; esac if [ -z "$JAVA_HOME" ] ; then if [ -r /etc/gentoo-release ] ; then JAVA_HOME=`java-config --jre-home` fi fi if [ -z "$M2_HOME" ] ; then ## resolve links - $0 may be a link to maven's home PRG="$0" # need this for relative symlinks while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRG="`dirname "$PRG"`/$link" fi done saveddir=`pwd` M2_HOME=`dirname "$PRG"`/.. # make it fully qualified M2_HOME=`cd "$M2_HOME" && pwd` cd "$saveddir" # echo Using m2 at $M2_HOME fi # For Cygwin, ensure paths are in UNIX format before anything is touched if $cygwin ; then [ -n "$M2_HOME" ] && M2_HOME=`cygpath --unix "$M2_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"` fi # For Migwn, ensure paths are in UNIX format before anything is touched if $mingw ; then [ -n "$M2_HOME" ] && M2_HOME="`(cd "$M2_HOME"; pwd)`" [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" # TODO classpath? fi if [ -z "$JAVA_HOME" ]; then javaExecutable="`which javac`" if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then # readlink(1) is not available as standard on Solaris 10. readLink=`which readlink` if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then if $darwin ; then javaHome="`dirname \"$javaExecutable\"`" javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" else javaExecutable="`readlink -f \"$javaExecutable\"`" fi javaHome="`dirname \"$javaExecutable\"`" javaHome=`expr "$javaHome" : '\(.*\)/bin'` JAVA_HOME="$javaHome" export JAVA_HOME fi fi fi if [ -z "$JAVACMD" ] ; then if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" else JAVACMD="$JAVA_HOME/bin/java" fi else JAVACMD="`which java`" fi fi if [ ! -x "$JAVACMD" ] ; then echo "Error: JAVA_HOME is not defined correctly." >&2 echo " We cannot execute $JAVACMD" >&2 exit 1 fi if [ -z "$JAVA_HOME" ] ; then echo "Warning: JAVA_HOME environment variable is not set." fi CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher # For Cygwin, switch paths to Windows format before running java if $cygwin; then [ -n "$M2_HOME" ] && M2_HOME=`cygpath --path --windows "$M2_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"` fi # traverses directory structure from process work directory to filesystem root # first directory with .mvn subdirectory is considered project base directory find_maven_basedir() { local basedir=$(pwd) local wdir=$(pwd) while [ "$wdir" != '/' ] ; do if [ -d "$wdir"/.mvn ] ; then basedir=$wdir break fi wdir=$(cd "$wdir/.."; pwd) done echo "${basedir}" } # concatenates all lines of a file concat_lines() { if [ -f "$1" ]; then echo "$(tr -s '\n' ' ' < "$1")" fi } export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" # Provide a "standardized" way to retrieve the CLI args that will # work with both Windows and non-Windows executions. MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" export MAVEN_CMD_LINE_ARGS WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain exec "$JAVACMD" \ $MAVEN_OPTS \ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CMD_LINE_ARGS jruby-jar-dependencies-92427b1/mvnw.cmd000066400000000000000000000116631515606370500200120ustar00rootroot00000000000000@REM ---------------------------------------------------------------------------- @REM Licensed to the Apache Software Foundation (ASF) under one @REM or more contributor license agreements. See the NOTICE file @REM distributed with this work for additional information @REM regarding copyright ownership. The ASF licenses this file @REM to you under the Apache License, Version 2.0 (the @REM "License"); you may not use this file except in compliance @REM with the License. You may obtain a copy of the License at @REM @REM http://www.apache.org/licenses/LICENSE-2.0 @REM @REM Unless required by applicable law or agreed to in writing, @REM software distributed under the License is distributed on an @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @REM KIND, either express or implied. See the License for the @REM specific language governing permissions and limitations @REM under the License. @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- @REM Maven2 Start Up Batch script @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @REM @REM Optional ENV vars @REM M2_HOME - location of maven2's installed home dir @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @REM e.g. to debug Maven itself, use @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files @REM ---------------------------------------------------------------------------- @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' @echo off @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% @REM set %HOME% to equivalent of $HOME if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") @REM Execute a user defined script before this one if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre @REM check for pre script, once with legacy .bat ending and once with .cmd ending if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" :skipRcPre @setlocal set ERROR_CODE=0 @REM To isolate internal variables from possible post scripts, we use another setlocal @setlocal @REM ==== START VALIDATION ==== if not "%JAVA_HOME%" == "" goto OkJHome echo. echo Error: JAVA_HOME not found in your environment. >&2 echo Please set the JAVA_HOME variable in your environment to match the >&2 echo location of your Java installation. >&2 echo. goto error :OkJHome if exist "%JAVA_HOME%\bin\java.exe" goto init echo. echo Error: JAVA_HOME is set to an invalid directory. >&2 echo JAVA_HOME = "%JAVA_HOME%" >&2 echo Please set the JAVA_HOME variable in your environment to match the >&2 echo location of your Java installation. >&2 echo. goto error @REM ==== END VALIDATION ==== :init set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %* @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". @REM Fallback to current working directory if not found. set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir set EXEC_DIR=%CD% set WDIR=%EXEC_DIR% :findBaseDir IF EXIST "%WDIR%"\.mvn goto baseDirFound cd .. IF "%WDIR%"=="%CD%" goto baseDirNotFound set WDIR=%CD% goto findBaseDir :baseDirFound set MAVEN_PROJECTBASEDIR=%WDIR% cd "%EXEC_DIR%" goto endDetectBaseDir :baseDirNotFound set MAVEN_PROJECTBASEDIR=%EXEC_DIR% cd "%EXEC_DIR%" :endDetectBaseDir IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig @setlocal EnableExtensions EnableDelayedExpansion for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% :endReadAdditionalConfig SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% if ERRORLEVEL 1 goto error goto end :error set ERROR_CODE=1 :end @endlocal & set ERROR_CODE=%ERROR_CODE% if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost @REM check for post script, once with legacy .bat ending and once with .cmd ending if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" :skipRcPost @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' if "%MAVEN_BATCH_PAUSE%" == "on" pause if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% exit /B %ERROR_CODE% jruby-jar-dependencies-92427b1/settings-example.xml000066400000000000000000000027471515606370500223540ustar00rootroot00000000000000 maven-central-mirror central https://artifactory.example.com/artifactory/all mavencentral central http://central true true central http://central true true mavencentral jruby-jar-dependencies-92427b1/specs/000077500000000000000000000000001515606370500174445ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/Jars.lock000066400000000000000000000005241515606370500212160ustar00rootroot00000000000000org.apache.maven:maven-repository-metadata:3.1.0:compile: com.google.code.findbugs:jsr305:1.3.9:provided: org.apache.httpcomponents:httpclient:4.2.3:provided: org.sonatype.sisu:sisu-guice:no_aop:3.1.0:compile: jdk:tools:1.7:system:${java.home}/../lib/tools.jar org.slf4j:slf4j-api:1.6.2:test: org.sonatype.plexus:plexus-cipher:1.4:runtime: jruby-jar-dependencies-92427b1/specs/Jars_no_jline.lock000066400000000000000000000000361515606370500230710ustar00rootroot00000000000000example:example:2.1:provided: jruby-jar-dependencies-92427b1/specs/classpath_spec.rb000066400000000000000000000213061515606370500227670ustar00rootroot00000000000000# frozen_string_literal: true require File.expand_path('setup', File.dirname(__FILE__)) require 'yaml' module Helper def self.prepare!(array) exclusions = %w[ org/yaml/snakeyaml/snakeyaml.jar org/jruby/dirgra/dirgra.jar org/jruby/yecht/yecht.jar ] result = array.collect do |a| a.sub(/\.jar.*$/, '.jar') .sub(/-native.jar$/, '.jar') .sub(/-[^-]+$/, '.jar') .sub(%r{[^/]+/([^/]+)$}, '\1') .sub(/^.*META-INF.jruby.home.lib.ruby.s....../, '') .sub(/.*#{Jars.home}./, '') .sub(/.*#{Jars.local_maven_repo}./, '') .sub(/.*repository./, '') # make sure we trim this end - exclusions # omit ruby-maven jars result.delete_if { |c| c.include?('ruby-maven') } result.uniq.sort end def self.reduce(big, small) (prepare!(big) - prepare!(small)).uniq.sort.to_yaml end def self.prepare(array) prepare!(array).to_yaml end end describe Jars::Classpath do let(:deps) { File.join(pwd, 'deps.txt') } let(:pwd) { File.dirname(File.expand_path(__FILE__)) } let(:jars_lock) { File.join(pwd, 'Jars.lock') } let(:jars_no_jline_lock) { File.join(pwd, 'Jars_no_jline.lock') } let(:example_spec) { File.join(pwd, '..', 'example', 'example.gemspec') } let(:example_expected) do ['com/fasterxml/jackson/core/jackson-databind/2.5.1/jackson-databind-2.5.1.jar', 'io/dropwizard/dropwizard-jackson/0.8.0-rc5/dropwizard-jackson-0.8.0-rc5.jar', 'com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar', 'io/dropwizard/dropwizard-util/0.8.0-rc5/dropwizard-util-0.8.0-rc5.jar', 'com/fasterxml/jackson/module/jackson-module-afterburner/2.5.1/jackson-module-afterburner-2.5.1.jar', 'com/fasterxml/jackson/datatype/jackson-datatype-guava/2.5.1/jackson-datatype-guava-2.5.1.jar', 'org/bouncycastle/bcpkix-jdk15on/1.49/bcpkix-jdk15on-1.49.jar', 'org/bouncycastle/bcprov-jdk15on/1.49/bcprov-jdk15on-1.49.jar', 'com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.jar', 'org/jboss/logging/jboss-logging/3.1.3.GA/jboss-logging-3.1.3.GA.jar', 'io/dropwizard/metrics/metrics-core/3.1.0/metrics-core-3.1.0.jar', 'org/slf4j/jcl-over-slf4j/1.7.10/jcl-over-slf4j-1.7.10.jar', 'org/slf4j/log4j-over-slf4j/1.7.10/log4j-over-slf4j-1.7.10.jar', 'org/hibernate/hibernate-validator/5.1.3.Final/hibernate-validator-5.1.3.Final.jar', 'ch/qos/logback/logback-core/1.1.2/logback-core-1.1.2.jar', 'com/fasterxml/jackson/core/jackson-core/2.5.1/jackson-core-2.5.1.jar', 'org/slf4j/jul-to-slf4j/1.7.10/jul-to-slf4j-1.7.10.jar', 'io/dropwizard/dropwizard-logging/0.8.0-rc5/dropwizard-logging-0.8.0-rc5.jar', 'org/glassfish/javax.el/3.0.0/javax.el-3.0.0.jar', 'io/dropwizard/metrics/metrics-logback/3.1.0/metrics-logback-3.1.0.jar', 'com/google/guava/guava/18.0/guava-18.0.jar', 'com/fasterxml/jackson/datatype/jackson-datatype-jdk7/2.5.1/jackson-datatype-jdk7-2.5.1.jar', 'io/dropwizard/dropwizard-validation/0.8.0-rc5/dropwizard-validation-0.8.0-rc5.jar', 'javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar', 'ch/qos/logback/logback-classic/1.1.2/logback-classic-1.1.2.jar', 'com/google/protobuf/protobuf-java/2.2.0/protobuf-java-2.2.0-lite.jar', 'com/fasterxml/jackson/core/jackson-annotations/2.5.0/jackson-annotations-2.5.0.jar', 'org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar', 'com/fasterxml/jackson/datatype/jackson-datatype-joda/2.5.1/jackson-datatype-joda-2.5.1.jar', 'org/eclipse/jetty/jetty-util/9.2.9.v20150224/jetty-util-9.2.9.v20150224.jar'] end let(:expected_with_bc) { example_expected + bouncycastle } let(:lock_expected) do ['org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar', 'com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar', 'org/apache/httpcomponents/httpclient/4.2.3/httpclient-4.2.3.jar', 'org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-no_aop-3.1.0.jar', '${java.home}/../lib/tools.jar', 'org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar'] end let(:lock_expected_runtime) do ['org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar', 'org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-no_aop-3.1.0.jar', '${java.home}/../lib/tools.jar', 'org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar'] end let(:lock_expected_test) do ['org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar', 'com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar', 'org/apache/httpcomponents/httpclient/4.2.3/httpclient-4.2.3.jar', 'org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-no_aop-3.1.0.jar', '${java.home}/../lib/tools.jar', 'org/slf4j/slf4j-api/1.6.2/slf4j-api-1.6.2.jar', 'org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar'] end let(:bc_prov) { ['org/bouncycastle/bcprov-jdk15on/1.49/bcprov-jdk15on-1.49.jar'] } let(:bc_pkix) { ['org/bouncycastle/bcpkix-jdk15on/1.49/bcpkix-jdk15on-1.49.jar'] } let(:bouncycastle) { bc_pkix + bc_prov + ['org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar'] } subject { Jars::Classpath.new(example_spec) } after do ENV_JAVA['jars.quiet'] = nil Jars.reset end it 'resolves classpath from gemspec' do ENV_JAVA['jars.quiet'] = 'true' Dir.chdir(File.dirname(example_spec)) do _(Helper.prepare(subject.classpath)).must_equal Helper.prepare(example_expected) _(Helper.prepare(subject.classpath(:compile))).must_equal Helper.prepare( expected_with_bc + ['org/slf4j/slf4j-simple/1.7.7/slf4j-simple-1.7.7.jar'] ) _(Helper.prepare(subject.classpath(:test))).must_equal Helper.prepare(expected_with_bc + [ 'junit/junit/4.12/junit-4.12.jar', 'org/slf4j/slf4j-simple/1.7.7/slf4j-simple-1.7.7.jar', 'org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar' ]) _(Helper.prepare(subject.classpath(:runtime))).must_equal Helper.prepare(example_expected) end end it 'resolves classpath_string from gemspec' do ENV_JAVA['jars.quiet'] = 'true' Dir.chdir(File.dirname(example_spec)) do _(Helper.prepare(subject.classpath_string.split(File::PATH_SEPARATOR))).must_equal Helper.prepare(example_expected) _(Helper.prepare(subject.classpath_string(:compile).split(File::PATH_SEPARATOR))) .must_equal Helper.prepare( expected_with_bc + ['org/slf4j/slf4j-simple/1.7.7/slf4j-simple-1.7.7.jar'] ) _(Helper.prepare(subject.classpath_string(:test).split(File::PATH_SEPARATOR))) .must_equal Helper.prepare(expected_with_bc + [ 'junit/junit/4.12/junit-4.12.jar', 'org/slf4j/slf4j-simple/1.7.7/slf4j-simple-1.7.7.jar', 'org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar' ]) _(Helper.prepare(subject.classpath_string(:runtime).split(File::PATH_SEPARATOR))) .must_equal Helper.prepare(example_expected) end end it 'requires classpath from gemspec' do # TODO: see not to require compile scope for 9k skip('TODO just use some empty jars for this spec') old = $CLASSPATH.to_a # sometimes the $CLASSPATH can already have BC jars # and it is not possible to unload entries from $CLASSPATH expected = if old.detect { |c| c.include?('bcprov-jdk15on') } if old.detect { |c| c.include?('bcpkix-jdk15on') } [] else bc_pkix end elsif old.detect { |c| c.include?('bcpkix-jdk15on') } bc_prov else bouncycastle end subject.require(:runtime) _(Helper.reduce($CLASSPATH.to_a, old)).must_equal Helper.prepare(expected) expected += example_expected subject.require(:compile) _(Helper.reduce($CLASSPATH.to_a, old)).must_equal Helper.prepare(expected) expected << 'junit/junit/4.1/junit-4.1.jar' subject.require(:test) _(Helper.reduce($CLASSPATH.to_a, old)).must_equal Helper.prepare(expected) end it 'processes Jars.lock if exists' do subject.instance_variable_set(:@deps, jars_lock) _(Helper.prepare(subject.classpath)).must_equal Helper.prepare(lock_expected_runtime) _(Helper.prepare(subject.classpath(:compile))).must_equal Helper.prepare(lock_expected) _(Helper.prepare(subject.classpath(:test))).must_equal Helper.prepare(lock_expected_test) _(Helper.prepare(subject.classpath(:runtime))).must_equal Helper.prepare(lock_expected_runtime) end it 'processes Jars.lock and block loading of jars' do subject.instance_variable_set(:@deps, jars_no_jline_lock) subject.require require_jar 'example', 'example', '1' _($CLASSPATH.detect { |c| c.include?('example') }).must_be_nil end end jruby-jar-dependencies-92427b1/specs/conf/000077500000000000000000000000001515606370500203715ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/conf/settings.xml000066400000000000000000000001241515606370500227500ustar00rootroot00000000000000 ${repo.path}/repository jruby-jar-dependencies-92427b1/specs/dependency_spec.rb000066400000000000000000000205461515606370500231300ustar00rootroot00000000000000# frozen_string_literal: true require File.expand_path('setup', File.dirname(__FILE__)) require 'jars/installer' # rubocop:disable Layout/LineLength describe Jars::Installer::Dependency do it 'should parse dependency line only if it is jar or pom' do assert_nil Jars::Installer::Dependency.new(+'something') assert Jars::Installer::Dependency.new(+' org.apache.maven:maven-repository-metadata:jar:3.1.0:compile:/usr/local/repository/org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar') assert Jars::Installer::Dependency.new(+' org.apache.maven:maven-repository-metadata:pom:3.1.0:compile:/usr/local/repository/org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar') end it 'should parse dependency line test scope' do dep = Jars::Installer::Dependency.new(+' org.apache.maven:maven-repository-metadata:jar:3.1.0:test:/usr/local/repository/org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar') _(dep.type).must_equal :jar _(dep.scope).must_equal :test _(dep.gav).must_equal 'org.apache.maven:maven-repository-metadata:3.1.0' _(dep.coord).must_equal 'org.apache.maven:maven-repository-metadata:jar:3.1.0' _(dep.path).must_equal 'org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar' _(dep.file).must_equal '/usr/local/repository/org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar' end it 'should parse dependency line provided scope' do dep = Jars::Installer::Dependency.new(+' org.apache.maven:maven-repository-metadata:jar:3.1.0:provided:/usr/local/repository/org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar') _(dep.type).must_equal :jar _(dep.scope).must_equal :provided _(dep.gav).must_equal 'org.apache.maven:maven-repository-metadata:3.1.0' _(dep.coord).must_equal 'org.apache.maven:maven-repository-metadata:jar:3.1.0' _(dep.path).must_equal 'org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar' _(dep.file).must_equal '/usr/local/repository/org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar' end it 'should parse dependency line runtim scope' do dep = Jars::Installer::Dependency.new(+' org.apache.maven:maven-repository-metadata:jar:3.1.0:compile:/usr/local/repository/org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar') _(dep.type).must_equal :jar _(dep.scope).must_equal :runtime _(dep.gav).must_equal 'org.apache.maven:maven-repository-metadata:3.1.0' _(dep.coord).must_equal 'org.apache.maven:maven-repository-metadata:jar:3.1.0' _(dep.path).must_equal 'org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar' _(dep.file).must_equal '/usr/local/repository/org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar' dep = Jars::Installer::Dependency.new(+' org.apache.maven:maven-repository-metadata:jar:3.1.0:runtime:/usr/local/repository/org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar') _(dep.type).must_equal :jar _(dep.scope).must_equal :runtime _(dep.gav).must_equal 'org.apache.maven:maven-repository-metadata:3.1.0' _(dep.coord).must_equal 'org.apache.maven:maven-repository-metadata:jar:3.1.0' _(dep.path).must_equal 'org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar' _(dep.file).must_equal '/usr/local/repository/org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.jar' end it 'should parse pom dependency' do dep = Jars::Installer::Dependency.new(+' org.apache.maven:maven-repository-metadata:pom:3.1.0:compile:/usr/local/repository/org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.pom') _(dep.type).must_equal :pom _(dep.scope).must_equal :runtime _(dep.gav).must_equal 'org.apache.maven:maven-repository-metadata:3.1.0' _(dep.coord).must_equal 'org.apache.maven:maven-repository-metadata:pom:3.1.0' _(dep.path).must_equal 'org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.pom' _(dep.file).must_equal '/usr/local/repository/org/apache/maven/maven-repository-metadata/3.1.0/maven-repository-metadata-3.1.0.pom' end it 'should parse dependency where artifact_id has dots' do dep = Jars::Installer::Dependency.new(+' org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M2a:compile:/usr/local/repository/org/eclipse/sisu/org.eclipse.sisu.plexus/0.0.0.M2a/org.eclipse.sisu.plexus-0.0.0.M2a.jar') _(dep.type).must_equal :jar _(dep.scope).must_equal :runtime _(dep.gav).must_equal 'org.eclipse.sisu:org.eclipse.sisu.plexus:0.0.0.M2a' _(dep.coord).must_equal 'org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M2a' _(dep.path).must_equal 'org/eclipse/sisu/org.eclipse.sisu.plexus/0.0.0.M2a/org.eclipse.sisu.plexus-0.0.0.M2a.jar' _(dep.file).must_equal '/usr/local/repository/org/eclipse/sisu/org.eclipse.sisu.plexus/0.0.0.M2a/org.eclipse.sisu.plexus-0.0.0.M2a.jar' end it 'should parse dependency with classifier' do dep = Jars::Installer::Dependency.new(+' org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0:compile:/usr/local/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar') _(dep.type).must_equal :jar _(dep.scope).must_equal :runtime _(dep.gav).must_equal 'org.sonatype.sisu:sisu-guice:no_aop:3.1.0' _(dep.coord).must_equal 'org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0' _(dep.path).must_equal 'org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar' _(dep.file).must_equal '/usr/local/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar' end it 'should parse dependency on windows' do dep = Jars::Installer::Dependency.new(+' org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0:compile:C:\\Users\\Local\\repository\\org\\sonatype\\sisu\\sisu-guice\\3.1.0\\sisu-guice-3.1.0-no_aop.jar') _(dep.type).must_equal :jar _(dep.scope).must_equal :runtime _(dep.gav).must_equal 'org.sonatype.sisu:sisu-guice:no_aop:3.1.0' _(dep.coord).must_equal 'org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0' _(dep.path).must_equal 'org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar' _(dep.file).must_equal 'C:\\Users\\Local\\repository\\org\\sonatype\\sisu\\sisu-guice\\3.1.0\\sisu-guice-3.1.0-no_aop.jar' end # these next two combine every possible oddity to try to cover all combinations (classifier, windows path, ANSI and module) it 'should parse dependency with module section' do dep = Jars::Installer::Dependency.new(+' org.eclipse.sisu:org.eclipse.sisu.plexus:jar:no_aop:0.0.0.M2a:compile:C:\\Users\\Local\\repository\\org\\sonatype\\sisu\\org.eclipse.sisu.plexus\\0.0.0.M2a\\org.eclipse.sisu.plexus-0.0.0.M2a-no_aop.jar -- module org.sonatype.sisu.sisu-guice') _(dep.type).must_equal :jar _(dep.scope).must_equal :runtime _(dep.gav).must_equal 'org.eclipse.sisu:org.eclipse.sisu.plexus:no_aop:0.0.0.M2a' _(dep.coord).must_equal 'org.eclipse.sisu:org.eclipse.sisu.plexus:jar:no_aop:0.0.0.M2a' _(dep.path).must_equal 'org/eclipse/sisu/org.eclipse.sisu.plexus/0.0.0.M2a/org.eclipse.sisu.plexus-0.0.0.M2a-no_aop.jar' _(dep.file).must_equal 'C:\\Users\\Local\\repository\\org\\sonatype\\sisu\\org.eclipse.sisu.plexus\\0.0.0.M2a\\org.eclipse.sisu.plexus-0.0.0.M2a-no_aop.jar' end it 'should parse dependency with ANSI-colored module section' do dep = Jars::Installer::Dependency.new(+" org.eclipse.sisu:org.eclipse.sisu.plexus:jar:no_aop:0.0.0.M2a:compile:C:\\Users\\Local\\repository\\org\\sonatype\\sisu\\org.eclipse.sisu.plexus\\0.0.0.M2a\\org.eclipse.sisu.plexus-0.0.0.M2a-no_aop.jar\e[31m -- module org.sonatype.sisu.sisu-guice\e[m") _(dep.type).must_equal :jar _(dep.scope).must_equal :runtime _(dep.gav).must_equal 'org.eclipse.sisu:org.eclipse.sisu.plexus:no_aop:0.0.0.M2a' _(dep.coord).must_equal 'org.eclipse.sisu:org.eclipse.sisu.plexus:jar:no_aop:0.0.0.M2a' _(dep.path).must_equal 'org/eclipse/sisu/org.eclipse.sisu.plexus/0.0.0.M2a/org.eclipse.sisu.plexus-0.0.0.M2a-no_aop.jar' _(dep.file).must_equal 'C:\\Users\\Local\\repository\\org\\sonatype\\sisu\\org.eclipse.sisu.plexus\\0.0.0.M2a\\org.eclipse.sisu.plexus-0.0.0.M2a-no_aop.jar' end end # rubocop:enable Layout/LineLength jruby-jar-dependencies-92427b1/specs/deps.txt000066400000000000000000000100171515606370500211370ustar00rootroot00000000000000 The following files have been resolved: org.apache.maven:maven-repository-metadata:jar:3.1.0:compile:specs/deps/maven-repository-metadata-3.1.0.jar com.google.code.findbugs:jsr305:jar:1.3.9:compile:specs/deps/jsr305-1.3.9.jar org.slf4j:slf4j-api:jar:1.6.2:compile:specs/deps/slf4j-api-1.6.2.jar org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M2a:compile:specs/deps/org.eclipse.sisu.plexus-0.0.0.M2a.jar org.apache.httpcomponents:httpcore:jar:4.2.3:compile:specs/deps/httpcore-4.2.3.jar com.google.inject:guice:jar:3.0:compile:specs/deps/guice-3.0.jar javax.annotation:jsr250-api:jar:1.0:compile:specs/deps/jsr250-api-1.0.jar com.google.guava:guava:jar:10.0.1:compile:specs/deps/guava-10.0.1.jar org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.0.0.M2a:compile:specs/deps/org.eclipse.sisu.inject-0.0.0.M2a.jar commons-logging:commons-logging:jar:1.1.1:compile:specs/deps/commons-logging-1.1.1.jar org.apache.maven:maven-settings:jar:3.1.0:compile:specs/deps/maven-settings-3.1.0.jar org.apache.maven.wagon:wagon-file:jar:2.4:compile:specs/deps/wagon-file-2.4.jar org.eclipse.aether:aether-connector-wagon:jar:0.9.0.M2:compile:specs/deps/aether-connector-wagon-0.9.0.M2.jar org.eclipse.aether:aether-impl:jar:0.9.0.M2:compile:specs/deps/aether-impl-0.9.0.M2.jar com.ning:async-http-client:jar:1.7.6:compile:specs/deps/async-http-client-1.7.6.jar org.apache.maven.wagon:wagon-http-shared4:jar:2.4:compile:specs/deps/wagon-http-shared4-2.4.jar org.eclipse.aether:aether-util:jar:0.9.0.M2:compile:specs/deps/aether-util-0.9.0.M2.jar commons-io:commons-io:jar:2.0.1:compile:specs/deps/commons-io-2.0.1.jar org.apache.httpcomponents:httpclient:jar:4.2.3:compile:specs/deps/httpclient-4.2.3.jar org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0:compile:specs/deps/sisu-guice-3.1.0-no_aop.jar org.sonatype.plexus:plexus-cipher:jar:1.4:compile:specs/deps/plexus-cipher-1.4.jar org.eclipse.aether:aether-connector-file:jar:0.9.0.M2:compile:specs/deps/aether-connector-file-0.9.0.M2.jar org.apache.maven:maven-model:jar:3.1.0:compile:specs/deps/maven-model-3.1.0.jar org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile:specs/deps/plexus-sec-dispatcher-1.3.jar org.jboss.interceptor:jboss-interceptor-api:jar:1.1:compile:specs/deps/jboss-interceptor-api-1.1.jar org.eclipse.aether:aether-spi:jar:0.9.0.M2:compile:specs/deps/aether-spi-0.9.0.M2.jar org.apache.maven:maven-settings-builder:jar:3.1.0:compile:specs/deps/maven-settings-builder-3.1.0.jar org.codehaus.plexus:plexus-classworlds:jar:2.4:compile:specs/deps/plexus-classworlds-2.4.jar org.apache.maven:maven-aether-provider:jar:3.1.0:compile:specs/deps/maven-aether-provider-3.1.0.jar org.apache.maven.wagon:wagon-provider-api:jar:1.0:compile:specs/deps/wagon-provider-api-1.0.jar javax.inject:javax.inject:jar:1:compile:specs/deps/javax.inject-1.jar io.netty:netty:jar:3.4.4.Final:compile:specs/deps/netty-3.4.4.Final.jar org.apache.maven:maven-model-builder:jar:3.1.0:compile:specs/deps/maven-model-builder-3.1.0.jar org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile:specs/deps/plexus-component-annotations-1.5.5.jar org.apache.maven.wagon:wagon-http:jar:2.4:compile:specs/deps/wagon-http-2.4.jar org.codehaus.plexus:plexus-utils:jar:3.0.10:compile:specs/deps/plexus-utils-3.0.10.jar aopalliance:aopalliance:jar:1.0:compile:specs/deps/aopalliance-1.0.jar org.eclipse.aether:aether-api:jar:0.9.0.M2:compile:specs/deps/aether-api-0.9.0.M2.jar org.eclipse.aether:aether-connector-asynchttpclient:jar:0.9.0.M2:compile:specs/deps/aether-connector-asynchttpclient-0.9.0.M2.jar org.jsoup:jsoup:jar:1.7.1:compile:specs/deps/jsoup-1.7.1.jar org.sonatype.sisu:sisu-guava:jar:0.9.9:compile:specs/deps/sisu-guava-0.9.9.jar org.codehaus.plexus:plexus-interpolation:jar:1.16:compile:specs/deps/plexus-interpolation-1.16.jar javax.enterprise:cdi-api:jar:1.0:compile:specs/deps/cdi-api-1.0.jar asm:asm:jar:3.3.1:compile:specs/deps/asm-3.3.1.jar commons-codec:commons-codec:jar:1.6:compile:specs/deps/commons-codec-1.6.jar jruby-jar-dependencies-92427b1/specs/deps/000077500000000000000000000000001515606370500203775ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/aether-api-0.9.0.M2.jar000066400000000000000000000000001515606370500240210ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/aether-connector-asynchttpclient-0.9.0.M2.jar000066400000000000000000000000001515606370500304540ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/aether-connector-file-0.9.0.M2.jar000066400000000000000000000000001515606370500261570ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/aether-connector-wagon-0.9.0.M2.jar000066400000000000000000000000001515606370500263530ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/aether-impl-0.9.0.M2.jar000066400000000000000000000000001515606370500242110ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/aether-spi-0.9.0.M2.jar000066400000000000000000000000001515606370500240430ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/aether-util-0.9.0.M2.jar000066400000000000000000000000001515606370500242250ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/aopalliance-1.0.jar000066400000000000000000000000001515606370500236270ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/asm-3.3.1.jar000066400000000000000000000000001515606370500223030ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/async-http-client-1.7.6.jar000066400000000000000000000000001515606370500251000ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/cdi-api-1.0.jar000066400000000000000000000000001515606370500226650ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/commons-codec-1.6.jar000066400000000000000000000000001515606370500241130ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/commons-io-2.0.1.jar000066400000000000000000000000001515606370500235770ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/commons-logging-1.1.1.jar000066400000000000000000000000001515606370500246160ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/guava-10.0.1.jar000066400000000000000000000000001515606370500227010ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/guice-3.0.jar000066400000000000000000000000001515606370500224550ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/httpclient-4.2.3.jar000066400000000000000000000000001515606370500237030ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/httpcore-4.2.3.jar000066400000000000000000000000001515606370500233550ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/javax.inject-1.jar000066400000000000000000000000001515606370500236050ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/jboss-interceptor-api-1.1.jar000066400000000000000000000000001515606370500256030ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/jsoup-1.7.1.jar000066400000000000000000000000001515606370500226650ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/jsr250-api-1.0.jar000066400000000000000000000000001515606370500231530ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/jsr305-1.3.9.jar000066400000000000000000000000001515606370500225570ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/maven-aether-provider-3.1.0.jar000066400000000000000000000000001515606370500257240ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/maven-model-3.1.0.jar000066400000000000000000000000001515606370500237240ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/maven-model-builder-3.1.0.jar000066400000000000000000000000001515606370500253500ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/maven-repository-metadata-3.1.0.jar000066400000000000000000000000001515606370500266210ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/maven-settings-3.1.0.jar000066400000000000000000000000001515606370500244640ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/maven-settings-builder-3.1.0.jar000066400000000000000000000000001515606370500261100ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/netty-3.4.4.Final.jar000066400000000000000000000000001515606370500237220ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/org.eclipse.sisu.inject-0.0.0.M2a.jar000066400000000000000000000000001515606370500266010ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/org.eclipse.sisu.plexus-0.0.0.M2a.jar000066400000000000000000000000001515606370500266450ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/plexus-cipher-1.4.jar000066400000000000000000000000001515606370500241530ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/plexus-classworlds-2.4.jar000066400000000000000000000000001515606370500252420ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/plexus-component-annotations-1.5.5.jar000066400000000000000000000000001515606370500274020ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/plexus-interpolation-1.16.jar000066400000000000000000000000001515606370500256530ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/plexus-sec-dispatcher-1.3.jar000066400000000000000000000000001515606370500255760ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/plexus-utils-3.0.10.jar000066400000000000000000000000001515606370500242560ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/sisu-guava-0.9.9.jar000066400000000000000000000000001515606370500236220ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/sisu-guice-3.1.0-no_aop.jar000066400000000000000000000000001515606370500250460ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/slf4j-api-1.6.2.jar000066400000000000000000000000001515606370500233160ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/wagon-file-2.4.jar000066400000000000000000000000001515606370500234140ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/wagon-http-2.4.jar000066400000000000000000000000001515606370500234540ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/wagon-http-shared4-2.4.jar000066400000000000000000000000001515606370500250040ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/deps/wagon-provider-api-1.0.jar000066400000000000000000000000001515606370500250710ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/example/000077500000000000000000000000001515606370500210775ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/example/example/000077500000000000000000000000001515606370500225325ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/example/example/1/000077500000000000000000000000001515606370500226725ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/example/example/1/example-1.jar000066400000000000000000000005251515606370500251630ustar00rootroot00000000000000PKҤEC META-INF/PKPKҤECMETA-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMu *h%&*8%krrPKGCDPKҤEC META-INF/PKҤECGCD=META-INF/MANIFEST.MFPK}jruby-jar-dependencies-92427b1/specs/example/gem_with_require_relative/000077500000000000000000000000001515606370500263315ustar00rootroot00000000000000gem_with_require_relative.gemspec000066400000000000000000000002721515606370500350520ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/example/gem_with_require_relative# frozen_string_literal: true require_relative 'version' Gem::Specification.new do |spec| spec.required_ruby_version = '>= 2.6' spec.metadata['rubygems_mfa_required'] = 'true' end jruby-jar-dependencies-92427b1/specs/example/gem_with_require_relative/version.rb000066400000000000000000000000361515606370500303420ustar00rootroot00000000000000# frozen_string_literal: true jruby-jar-dependencies-92427b1/specs/gemspec_artifacts_spec.rb000066400000000000000000000221751515606370500244750ustar00rootroot00000000000000# frozen_string_literal: true require File.expand_path('setup', File.dirname(__FILE__)) require 'jars/gemspec_artifacts' describe Jars::GemspecArtifacts::Exclusion do it 'parse and to_s of exclusion' do expected = 'group:artifact' line = ' group:artifact ' ex = Jars::GemspecArtifacts::Exclusion.new(line) _(ex.to_s).must_equal expected line = ' "group:artifact" ' ex = Jars::GemspecArtifacts::Exclusion.new(line) _(ex.to_s).must_equal expected line = "'group:artifact'" ex = Jars::GemspecArtifacts::Exclusion.new(line) _(ex.to_s).must_equal expected line = ' group:artifact ' ex = Jars::GemspecArtifacts::Exclusion.new("#{line} :extra:asd") _(ex.to_s).must_equal expected end end describe Jars::GemspecArtifacts::Exclusions do it 'parse and to_s of single exclusion' do expected = '[group:artifact]' line = ' [group:artifact] ' ex = Jars::GemspecArtifacts::Exclusions.new(line) _(ex.to_s).must_equal expected line = " [' group:artifact'] " ex = Jars::GemspecArtifacts::Exclusions.new(line) _(ex.to_s).must_equal expected line = ' [ "group:artifact "] ' ex = Jars::GemspecArtifacts::Exclusions.new(line) _(ex.to_s).must_equal expected expected = '[group-id:artifact-id]' line = ' [ "group-id:artifact-id "] ' ex = Jars::GemspecArtifacts::Exclusions.new(line) _(ex.to_s).must_equal expected end it 'parse and to_s of list of exclusions' do expected = '[group1:artifact1, group2:artifact2]' line = ' [group1:artifact1, group2:artifact2] ' ex = Jars::GemspecArtifacts::Exclusions.new(line) _(ex.to_s).must_equal expected line = " ['group1:artifact1', ' group2:artifact2'] " ex = Jars::GemspecArtifacts::Exclusions.new(line) _(ex.to_s).must_equal expected line = ' [ "group1:artifact1", " group2:artifact2"] ' ex = Jars::GemspecArtifacts::Exclusions.new(line) _(ex.to_s).must_equal expected end end describe Jars::GemspecArtifacts::Artifact do it 'ignore unknow type' do _(Jars::GemspecArtifacts::Artifact.new('bla')).must_be_nil _(Jars::GemspecArtifacts::Artifact.new(' _(bla')).must_be_nil _(Jars::GemspecArtifacts::Artifact.new('bla bla _(bla')).must_be_nil end %i[jar pom].each do |type| it "parse and to_s of simple GAV #{type}" do expected = "#{type} g:a, 1" a = Jars::GemspecArtifacts::Artifact.new(expected) _(a.to_s).must_equal expected line = "#{type} 'g:a', '1'" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} g,a,1" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} 'g',\"a\", 1" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} g:a:1" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} 'g:a:1'" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected end it "parse and to_s of simple GAV #{type} with range" do expected = "#{type} g:a, [1, 2)" a = Jars::GemspecArtifacts::Artifact.new(expected) _(a.to_s).must_equal expected line = "#{type} g:a:[1, 2)" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} g:a,'[1, 2)'" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} 'g', \"a\", ' [1, 2) '" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected end it "parse and to_s of simple GAV #{type} with one exclusion" do expected = "#{type} g:a, 1, [a:b]" a = Jars::GemspecArtifacts::Artifact.new(expected) _(a.to_s).must_equal expected line = "#{type} 'g:a', '1', '[a:b]'" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} 'g:a', '1', ['a:b']" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} g,a,1,[a:b]" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected end it "parse and to_s of simple GAV #{type} with exclusions" do expected = "#{type} g:a, 1, [a:b, c:d]" a = Jars::GemspecArtifacts::Artifact.new(expected) _(a.to_s).must_equal expected line = "#{type} 'g:a', '1', ['a:b', 'c:d']'" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} g,a,1,[a:b,c:d]" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected end it "parse and to_s of simple GAV #{type} with exclusions and range" do expected = "#{type} g:a, (1, 2], [a:b, c:d]" a = Jars::GemspecArtifacts::Artifact.new(expected) _(a.to_s).must_equal expected line = "#{type} 'g:a', '(1,2]', ['a:b', 'c:d']'" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} g,a,(1,2],[a:b,c:d]" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} g,a,(1,2], :exclusions : [a:b,c:d]" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected end it "parse and to_s of simple GACV #{type}" do expected = "#{type} g:a, c, 1" a = Jars::GemspecArtifacts::Artifact.new(expected) _(a.to_s).must_equal expected line = "#{type} 'g:a', 'c', '1'" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} g,a,\"c\",1" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} g,a, 1 ,:classifier : c" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected end it "parse and to_s of simple GACV #{type} with range" do expected = "#{type} g:a, c, [1, 2)" a = Jars::GemspecArtifacts::Artifact.new(expected) _(a.to_s).must_equal expected _(a.scope).must_be_nil line = "#{type} g:a:c:[1, 2),:scope=>:runtime" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected _(a.scope).must_equal 'runtime' line = "#{type} g:a:c,'[1, 2)'" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} 'g', \"a\", 'c', ' [1, 2) '" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected line = "#{type} g,a,[1, 2),:classifier => c" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected end it "parse and to_s of simple GACV #{type} with exclusions and range" do expected = "#{type} g:a, c, (1, 2], [a:b, c:d]" a = Jars::GemspecArtifacts::Artifact.new(expected) _(a.to_s).must_equal expected _(a.scope).must_be_nil line = "#{type} 'g:a:c', '(1,2]', ['a:b', 'c:d']'" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected _(a.scope).must_be_nil line = "#{type} g,a,c,(1,2],[a:b,c:d], :scope => :compile" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected _(a.scope).must_equal 'compile' line = "#{type} g,a,(1,2],:classifier => c,:exclusions => [a:b,c:d]" a = Jars::GemspecArtifacts::Artifact.new(line) _(a.to_s).must_equal expected end end end describe Jars::GemspecArtifacts do let(:pwd) { File.dirname(File.expand_path(__FILE__)) } let(:example_spec) { File.join(pwd, '..', 'example', 'example.gemspec') } it 'retrieves artifacts from gemspec' do spec = Dir.chdir(File.dirname(example_spec)) do eval(File.read(example_spec)) # rubocop:disable Security/Eval end artifacts = Jars::GemspecArtifacts.new(spec) _(artifacts[0].to_s).must_equal('jar org.bouncycastle:bcpkix-jdk15on, 1.49') _(artifacts[1].to_s).must_equal('jar org.bouncycastle:bcprov-jdk15on, 1.49') _(artifacts[3].to_s).must_equal('jar io.dropwizard:dropwizard-logging, 0.8.0-rc5, [joda-time:joda-time]') _(artifacts[4].to_s).must_equal('jar com.google.protobuf:protobuf-java, lite, 2.2.0') _(artifacts[5].to_s).must_equal('jar junit:junit, 4.12') _(artifacts[0].scope).must_be_nil _(artifacts[1].scope).must_be_nil _(artifacts[2].scope).must_be_nil _(artifacts[3].scope).must_be_nil _(artifacts[4].scope).must_be_nil _(artifacts[5].scope).must_equal('test') _(artifacts[0].classifier).must_be_nil _(artifacts[1].classifier).must_be_nil _(artifacts[2].classifier).must_be_nil _(artifacts[3].classifier).must_be_nil _(artifacts[4].classifier).must_equal('lite') _(artifacts[5].classifier).must_be_nil _(artifacts[0].exclusions).must_be_nil _(artifacts[1].exclusions).must_be_nil _(artifacts[2].exclusions).must_be_nil _(artifacts[3].exclusions.to_s).must_equal('[joda-time:joda-time]') _(artifacts[4].exclusions).must_be_nil _(artifacts[5].exclusions).must_be_nil artifacts.each do |a| _(a.to_s).must_equal Jars::GemspecArtifacts::Artifact.new(a.to_s).to_s end _(artifacts.size).must_equal 7 end end jruby-jar-dependencies-92427b1/specs/jar_installer_spec.rb000066400000000000000000000062631515606370500236430ustar00rootroot00000000000000# frozen_string_literal: true require File.expand_path('setup', File.dirname(__FILE__)) require 'jars/installer' require 'fileutils' require 'rubygems/specification' module Jars class Installer def do_install(vendor, write) @vendor = vendor @write = write end attr_reader :vendor, :write end end describe Jars::Installer do let(:file) { File.join(pwd, 'deps.txt') } let(:pwd) { File.dirname(File.expand_path(__FILE__)) } let(:dir) { File.join(pwd, '..', 'pkg', 'tmp') } let(:jars) { File.join(dir, 'test_jars.rb') } let(:example_spec) { File.join(pwd, '..', 'example', 'example.gemspec') } before do FileUtils.rm_rf(dir) FileUtils.mkdir_p(dir) end it 'loads dependencies from maven' do deps = Jars::Installer.load_from_maven(file) _(deps.size).must_equal 45 deps.each { |d| _(d).must_be_kind_of(Jars::Installer::Dependency) } end it 'generates non-vendored require-file' do deps = Jars::Installer.load_from_maven(file) Jars::Installer.write_require_jars(deps, jars) File.read(jars).each_line do |line| _(line).must_match(/^\s{2}require(_jar)?\s'.+'$/) if line.size > 30 && !line.match(/^#/) end _( Dir[File.join(dir, '**')].size ).must_equal 1 end it 'generates vendored require-file' do deps = Jars::Installer.load_from_maven(file) Jars::Installer.write_require_jars(deps, jars) Jars::Installer.vendor_jars(deps, dir) File.read(jars).each_line do |line| _(line).must_match(/^\s{2}require(_jar)?\s'.+'$/) if line.size > 30 && !line.match(/^#/) end _( Dir[File.join(dir, '**', '*.jar')].size ).must_equal 45 end it 'just skips install_jars and vendor_jars if there are no requirements' do jar = Jars::Installer.new jar.install_jars # vendor method is a mocked method _(jar.vendor).must_be_nil jar.vendor_jars # vendor method is a mocked method _(jar.vendor).must_be_nil end it 'just skips install_jars and vendor_jars if platform is not java' do spec = Gem::Specification.load(example_spec) spec.platform = 'ruby' jar = Jars::Installer.new(spec) jar.install_jars # vendor method is a mocked method _(jar.vendor).must_be_nil jar.vendor_jars # vendor method is a mocked method _(jar.vendor).must_be_nil end it 'does install_jars and vendor_jars' do ENV['JARS_VENDOR'] = nil jar = Jars::Installer.new(example_spec) jar.install_jars # vendor method is a mocked method assert_nil jar.vendor ENV['JARS_VENDOR'] = 'false' jar.vendor_jars # vendor method is a mocked method assert_nil jar.vendor ENV['JARS_VENDOR'] = 'true' jar.vendor_jars # vendor method is a mocked method _(jar.vendor).must_equal 'lib' java.lang.System.set_property('jars.vendor', 'false') jar.vendor_jars # vendor method is a mocked method assert_nil jar.vendor end it 'installs dependencies ' do ENV['JARS_HOME'] = dir Jars.reset jar = Jars::Installer.new(example_spec) result = jar.send :install_dependencies _(result.size).must_equal 30 result.each do |d| _(d.type).must_equal :jar _(d.scope).must_equal :runtime end ENV['JARS_HOME'] = nil end end jruby-jar-dependencies-92427b1/specs/jars/000077500000000000000000000000001515606370500204035ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/jars/more/000077500000000000000000000000001515606370500213455ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/jars/more/sample/000077500000000000000000000000001515606370500226265ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/jars/more/sample/2/000077500000000000000000000000001515606370500227675ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/jars/more/sample/2/sample-2.jar000066400000000000000000000005251515606370500251070ustar00rootroot00000000000000PKҤEC META-INF/PKPKҤECMETA-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMu *h%&*8%krrPKGCDPKҤEC META-INF/PKҤECGCD=META-INF/MANIFEST.MFPK}jruby-jar-dependencies-92427b1/specs/jars_spec.rb000066400000000000000000000203471515606370500217500ustar00rootroot00000000000000# frozen_string_literal: true require File.expand_path('setup', File.dirname(__FILE__)) require 'stringio' describe Jars do before do @env = ENV.to_h # helpful when debugging Jars.reset end after do Jars.reset ENV.clear ENV.replace @env # restore ENV end it 'extract property' do ENV['SOME_JARS_HOME'] = 'bla' _(Jars.to_prop('some_jars_home')).must_equal 'bla' if defined? JRUBY_VERSION java.lang.System.set_property('some.jars.home', 'blabla') _(Jars.to_prop('some_jars_home')).must_equal 'blabla' end end it 'extract boolean property' do assert_nil Jars.to_boolean('JARS_SOMETHING') ENV['JARS_SOMETHING'] = 'falsy' _(Jars.to_boolean('JARS_SOMETHING')).must_equal false ENV[jars_verbose = 'JARS_VERBOSE'] = 'true' _(Jars.to_boolean(jars_verbose)).must_equal true _(Jars.verbose?).must_equal true _(jars_verbose).must_equal 'JARS_VERBOSE' # no mod if defined? JRUBY_VERSION jars_skip = 'JARS_SKIP' begin java.lang.System.set_property('jars.skip', 'true') java.lang.System.set_property('jars.quiet', 'false') java.lang.System.set_property('jars.debug', '') _(Jars.to_boolean(jars_skip)).must_equal true _(Jars.skip?).must_equal true _(jars_skip).must_equal 'JARS_SKIP' # no mod _(Jars.to_boolean('JARS_DEBUG')).must_equal true _(Jars.to_boolean('jars.quiet')).must_equal false ensure java.lang.System.clear_property('jars.skip') java.lang.System.clear_property('jars.quiet') java.lang.System.clear_property('jars.debug') end end end it 'extract maven settings' do settings = Jars.maven_settings # likely nil on CI ENV['JARS_MAVEN_SETTINGS'] = 'specs/settings.xml' Jars.reset _(settings).wont_equal Jars.maven_settings _(Jars.maven_settings).must_equal File.expand_path('specs/settings.xml') ENV['JARS_MAVEN_SETTINGS'] = nil Jars.reset Dir.chdir(File.dirname(__FILE__)) do _(settings).wont_equal Jars.maven_settings _(Jars.maven_settings).must_equal File.expand_path('settings.xml') end end it 'determines JARS_HOME' do ENV['M2_HOME'] = ENV['MAVEN_HOME'] = '' # so that it won't interfere ENV['JARS_QUIET'] = 'true' ENV['JARS_MAVEN_SETTINGS'] = 'does-not-exist/settings.xml' home = Jars.home _(home).must_equal(File.join(ENV['HOME'], '.m2', 'repository')) ENV['JARS_LOCAL_MAVEN_REPO'] = nil ENV['JARS_MAVEN_SETTINGS'] = File.join('specs', 'settings.xml') Jars.reset _(Jars.home).wont_equal home _(Jars.home).must_equal 'specs' ENV['JARS_MAVEN_SETTINGS'] = nil end it "determines JARS_HOME (when no ENV['HOME'] present)" do ENV['M2_HOME'] = ENV['MAVEN_HOME'] = '' # so that it won't interfere env_home = ENV['HOME'] ENV.delete('HOME') ENV['JARS_QUIET'] = true.to_s ENV['JARS_MAVEN_SETTINGS'] = 'does-not-exist/settings.xml' _(Jars.home).must_equal(File.join(env_home, '.m2', 'repository')) end it 'determines JARS_HOME (from global settings.xml)' do ENV['JARS_LOCAL_MAVEN_REPO'] = nil ENV['HOME'] = "/tmp/oul'bollocks!" ENV['M2_HOME'] = __dir__ ENV_JAVA['repo.path'] = 'specs' _(Jars.home).must_equal('specs/repository') ENV['JARS_LOCAL_MAVEN_REPO'] = nil end it 'raises RuntimeError on requires of unknown group-id' do _ { require_jar('org.something', 'slf4j-simple', '1.6.6') }.must_raise RuntimeError end # rubocop:disable Layout/LineLength it 'does not require jar but sets version to unknown' do ENV['JARS_HOME'] = File.join('specs', 'repo') Jars.reset begin _(require_jar('org.slf4j', 'slf4j-simple') { nil }).must_equal true $stderr = StringIO.new _(require_jar('org.slf4j', 'slf4j-simple') { '1.6.6' }).must_equal false _($stderr.string).must_equal "--- jar coordinate org.slf4j:slf4j-simple already loaded with version unknown - omit version 1.6.6\n" ensure $stderr = STDERR ENV['JARS_HOME'] = nil end end it 'warn on version conflict' do ENV['JARS_HOME'] = File.join('specs', 'repo') Jars.reset begin _(require_jar('org.slf4j', 'slf4j-simple', '1.6.6')).must_equal true $stderr = StringIO.new _(require_jar('org.slf4j', 'slf4j-simple') { '1.6.6' }).must_equal false _($stderr.string).must_equal '' $stderr = StringIO.new _(require_jar('org.slf4j', 'slf4j-simple', '1.6.4')).must_equal false _($stderr.string).must_equal "--- jar coordinate org.slf4j:slf4j-simple already loaded with version 1.6.6 - omit version 1.6.4\n" $stderr = StringIO.new _(require_jar('org.slf4j', 'slf4j-simple') { '1.6.4' }).must_equal false _($stderr.string).must_equal "--- jar coordinate org.slf4j:slf4j-simple already loaded with version 1.6.6 - omit version 1.6.4\n" $stderr = StringIO.new _(require_jar('org.slf4j', 'slf4j-simple') { nil }).must_equal false _($stderr.string).must_equal "--- jar coordinate org.slf4j:slf4j-simple already loaded with version 1.6.6 - omit version unknown\n" ensure $stderr = STDERR ENV['JARS_HOME'] = nil end end it 'finds jars on the load_path' do $LOAD_PATH << File.join('specs', 'load_path') ENV['JARS_HOME'] = 'something' Jars.reset begin $stderr = StringIO.new -> { require_jar('org.slf4j', 'slf4j-simple', '1.6.6') }.must_raise RuntimeError $stderr.flush $stderr = StringIO.new _(require_jar('org.slf4j', 'slf4j-simple', '1.6.4')).must_equal true _(require_jar('org.slf4j', 'slf4j-simple', '1.6.6')).must_equal false _($stderr.string).must_equal "--- jar coordinate org.slf4j:slf4j-simple already loaded with version 1.6.4 - omit version 1.6.6\n" ensure $stderr = STDERR ENV['JARS_HOME'] = nil end end # rubocop:enable Layout/LineLength it 'freezes jar loading unless jar is not loaded yet' do size = $CLASSPATH.length Jars.freeze_loading require 'jopenssl/version' require_jar 'org.bouncycastle', 'bcpkix-jdk15on', JOpenSSL::BOUNCY_CASTLE_VERSION _($CLASSPATH.length).must_equal size $stderr = StringIO.new require_jar 'org.bouncycastle', 'bcpkix-jdk15on', '1.46' _($stderr.string).must_equal '' ensure $stderr = STDERR end it 'allows to programatically disable require_jar' do require 'jopenssl/version' size = $CLASSPATH.length Jars.require = false out = require_jar 'org.bouncycastle', 'bcpkix-jdk15on', JOpenSSL::BOUNCY_CASTLE_VERSION assert_nil out out = require_jar 'org.jruby', 'jruby-rack', '1.1.16' assert_nil out _($CLASSPATH.length).must_equal size end it 'does not warn on conflicts after turning into silent mode' do skip('$CLASSPATH is not clean - need to skip spec') if $CLASSPATH.detect { |a| a.include?('bcpkix-jdk18on') } size = $CLASSPATH.length Jars.no_more_warnings require 'jopenssl/version' if require_jar('org.bouncycastle', 'bcpkix-jdk18on', JOpenSSL::BOUNCY_CASTLE_VERSION) _($CLASSPATH.length).must_equal(size + 1) end $stderr = StringIO.new require_jar 'org.bouncycastle', 'bcpkix-jdk18on', '1.70' _($stderr.string).must_equal '' ensure $stderr = STDERR end it 'no warnings on reload' do $stderr = StringIO.new load File.expand_path('lib/jar_dependencies.rb') _($stderr.string).must_equal '' ensure $stderr = STDERR end it 'requires jars from various default places' do pwd = File.expand_path(__dir__) $LOAD_PATH << File.join(pwd, 'path') $stderr = StringIO.new Jars.require_jars_lock # make sure we locked with no lock file Dir.chdir(pwd) do require_jar 'more', 'sample', '4' require_jar 'more', 'sample', '2' require_jar 'more', 'sample', '3' end _($stderr.string).wont_match(/omit version 1/) _($stderr.string).must_match(/omit version 2/) _($stderr.string).must_match(/omit version 3/) _($stderr.string).wont_match(/omit version 4/) ensure $stderr = STDERR $LOAD_PATH.delete(File.join(pwd, 'path')) end it 'lock is Jars.lock by default' do _(Jars.lock).must_equal 'Jars.lock' end it 'lock gets set during setup' do Jars.setup jars_lock: 'Jars_no_jline.lock' _(Jars.lock).must_equal 'Jars_no_jline.lock' end end jruby-jar-dependencies-92427b1/specs/load_path/000077500000000000000000000000001515606370500213775ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/load_path/org/000077500000000000000000000000001515606370500221665ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/load_path/org/slf4j/000077500000000000000000000000001515606370500232105ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/load_path/org/slf4j/slf4j-simple/000077500000000000000000000000001515606370500255215ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/load_path/org/slf4j/slf4j-simple/1.6.4/000077500000000000000000000000001515606370500261675ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/load_path/org/slf4j/slf4j-simple/1.6.4/slf4j-simple-1.6.4.jar000066400000000000000000000005251515606370500316440ustar00rootroot00000000000000PKUD META-INF/PKPKUDMETA-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMu ě*h%&*8%krrPKW+CDPKUD META-INF/PKUDW+CD=META-INF/MANIFEST.MFPK}jruby-jar-dependencies-92427b1/specs/maven_exec_spec.rb000066400000000000000000000026601515606370500231210ustar00rootroot00000000000000# frozen_string_literal: true require File.expand_path('setup', File.dirname(__FILE__)) require 'jars/maven_exec' require 'fileutils' require 'stringio' describe Jars::MavenExec do let(:pwd) { File.dirname(File.expand_path(__FILE__)) } let(:example_spec) { File.join(pwd, '..', 'example', 'example.gemspec') } let(:spec_with_require_relative) do File.join(pwd, 'example', 'gem_with_require_relative', 'gem_with_require_relative.gemspec') end after do Jars.reset end it 'should not warn if gemspec contains require_relative' do Dir.chdir File.dirname(spec_with_require_relative) do $stderr = StringIO.new Jars::MavenExec.new _($stderr.string).must_equal '' ensure $stderr = STDERR end end it 'finds the gemspec file when the Gem::Specification.spec_file is wrong' do spec = Dir.chdir(File.dirname(example_spec)) do eval(File.read(example_spec)) # rubocop:disable Security/Eval end spec.loaded_from = spec.spec_file # mimic bundler case FileUtils.rm_f(spec.spec_file) def spec.gem_dir=(dir) @d = dir end def spec.gem_dir @d end spec.gem_dir = File.dirname(example_spec) # now test finding the gemspec file jar = Jars::MavenExec.new(spec) _(jar.instance_variable_get(:@basedir)).must_equal File.expand_path(spec.gem_dir) _(jar.instance_variable_get(:@specfile)).must_equal File.expand_path(example_spec) end end jruby-jar-dependencies-92427b1/specs/maven_factory_spec.rb000066400000000000000000000052731515606370500236470ustar00rootroot00000000000000# frozen_string_literal: true require File.expand_path('setup', File.dirname(__FILE__)) require 'jars/maven_factory' describe Jars::MavenFactory do after do ENV['JARS_VERBOSE'] = nil ENV['JARS_DEBUG'] = nil ENV['JARS_MAVEN_SETTINGS'] = nil Jars.reset end it 'uses logging config' do ENV['JARS_VERBOSE'] = nil ENV['JARS_DEBUG'] = nil Jars.reset maven = Jars::MavenFactory.new.maven_new('pom') _(maven.options.key?('--quiet')).must_equal true _(maven.options.key?('-X')).must_equal false _(maven.options['-Dverbose']).must_equal false ENV['JARS_VERBOSE'] = 'true' ENV['JARS_DEBUG'] = nil Jars.reset maven = Jars::MavenFactory.new.maven_new('pom') _(maven.options.key?('--quiet')).must_equal false _(maven.options.key?('-e')).must_equal true _(maven.options.key?('-X')).must_equal false _(maven.options['-Dverbose']).must_equal true ENV['JARS_VERBOSE'] = nil ENV['JARS_DEBUG'] = 'true' Jars.reset maven = Jars::MavenFactory.new.maven_new('pom') _(maven.options.key?('--quiet')).must_equal false _(maven.options.key?('-e')).must_equal false _(maven.options.key?('-X')).must_equal true _(maven.options['-Dverbose']).must_equal true ENV['JARS_VERBOSE'] = 'true' ENV['JARS_DEBUG'] = 'true' Jars.reset maven = Jars::MavenFactory.new.maven_new('pom') _(maven.options.key?('--quiet')).must_equal false _(maven.options.key?('-e')).must_equal true _(maven.options.key?('-X')).must_equal true _(maven.options['-Dverbose']).must_equal true end it 'uses proxy settings from Gem.configuration' do skip('pending until it realy works') ENV['JARS_MAVEN_SETTINGS'] = 'specs/does/no/exists/settings.xml' Gem.configuration[:proxy] = 'https://localhost:3128' Jars.reset maven = Jars::MavenFactory.new.maven_new('pom') _(maven.options.key?('-DproxySet=true')).must_equal true _(maven.options.key?('-DproxyHost=localhost')).must_equal true _(maven.options.key?('-DproxyPort=3128')).must_equal true Gem.configuration[:proxy] = :noproxy Jars.reset maven = Jars::MavenFactory.new.maven_new('pom') _(maven.options.key?('-DproxySet=true')).must_equal false _(maven.options.key?('-DproxyHost=localhost')).must_equal false _(maven.options.key?('-DproxyPort=3128')).must_equal false ENV['JARS_MAVEN_SETTINGS'] = 'specs/settings.xml' Gem.configuration[:proxy] = 'https://localhost:3128' Jars.reset maven = Jars::MavenFactory.new.maven_new('pom') _(maven.options.key?('-DproxySet=true')).must_equal false _(maven.options.key?('-DproxyHost=localhost')).must_equal false _(maven.options.key?('-DproxyPort=3128')).must_equal false end end jruby-jar-dependencies-92427b1/specs/path/000077500000000000000000000000001515606370500204005ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/path/more/000077500000000000000000000000001515606370500213425ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/path/more/sample/000077500000000000000000000000001515606370500226235ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/path/more/sample/4/000077500000000000000000000000001515606370500227665ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/path/more/sample/4/sample-4.jar000066400000000000000000000005251515606370500251100ustar00rootroot00000000000000PKҤEC META-INF/PKPKҤECMETA-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMu *h%&*8%krrPKGCDPKҤEC META-INF/PKҤECGCD=META-INF/MANIFEST.MFPK}jruby-jar-dependencies-92427b1/specs/repo/000077500000000000000000000000001515606370500204115ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/repo/org/000077500000000000000000000000001515606370500212005ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/repo/org/slf4j/000077500000000000000000000000001515606370500222225ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/repo/org/slf4j/slf4j-simple/000077500000000000000000000000001515606370500245335ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/repo/org/slf4j/slf4j-simple/1.6.4/000077500000000000000000000000001515606370500252015ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/repo/org/slf4j/slf4j-simple/1.6.4/slf4j-simple-1.6.4.jar000066400000000000000000000005251515606370500306560ustar00rootroot00000000000000PKUD META-INF/PKPKUDMETA-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMu ě*h%&*8%krrPKW+CDPKUD META-INF/PKUDW+CD=META-INF/MANIFEST.MFPK}jruby-jar-dependencies-92427b1/specs/repo/org/slf4j/slf4j-simple/1.6.6/000077500000000000000000000000001515606370500252035ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/repo/org/slf4j/slf4j-simple/1.6.6/slf4j-simple-1.6.6.jar000066400000000000000000000005251515606370500306620ustar00rootroot00000000000000PKUD META-INF/PKPKUDMETA-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMu ě*h%&*8%krrPKW+CDPKUD META-INF/PKUDW+CD=META-INF/MANIFEST.MFPK}jruby-jar-dependencies-92427b1/specs/repository/000077500000000000000000000000001515606370500216635ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/repository/.keep000066400000000000000000000000001515606370500225760ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/settings.xml000066400000000000000000000001041515606370500220210ustar00rootroot00000000000000 specs jruby-jar-dependencies-92427b1/specs/setup.rb000066400000000000000000000005051515606370500211310ustar00rootroot00000000000000# frozen_string_literal: true # single spec setup $LOAD_PATH.unshift File.join(File.dirname(File.expand_path(__FILE__)), '../lib') ENV['JARS_HOME'] = nil require 'jar_dependencies' p ENV['JARS_LOCAL_MAVEN_REPO'] = Jars.home Jars.reset begin require 'minitest' rescue LoadError # ignore end require 'minitest/autorun' jruby-jar-dependencies-92427b1/specs/vendor/000077500000000000000000000000001515606370500207415ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/vendor/jars/000077500000000000000000000000001515606370500217005ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/vendor/jars/more/000077500000000000000000000000001515606370500226425ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/vendor/jars/more/sample/000077500000000000000000000000001515606370500241235ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/vendor/jars/more/sample/3/000077500000000000000000000000001515606370500242655ustar00rootroot00000000000000jruby-jar-dependencies-92427b1/specs/vendor/jars/more/sample/3/sample-3.jar000066400000000000000000000005251515606370500264060ustar00rootroot00000000000000PKҤEC META-INF/PKPKҤECMETA-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMu *h%&*8%krrPKGCDPKҤEC META-INF/PKҤECGCD=META-INF/MANIFEST.MFPK}