Creating-your-own-wso2-carbon-components seminarium internetowe omawia tworzenie elementów węglowych i funkcję tych komponentów. Obejmuje on wiele podstaw i najlepszych praktyk.
Do hostowania utworzonych funkcji, które napisałeś, musisz wygenerować repozytorium p2 z tych funkcji. Koncepcja p2-repo pochodzi z projektu Eclipse equinox, który wykorzystują produkty WSO2.
WSO2 napisało własną wtyczkę maven o nazwie carbon-p2-plugin, która pomaga generować p2-repo. Oto, jak możesz to zrobić. Po prostu stwórz nowy projekt maven (packaging: pom), a następnie ustaw funkcje, które chcesz opublikować w konfiguracji wtyczki carbon-p2-plugin. Poniżej znajduje się przykładowy plik pom.xml, którego można użyć. Zostało to skopiowane z p2-repo generation pom.xml of carbon 4.1.0, a ja to uprościłem.
Przetestowałem ten plik pom, zadziałało to dla mnie. Istnieją dwie przykładowe definicje funkcji. Zastąp te featureArtifactDef własnymi definicjami funkcji. Format to $ groupId: $ artifactId: $ version.
Kiedy budujesz to przez maven, maven tworzy katalog target/p2-repo. Zawiera repozytorium p2 zawierające pełne p2-repo, w tym artefakty.jar i content.jar. Możesz po prostu użyć tego folderu do zainstalowania funkcji lub możesz go gdzieś umieścić. Nie ma specjalnych wymagań dotyczących hostingu.
<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>