Eclipse裡如果看不到Attach Source按鈕應該怎麼辦

i042416發表於2020-09-21

When I am creating unit test for one of my Java project A, I try to have a look at the source code of this annotation:


Eclipse裡如果看不到Attach Source按鈕應該怎麼辦


Once I press Ctrl and click, I see this message below. The “Attach Source” button is not there.


Eclipse裡如果看不到Attach Source按鈕應該怎麼辦


However I tried another project B in my laptop, it works:


Eclipse裡如果看不到Attach Source按鈕應該怎麼辦


This is strange. Then I compare the build path of two projects and find the reason. For project A, it uses Eclipse embedded JUnit:


Eclipse裡如果看不到Attach Source按鈕應該怎麼辦


While for project B, the JUnit managed by Maven is used.


Eclipse裡如果看不到Attach Source按鈕應該怎麼辦


So the easiest approach for project A is to also switch to the external JUnit instead of Eclipse embedded one, so that developers have full control on both binary code and source code.


Eclipse裡如果看不到Attach Source按鈕應該怎麼辦


In Eclipse installation folder there is a folder plugin, within it there is an about.html,


Eclipse裡如果看不到Attach Source按鈕應該怎麼辦


the binary file and source code could be downloaded from url mentioned.


Eclipse裡如果看不到Attach Source按鈕應該怎麼辦


After that, go to project A,


Eclipse裡如果看不到Attach Source按鈕應該怎麼辦


replace with:


Eclipse裡如果看不到Attach Source按鈕應該怎麼辦


Now the source code for JUnit is also available for project A:


Eclipse裡如果看不到Attach Source按鈕應該怎麼辦


要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":

Eclipse裡如果看不到Attach Source按鈕應該怎麼辦


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2722713/,如需轉載,請註明出處,否則將追究法律責任。

相關文章