2013-04-30 82 views
0

我正在嘗試將源代碼添加到我的項目中。我手動添加了下面的回購,幷包含一個氣氛快照。如何在我的項目中獲取源代碼

<repositories> 
    <!-- Added to get the Atmosphere 1.1.0-SNAPSHOT, can be removed when 1.1.0 is released --> 
    <repository> 
     <id>oss.sonatype.org-snapshot</id> 
     <url>http://oss.sonatype.org/content/repositories/snapshots</url> 
     <releases><enabled>false</enabled></releases> 
     <snapshots><enabled>true</enabled></snapshots> 
    </repository> 
</repositories> 
<dependencies> 
    <dependency> 
     <groupId>org.atmosphere</groupId> 
     <artifactId>atmosphere-runtime</artifactId> 
     <version>1.1.0-SNAPSHOT</version> 
     <exclusions> 
      <exclusion> 
       <groupId>org.slf4j</groupId> 
       <artifactId>slf4j-api</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
</dependencies> 

我去了,從here下載.jar,但是當我把它添加到「庫」部分中我的項目結構不將其添加爲源,但在類添加它。

在查看某個類的界面時,我使用編輯器頂部的快速「Attach sources ...」選項,並且無濟於事導航到.jar。

+0

Maven項目工具窗口有一個按鈕來下載來源和文檔。 – CrazyCoder 2013-04-30 14:49:04

+0

自動下載程序未找到源。我不知道爲什麼,但它失敗了。所以我試圖手動做到這一點。 – Webnet 2013-04-30 14:53:35

回答

0

Maven沒有找到源代碼,因爲該Maven倉庫中沒有該庫的來源(我認爲這對於庫的快照而言是相當常見的)。我下載了一個罐子,它們只包含類文件,所以我想知道,即使手動添加罐子,你如何看到源代碼。

+0

我一直無法查看來源,這就是爲什麼我很困惑。感謝您確認沒有任何資源可用。 – Webnet 2013-05-01 13:06:28

+0

Maven希望源代碼在以下命名方案中的jar中:artifactid-version-sources.jar,例如大氣運行-1.0.12-sources.jar。通常只有在發佈一個Maven工件時纔會創建它們。如您所見,https://oss.sonatype.org/content/repositories/releases/org/atmosphere/atmosphere-runtime/1.0.12/中的發佈工件包含源jar,快照則不包含。 – dunni 2013-05-01 15:29:18

相關問題