簡體   English   中英

在eclipse項目中將外部源文件夾與名稱“src”鏈接

[英]Linking external source folder with name “src” in an eclipse project

這不是關於在eclipse java項目中鏈接源的問題

是否可以在eclipse中添加名為“src”的外部文件夾作為源文件夾。 這里的問題是將外部文件夾名稱保留為“src”而不是任何其他名稱; 為此,我嘗試從標准的eclipse java項目中刪除src和bin文件夾,然后嘗試“鏈接源”,但這不起作用。

有沒有其他方法可以實現這一目標?

那就是讓Eclipse java項目的src實際上指向一個名為“src”的外部文件夾? 與輸出文件夾“bin”類似的問題也是如此。

System Information
OS: Windows 8, 32 bit
Eclipse: 3.7

謝謝。

您需要使用Eclipse從項目配置中刪除現有的源文件夾,然后將其從文件系統中刪除,然后您可以將外部鏈接的源文件夾添加為“src”。

  1. 右鍵單擊項目並調出“屬性...”

  2. 單擊“Java Build Path”,然后單擊“Source”選項卡以顯示構建路徑上的源文件夾列表。

  3. 選擇“yourproject / src”並單擊“刪除”按鈕。 這將從項目(和.classpath文件)中刪除它。

  4. 走出它並物理刪除該文件夾。

  5. 返回該對話框,這次單擊“鏈接源...”。 它現在應該工作。 這個對我有用。

要與外部文件夾建立鏈接,我們需要重命名文件夾,如果已存在任何具有相同名稱的文件夾,如“src”或更好刪除該文件夾。 之后,您可以使用以下任一方法與外部文件夾建立鏈接:

方法:1 - (通過代碼手動建立鏈接):

1. Open the .project file from root folder of your workspace.
2. Include the below code with your file path:
    <linkedResources>
        <link>
            <name>folder_name_list_in_your_project</name>
            <type>2</type>
            <location>folder_path_to_include</location>
        </link>
    </linkedResources>
3. Save the file and refresh the project to include the external folder in your project.

方法:2 - (通過UI手動建立鏈接):

1. Right click the project, select "Build Path -> Configure Build Path".
2. Choose "Source" tab.
3. Click "Link Source" button.
4. Click "Browse" to choose the folder.
5. Enter the folder name in "Folder name" field to list the external name in your project.
6. If you need to add the pattern for include and/or exclude file, click "Next" and enter the pattern. Then click "Finish".
7. Otherwise click "Finish".

它對我有用,希望我的步驟也能幫到你。

這有點難看,但您可以在文件系統中創建一個硬鏈接。 在Windows命令行中,使用mklink /H src d:\\path\\to\\external\\src

我知道以下內容幾乎沒有用,但是:想一想不同的方法。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM