[英]How to efficiently manage third-party dependencies with p2-maven-plugin?
In order to manage third-party dependencies in an Eclipse RCP application (built with Tycho) I am using the p2-maven-plugin and Jetty to convert maven central artifacts to bundles and make them available as a P2 repository in my Target definition file. 为了管理Eclipse RCP应用程序(使用Tycho构建)中的第三方依赖项,我使用p2-maven-plugin和Jetty将maven中心工件转换为bundle,并将它们作为我的Target定义文件中的P2存储库提供。 My setup and workflow is as follows : 我的设置和工作流程如下:
So I have 3 questions: 所以我有3个问题:
To conclude, how do you manage third-party dependencies in your team ? 总而言之,您如何管理团队中的第三方依赖项?
the problem is, when you build a p2 site metadata will be generated also "context.xml" and "artifact.xml" containing the bundels inforamtion. 问题是,当你构建一个p2站点元数据时,还会生成包含bundels信息的“context.xml”和“artifact.xml”。 these metadata used by the p2 resolver for resolvin the bundles. p2解析器用于解析捆绑包的这些元数据。 so i think without rebuilding the site it will be a hard way to get your p2 repo updated. 所以我认为如果不重建网站,将很难让你的p2 repo更新。
my suggestion: the clearst way to go since you working in a team is to have a standalone Repository (nexus, jetty, tomcat...) for all third party dependencies ( you may use the category.xml ). 我的建议:自从你在团队中工作以来,最简单的方法是为所有第三方依赖项建立一个独立的存储库(nexus,jetty,tomcat ......)(你可以使用category.xml )。
deploying the recreated p2 is not a big deal you can use wagon-maven-plugin
in the same pom creating your site and bind it to the deploy phase, so with mvn clean deploy
you get your repository created and deployed 部署重新创建的p2并不是什么大问题,您可以在同一个pom中使用wagon-maven-plugin
创建您的站点并将其绑定到部署阶段,因此使用mvn clean deploy
可以创建和部署您的存储库
Example: 例:
<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>
Note: The ID of the URL in the distributionManagement section of your pom needs to match the ID of a server section in your settings.xml file. 注意:pom的distributionManagement部分中URL的ID需要与settings.xml文件中服务器部分的ID匹配。
add the server in settings.xml: 在settings.xml中添加服务器:
<server>
<id>my-p2-repository</id>
<username>...</username>
<password>...</password>
</server>
hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.