欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Eclipse里如果看不到Attach Source按钮应该怎么办 eclipsejavasapSAP云平台SAP Cloud Platform 

程序员文章站 2022-03-05 19:14:07
...

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按钮应该怎么办
            
    
    
        eclipsejavasapSAP云平台SAP Cloud Platform 

 

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

 

Eclipse里如果看不到Attach Source按钮应该怎么办
            
    
    
        eclipsejavasapSAP云平台SAP Cloud Platform 

 

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

 

Eclipse里如果看不到Attach Source按钮应该怎么办
            
    
    
        eclipsejavasapSAP云平台SAP Cloud Platform 

 

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按钮应该怎么办
            
    
    
        eclipsejavasapSAP云平台SAP Cloud Platform 

 

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

 

Eclipse里如果看不到Attach Source按钮应该怎么办
            
    
    
        eclipsejavasapSAP云平台SAP Cloud Platform 

 

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按钮应该怎么办
            
    
    
        eclipsejavasapSAP云平台SAP Cloud Platform 

 

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

 

Eclipse里如果看不到Attach Source按钮应该怎么办
            
    
    
        eclipsejavasapSAP云平台SAP Cloud Platform 

 

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

 

Eclipse里如果看不到Attach Source按钮应该怎么办
            
    
    
        eclipsejavasapSAP云平台SAP Cloud Platform 

 

After that, go to project A,

 

Eclipse里如果看不到Attach Source按钮应该怎么办
            
    
    
        eclipsejavasapSAP云平台SAP Cloud Platform 

 

replace with:

 

Eclipse里如果看不到Attach Source按钮应该怎么办
            
    
    
        eclipsejavasapSAP云平台SAP Cloud Platform 

 

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

 

Eclipse里如果看不到Attach Source按钮应该怎么办
            
    
    
        eclipsejavasapSAP云平台SAP Cloud Platform 

 

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

Eclipse里如果看不到Attach Source按钮应该怎么办
            
    
    
        eclipsejavasapSAP云平台SAP Cloud Platform