Eclipse 尝试使用混合的osgi和非osgi包生成p2站点
我尝试了很多方法来创建一个p2存储库,其中包含项目的所有可传递(OSGI和非OSGI)maven依赖项,但是tycho只考虑OSGI.bundleEclipse 尝试使用混合的osgi和非osgi包生成p2站点,eclipse,maven,osgi,tycho,p2,Eclipse,Maven,Osgi,Tycho,P2,我尝试了很多方法来创建一个p2存储库,其中包含项目的所有可传递(OSGI和非OSGI)maven依赖项,但是tycho只考虑OSGI.bundle maven依赖插件复制所有maven文件,并tycho-p2-extras-plugin为p2站点生成元数据tycho-p2-repository-plugin使用先前下载的/target/source/plugins依赖项生成p2存储库 <project xmlns="http://maven.apache.org/POM/4.0.0" xm
maven依赖插件
复制所有maven文件,并tycho-p2-extras-plugin
为p2站点生成元数据tycho-p2-repository-plugin
使用先前下载的/target/source/plugins
依赖项生成p2存储库
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.genstar</groupId>
<version>1.0.0</version>
<artifactId>genstar-bundle</artifactId>
<packaging>pom</packaging>
<properties>
<tycho.version>0.26.0</tycho.version>
</properties>
<dependencies>
<dependency>
<groupId>org.genstar</groupId>
<artifactId>genstar-core</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>bintray-anrgenstar-genstar-packages</id>
<name>bintray</name>
<url>http://dl.bintray.com/anrgenstar/genstar-packages</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>copy-bundles-for-publishing</id>
<phase>process-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/target/source/plugins</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-p2-extras-plugin</artifactId>
<version>${tycho.version}</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>publish-features-and-bundles</goal>
</goals>
</execution>
</executions>
<configuration>
<includeAllDependencies>true</includeAllDependencies>
<compress>false</compress>
<append>false</append>
<publishArtifacts>true</publishArtifacts>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-plugin</artifactId>
<version>${tycho.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>category-p2-metadata</goal>
</goals>
</execution>
</executions>
<configuration>
<target>${basedir}/target/repository</target>
<categoryDefinition>${project.basedir}/category.xml</categoryDefinition>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-repository-plugin</artifactId>
<configuration>
<includeAllDependencies>true</includeAllDependencies>
</configuration>
<version>${tycho.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>archive-repository</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
由tycho
在mvn clean install
之后生成的最终存储库仅包含:
-rw-r--r-- 1 reyman reyman 50K janv. 19 23:15 genstar-core_1.0.0.jar
-rw-r--r-- 1 reyman reyman 166K janv. 19 23:15 javax.vecmath_1.5.2.jar
-rw-r--r-- 1 reyman reyman 72K janv. 19 23:15 org.apache.commons.codec_1.5.0.jar
-rw-r--r-- 1 reyman reyman 181K janv. 19 23:15 org.apache.commons.io_2.4.0.jar
-rw-r--r-- 1 reyman reyman 214K janv. 19 23:15 org.apache.logging.log4j.api_2.7.0.jar
-rw-r--r-- 1 reyman reyman 1,3M janv. 19 23:15 org.apache.logging.log4j.core_2.7.0.jar
-rw-r--r-- 1 reyman reyman 32K janv. 19 23:15 slf4j.api_1.7.12.jar
-rw-r--r-- 1 reyman reyman 537K janv. 19 23:15 xstream_1.4.9.jar
正如您所看到的,只有一部分(osgi包)存在,为什么?如何将mavenmaven dependency plugin
下载的所有可传递依赖项包含在此p2存储库中
即使是一个空的category.xml
也会生成一个artifact.xml
,其中包含这些行,这些行似乎在过滤osgi.bundle
:s
<mappings size='3'>
<rule filter='(& (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/>
<rule filter='(& (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/>
<rule filter='(& (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/>
</mappings>
如何在tycho中删除这些规则?为什么要将非OSGi JAR放入p2存储库?Eclipse无论如何都无法安装这些。也许这是个坏主意,这个类似Eclipse项目的插件需要访问所有可传递的依赖项,其中许多依赖项都是maven非osgi:/所以我的第一个想法是创建一个本地p2存储库,以生成暴露在Eclipse新软件菜单中的插件+p2站点
<mappings size='3'>
<rule filter='(& (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/>
<rule filter='(& (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/>
<rule filter='(& (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/>
</mappings>