[英]How to efficiently manage third-party dependencies with p2-maven-plugin?
為了管理Eclipse RCP應用程序(使用Tycho構建)中的第三方依賴項,我使用p2-maven-plugin和Jetty將maven中心工件轉換為bundle,並將它們作為我的Target定義文件中的P2存儲庫提供。 我的設置和工作流程如下:
所以我有3個問題:
總而言之,您如何管理團隊中的第三方依賴項?
問題是,當你構建一個p2站點元數據時,還會生成包含bundels信息的“context.xml”和“artifact.xml”。 p2解析器用於解析捆綁包的這些元數據。 所以我認為如果不重建網站,將很難讓你的p2 repo更新。
我的建議:自從你在團隊中工作以來,最簡單的方法是為所有第三方依賴項建立一個獨立的存儲庫(nexus,jetty,tomcat ......)(你可以使用category.xml )。
部署重新創建的p2並不是什么大問題,您可以在同一個pom中使用wagon-maven-plugin
創建您的站點並將其綁定到部署階段,因此使用mvn clean deploy
可以創建和部署您的存儲庫
例:
<build>
<plugins>
<plugin>
<groupId>org.reficio</groupId>
<artifactId>p2-maven-plugin</artifactId>
<version>1.2.0-SNAPSHOT</version>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<artifacts>
<!-- specify your depencies here -->
<!-- groupId:artifactId:version -->
<artifact><id>commons-io:commons-io:2.1</id></artifact>
<artifact><id>commons-lang:commons-lang:2.4</id></artifact>
<artifact><id>commons-lang:commons-lang:2.5</id></artifact>
<artifact><id>commons-lang:commons-lang:2.6</id></artifact>
<artifact><id>org.apache.commons:commons-lang3:3.1</id></artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>upload-repo</id>
<phase>deploy</phase>
<goals>
<goal>upload</goal>
</goals>
<configuration>
<fromDir>${project.build.directory}/repository/</fromDir>
<includes>*/**</includes>
<serverId>my-p2-repository</serverId>
<url>dav:http://mycompany.com/../content/repositories</url>
<toDir>thirdparty-p2-repository</toDir>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>
<distributionManagement>
<repository>
<id>my-p2-repository</id>
<url>dav:http://mycompany.com/../content/repositories</url>
</repository>
</distributionManagement>
注意:pom的distributionManagement部分中URL的ID需要與settings.xml文件中服務器部分的ID匹配。
在settings.xml中添加服務器:
<server>
<id>my-p2-repository</id>
<username>...</username>
<password>...</password>
</server>
希望這可以幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.