[英]Always update bundles from remote repo or disable local repo in ServiceMix 6.0.X / Karaf 3.0.X
我在測試環境中從遠程倉庫更新捆綁軟件時遇到問題。 環境包括帶有ServiceMix(或同為Karaf)的多個服務器和帶有JFrog Artifactory的服務器。
在karaf 3.0.X
之前,我們使用SNAPSHOT版本動態更新可用OSGi容器上的捆綁軟件,但是現在karaf搜索捆綁軟件在本地存儲庫中,如果存在,則永遠不要檢查遠程存儲庫(人工工廠)上的最新版本。 我該如何解決?
karaf和maven的配置示例(已為用戶設置M2_HOME
)
settings.xml( $M2_HOME/conf/settings.xml
)
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups/>
<proxies/>
<servers/>
<mirrors/>
<profiles>
<profile>
<id>default-repo-settings</id>
<activation>
<activeByDefault/>
</activation>
<repositories>
<repository>
<id>artifactory</id>
<url>http://artifactory/ext-snapshot-local</url>
<snapshots>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
<!-- same repos here -->
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>default-repo-settings</activeProfile>
</activeProfiles>
</settings>
org.ops4j.pax.url.mvn.cfg( $KARAF_HOME/etc/org.ops4j.pax.url.mvn.cfg
)
org.ops4j.pax.url.mvn.useFallbackRepositories=false
org.ops4j.pax.url.mvn.disableAether=true
org.ops4j.pax.url.mvn.useLocalRepositoryAsRemote=true
org.ops4j.pax.url.mvn.globalUpdatePolicy=always
org.ops4j.pax.url.mvn.defaultRepositories=file:${karaf.home}}/${karaf.default.repository}}@snapshots@id=karaf.${karaf.default.repository}}
org.ops4j.pax.url.mvn.repositories= \
http://artifactory/ext-snapshot-local@snapshots@id=artifactory, \
http://repo1.maven.org/maven2@id=central, \
http://repository.springsource.com/maven/bundles/release@id=spring.ebr.release, \
http://repository.springsource.com/maven/bundles/external@id=spring.ebr.external, \
http://zodiac.springsource.com/maven/bundles/release@id=gemini, \
http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases, \
https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@noreleases, \
https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases
最好簡化您的工件升級方法,使其只有一個位置才能將工件傳輸到SMX / Karaf容器。 我建議設置您的Artifactory,以便您有一個虛擬存儲庫,它將您的內部存儲庫與遠程存儲庫(Maven Central,Spring等)合並。 您的容器應僅指向您的內部Artifactory實例。 這也使您的Artifactory可以緩存遠程倉庫,而您不再依賴於Internet的建立以及遠程Maven Repos的建立。
現在,無論何時您執行“更新$ bundleId”,它都會查詢虛擬存儲庫,Artifactory將在-SNAPSHOT工件上為您提供最佳的匹配項。
另外,從本地文件中刪除@snapshots可能是個好主意:repo行,以幫助避免混淆。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.