我们想为wso2 carbon编写自己的自定义扩展(功能)。是否有一些创作功能的文档?
我们确实设法“破解”我们编写自定义功能的方式。但我们如何主持它呢?看来Carbon正在研究一些非常具体的存储库描述符 - artifacts.jar和content.jar
如何在不加入Carbon构建的情况下生成这些描述符。是否有一些文档描述了如何设置第三方功能存储库?
答案 0 :(得分:1)
Creating-your-own-wso2-carbon-components网络研讨会讨论了创建碳组件以及这些组件的功能。它涵盖了很多基础知识和最佳实践。
要托管您编写的已创建功能,您需要从这些功能生成p2-repository。 p2-repo概念来自WSO2产品使用的下划线Eclipse equinox项目。
WSO2编写了自己的maven插件,名为carbon-p2-plugin,有助于生成p2-repo。这是你如何做到这一点。只需创建一个新的maven项目(打包:pom),然后在carbon-p2-plugin插件配置下设置要发布的功能。以下是您可以使用的示例pom.xml。这是从p2-repo generation pom.xml of carbon 4.1.0复制的,我简化了它。
我测试了这个pom文件,它对我有用。有两个示例功能定义。将这些featureArtifactDef替换为您自己的功能定义。格式为$ groupId:$ artifactId:$ version。
当你通过maven构建它时,maven会创建target / p2-repo目录。它包含p2-repository,其中包含完整的p2-repo,包括artifacts.jar和content.jar。您可以使用此文件夹来安装功能,也可以将其托管在某个位置。托管没有特殊要求。
<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/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.carbon</groupId>
<artifactId>carbon-features</artifactId>
<version>4.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mysample-feature-repository</artifactId>
<version>4.1.0</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Feature Repository</name>
<build>
<plugins>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<id>2-p2-repo-generation</id>
<phase>package</phase>
<goals>
<goal>p2-repo-gen</goal>
</goals>
<configuration>
<p2AgentLocation>${basedir}/target/p2-agent</p2AgentLocation>
<metadataRepository>file:${basedir}/target/p2-repo</metadataRepository>
<artifactRepository>file:${basedir}/target/p2-repo</artifactRepository>
<publishArtifacts>true</publishArtifacts>
<publishArtifactRepository>true</publishArtifactRepository>
<featureArtifacts>
<!-- change the featureArtifactDef to match your needs -->
<featureArtifactDef>
org.wso2.carbon:org.wso2.carbon.service.mgt.feature:4.1.0
</featureArtifactDef>
<featureArtifactDef>
org.wso2.carbon:org.wso2.carbon.registry.core.feature:4.1.0
</featureArtifactDef>
</featureArtifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>