2017-04-09 131 views
3

我想與Aerospike一起使用並使用Spring Data。我發現有用的圖書館爲我的目標here彈簧數據aerospike

但是,但將其添加到依賴關係中,來自示例的此代碼仍找不到依賴關係。

@Configuration 
@EnableAerospikeRepositories(basePackageClasses = 
ContactRepository.class) 
class ApplicationConfig extends AbstractAerospikeConfiguration { 
public @Bean(destroyMethod = "close") AerospikeClient aerospikeClient() { 

    ClientPolicy policy = new ClientPolicy(); 
    policy.failIfNotConnected = true; 

    return new AerospikeClient(policy, "localhost", 3000); 
} 

public @Bean AerospikeTemplate aerospikeTemplate() { 
    return new AerospikeTemplate(aerospikeClient(), "bar"); 
} 
} 

更少的信息可以在谷歌找到。我已經嘗試添加另一個回購,如:

<repositories> 
    <repository> 
     <id>spring-milestone</id> 
     <url>https://repo.spring.io/libs-release</url> 
    </repository> 
</repositories> 

此外,你可以找到示例項目here的。你猜怎麼着?這也不會被建立。

我已經安裝了最新的Maven,更新過的庫,仍然沒有結果。也許我錯過了一些核心依賴關係?

編輯:

我已經添加,就像任何其他的依賴。首先,它根本沒有被發現,但在更新Maven後,看起來確定。但是,我仍然無法導入所需的來源。

 <dependency> 
     <groupId>org.springframework.data</groupId> 
     <artifactId>spring-data-aerospike</artifactId> 
     <version>1.5.0.RELEASE</version> 
     </dependency> 
+0

你是如何添加'spring-data-aerospike'依賴的?你可以顯示相關的pom.xml代碼片段嗎? –

+0

@romanpuchkovskiy,我已更新問題 – quento

回答

3

這很奇怪,但:

  1. 這不是在中央:http://search.maven.org/#search%7Cga%7C1%7Cspring-data-aerospike
  2. 這不是春天的libs釋放:https://repo.spring.io/libs-release/org/springframework/data/
  3. 存在libs-快照快照:https://repo.spring.io/libs-snapshot/org/springframework/data/spring-data-aerospike/
  4. 這裏http://www.aerospike.jp/docs/connectors/spring/tutorial_1.html本教程取決於spring-boot-starter-data-aerospike其版本爲0.0.1-SNAPSHOT,並且spring-boot-starter-data-aerospike不在插件釋放庫:https://repo.spring.io/plugins-release/org/springframework/boot/
  5. 在他們的主人pom.xmlhttps://github.com/spring-projects/spring-data-aerospike/blob/master/pom.xml版本是1.0.1.BUILD-SNAPSHOT這是不1.5.0.RELEASE和preceeds它
  6. 有在他們的GitHub庫中沒有標籤,沒有釋放。

所以看起來沒有公開發布什麼時候進行,並且他們的「添加Maven的依賴關係」(在你加入其中,1.5.0.RELEASE版本之一)建議將只是不工作。

要在您的項目中使用此庫,您可以通過git進行結帳,構建項目(mvn install),然後在本地存儲庫中使用它。源可以手動附加到您的IDE。要在其他機器上構建,可以分發您構建的jar,並使用mvn deploy:deploy-file將其安裝到本地存儲庫。

+0

謝謝,羅馬! – quento

+0

也應該像「mvn install -DskipTests」一樣運行它 – quento

1

Aerospike連接器的Spring Data已經使用com.aerospike group id發佈,現在您可以從maven central下載它。

創建了一個新的example project,它使用Spring Data for Aerospike。

tutorial也已更新以匹配示例項目。