Tycho cannot build client Product, problem with custom defined feature - eclipse

I use Maven/Tycho for building Eclipse RCP project and p2-maven-plugin for building the p2-site located on localhost. Calling mvn clean install on parent pom should build all modules and create client product zip, but some errors appear while building the product.
Error stacktrace
[INFO] --- target-platform-configuration:0.22.0:target-platform (default-target-platform) # SplClientProduct ---
[DEBUG] Configuring mojo org.eclipse.tycho:target-platform-configuration:0.22.0:target-platform from plugin realm ClassRealm[plugin>org.eclipse.tycho:target-platform-configuration:0.22.0, parent: sun.misc.Launcher$AppClassLoader#425224ee]
[DEBUG] Configuring mojo 'org.eclipse.tycho:target-platform-configuration:0.22.0:target-platform' with basic configurator -->
[DEBUG] (f) project = MavenProject: cz.tigra.spl:SplClientProduct:1.0.0 # /tigra/SplClientProduct/pom.xml
[DEBUG] -- end configuration --
[DEBUG] Adding reactor project: MavenProject: cz.tigra.spl:cz.tigra.spl.client.feature:1.0.0-SNAPSHOT # /tigra/cz.tigra.spl.client.feature/pom.xml
[INFO]
[INFO] --- tycho-p2-publisher-plugin:0.22.0:publish-products (default-publish-products) # SplClientProduct ---
[DEBUG] Configuring mojo org.eclipse.tycho:tycho-p2-publisher-plugin:0.22.0:publish-products from plugin realm ClassRealm[plugin>org.eclipse.tycho:tycho-p2-publisher-plugin:0.22.0, parent: sun.misc.Launcher$AppClassLoader#425224ee]
[DEBUG] Configuring mojo 'org.eclipse.tycho:tycho-p2-publisher-plugin:0.22.0:publish-products' with basic configurator -->
[DEBUG] (f) flavor = tooling
[DEBUG] (f) project = MavenProject: cz.tigra.spl:SplClientProduct:1.0.0 # /tigra/SplClientProduct/pom.xml
[DEBUG] (f) qualifier =
[DEBUG] (f) session = org.apache.maven.execution.MavenSession#3a70dd47
[DEBUG] -- end configuration --
[DEBUG] No solution found because the problem is unsatisfiable.: [Unable to satisfy dependency from cz.tigra.spl.client.product 1.0.0 to cz.tigra.spl.client.feature.feature.group [1.0.0,1.0.1).; No solution found because the problem is unsatisfiable.]
[INFO] {osgi.ws=gtk, osgi.os=linux, osgi.arch=x86_64, org.eclipse.update.install.features=true}
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: cz.tigra.spl.client.product 1.0.0
[ERROR] Missing requirement: cz.tigra.spl.client.product 1.0.0 requires 'cz.tigra.spl.client.feature.feature.group [1.0.0,1.0.1)' but it could not be found
[ERROR]
[ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] SplMavenRelease ................................... SUCCESS [4.117s]
[INFO] target-platform ................................... SUCCESS [0.106s]
[INFO] cz.tigra.spl.client.feature ....................... SUCCESS [0.629s]
....
success
....
[INFO] SplAggregator ..................................... SUCCESS [0.007s]
[INFO] SplClientProduct .................................. FAILURE [0.279s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:50.453s
[INFO] Finished at: Mon May 24 11:36:53 UTC 2021
[INFO] Final Memory: 125M/1796M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-p2-publisher-plugin:0.22.0:publish-products (default-publish-products) on project SplClientProduct: Execution default-publish-products of goal org.eclipse.tycho:tycho-p2-publisher-plugin:0.22.0:publish-products failed: Cannot resolve dependencies of MavenProject: cz.tigra.spl:SplClientProduct:1.0.0 # /tigra/SplClientProduct/pom.xml: See log for details -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-p2-publisher-plugin:0.22.0:publish-products (default-publish-products) on project SplClientProduct: Execution default-publish-products of goal org.eclipse.tycho:tycho-p2-publisher-plugin:0.22.0:publish-products failed: Cannot resolve dependencies of MavenProject: cz.tigra.spl:SplClientProduct:1.0.0 # /tigra/SplClientProduct/pom.xml
Yes, I see the problem too - Product cannot see custom (in my project defined) feature called cz.tigra.spl:cz.tigra.spl.client.feature. My question is how to tell the Product where is my feature located/or where is path to its feature.xml (am I right?).
My p2-site
Parent (main) pom.xml located in root folder
<?xml version="1.0" encoding="UTF-8"?>
<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>cz.tigra.spl</groupId>
<artifactId>SplMavenRelease</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<eclipse-repo.url>http://download.eclipse.org/releases/latest</eclipse-repo.url>
<tycho.version>0.22.0</tycho.version>
</properties>
<!-- p2 update or use target platform -->
<repositories>
<repository>
<id>p2-site</id>
<url>http://localhost:8080/site/</url>
<layout>p2</layout>
</repository>
</repositories>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.10</version>
</extension>
</extensions>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-director-plugin</artifactId>
<version>${tycho.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-p2-extras-plugin</artifactId>
<version>${tycho.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<fork>true</fork>
<meminitial>128m</meminitial>
<maxmem>1024m</maxmem>
<compilerArgs>
<arg>-XX:MaxPermSize=256m</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho.version}</version>
<executions>
<execution>
<phase>package</phase>
<id>package-feature</id>
<configuration>
<finalName>${project.artifactId}_${unqualifiedVersion}.${buildQualifier}</finalName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<dependency-resolution>
<extraRequirements>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.swt.win32.win32.x86_64</id>
<versionRange>[0.0.0,5.0.0)</versionRange>
</requirement>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.swt.win32.win32.x86_64</id>
<versionRange>[0.0.0,5.0.0)</versionRange>
</requirement>
</extraRequirements>
</dependency-resolution>
<!-- <pomDependencies>consider</pomDependencies>-->
<filters>
<!-- work around Equinox bug 348045 -->
<filter>
<type>p2-installable-unit</type>
<id>org.eclipse.equinox.servletbridge.extensionbundle</id>
<removeAll/>
</filter>
</filters>
<executionEnvironment>JavaSE-1.6</executionEnvironment>
<!-- more settings -->
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
<!-- <environment>-->
<!-- <os>macosx</os>-->
<!-- <ws>cocoa</ws>-->
<!-- <arch>x86_64</arch>-->
<!-- </environment>-->
</environments>
<target>
<artifact>
<groupId>cz.tigra.spl</groupId>
<artifactId>target-platform</artifactId>
<version>1.0.0-SNAPSHOT</version>
</artifact>
</target>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-source-plugin</artifactId>
<version>${tycho.version}</version>
<executions>
<execution>
<id>plugin-source</id>
<goals>
<goal>plugin-source</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.xtend</groupId>
<artifactId>xtend-maven-plugin</artifactId>
<version>2.6.2</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<outputDirectory>xtend-gen</outputDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.12.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.core.runtime</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
<version>3.8.0</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>52.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<modules>
<module>target-platform</module>
<module>cz.tigra.spl.client.feature</module>
<module>SplAggregator</module>
<module>SplClientProduct</module>
<!-- <module>p2-site</module>-->
</modules>
</project>
SplAggregator just aggregates all project modules with source code.
Target platform pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>cz.tigra.spl</groupId>
<artifactId>SplMavenRelease</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>cz.tigra.spl</groupId>
<artifactId>target-platform</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-target-definition</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>0.22.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
and target-platform.target file
<?pde version="3.6"?>
<target name="target-platform" sequenceNumber="10">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true"
type="InstallableUnit">
<!-- this doesn't work, that's why it's commented -->
<!-- <unit id="cz.tigra.spl.client.feature" version="1.0.0.202105240921"/>-->
<!-- <repository location="localhost:8080/site/features/"/>-->
</location>
</locations>
<targetJRE
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<launcherArgs>
<vmArgs>-Xmx1024m</vmArgs>
<programArgs>-consoleLog</programArgs>
</launcherArgs>
</target>
feature's pom.xml and feature.xml files:
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>cz.tigra.spl</groupId>
<artifactId>SplMavenRelease</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>cz.tigra.spl</groupId>
<artifactId>cz.tigra.spl.client.feature</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>0.22.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
Product's pom.xml and SplClient.product:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>SplMavenRelease</artifactId>
<groupId>cz.tigra.spl</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>cz.tigra.spl</groupId>
<artifactId>SplClientProduct</artifactId>
<version>1.0.0</version>
<packaging>eclipse-repository</packaging>
<name>SplClientProduct</name>
<properties>
<product.finalName>SPL</product.finalName>
<product.id>cz.tigra.spl.client.product</product.id>
<product.outputDirectory>${project.build.directory}/products/${product.id}/win32/win32/x86_64</product.outputDirectory>
</properties>
<repositories>
<repository>
<id>p2-site</id>
<url>http://localhost:8080/site/</url>
<layout>p2</layout>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-director-plugin</artifactId>
<executions>
<execution>
<id>materialize-products</id>
<phase>package</phase>
<goals>
<goal>materialize-products</goal>
</goals>
</execution>
<execution>
<!-- create zip file with the installed product -->
<id>archive-products</id>
<goals>
<goal>archive-products</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="SPL" uid="cz.tigra.spl.client.product" id="cz.tigra.spl.client.product" application="cz.tigra.spl.client.application" version="1.0.0" useFeatures="true" includeLaunchers="true">
<aboutInfo>
<image path="/cz.tigra.spl.client/images/about/about.png"/>
<text>
text pro about se bere z messages.properties (lokalizovany)
</text>
</aboutInfo>
<configIni use="default">
<win32>/config.ini</win32>
</configIni>
<launcherArgs>
<programArgs>-data
#user.home/SPL#deployment.mode/workspace
-configuration
#user.home/SPL#deployment.mode/configuration
-clean</programArgs>
<vmArgs>-Xms256M
-Xmx1024M
-XX:PermSize=64M
-XX:MaxPermSize=128M</vmArgs>
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
</launcherArgs>
<windowImages i16="/cz.tigra.spl.client/icons/16_16/spl.png" i32="/cz.tigra.spl.client/icons/32_32/spl.png"/>
<splash
location="cz.tigra.spl.client"
startupProgressRect="5,275,445,15" />
<launcher name="spl">
<solaris/>
<win useIco="true">
<ico path="/cz.tigra.spl.client/images/logo/logo.ico"/>
<bmp/>
</win>
</launcher>
<vm>
</vm>
<plugins>
</plugins>
<features>
<feature id="cz.tigra.spl.client.feature" version="1.0.0.qualifier"/>
</features>
<configurations>
<plugin id="cz.tigra.spl.client" autoStart="true" startLevel="0" />
...
custom plugins definition
...
<plugin id="cz.tigra.spl.core" autoStart="true" startLevel="2" />
<plugin id="org.springframework.osgi.extender" autoStart="true" startLevel="1" />
</configurations>
</product>
So I guess it isn't enought to have cz.tigra.spl.client.feature located on p2 site, because Product cannot see it - where it should be? Or what is need to be changed in project setup?
Thanks!

Related

Maven install-plugin does not generate jars files for Eclipse Projects included as dependencies

I have two Eclipse Maven projects, one of them is referenced by the other project (a dynamic web project) as a dependency. When I export, using Eclipse Export menu, the web project to a war file a jar file is generated for the other project and included in the lib directory in the war file, but when using Maven directly (Run as / Maven Build... / clean install) no jar file is generated but only an empty directory with the name OtherProject.jar.
Can this be done and I am missing some thing, or is it impossible?
My web project pom.xml is:
<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>Group</groupId>
<artifactId>MyWarProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.44</version>
</dependency>
...
other dependencies
...
<dependency>
<groupId>Group</groupId>
<artifactId>OtherProject</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
My other project pom.xml is:
<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>Group</groupId>
<artifactId>OtherProject</artifactId>
<version>1.0</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>src/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
...
some dependencies
...
</dependencies>
</project>

Unresolveable build extension: Tycho cannot resolve dependency to bundle although present in the target file

Unresolveable build extension: Plugin org.eclipse.tycho:tycho-maven-plugin:0.26.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.tycho:tycho-maven-plugin:jar:0.26.0
below is my pom.xml file
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
com.in2soft.otx.checker
com.kpit.otx.checker.build
1.0.0-SNAPSHOT
<properties>
<tycho-version>0.26.0</tycho-version>
</properties>
<repositories>
<repository>
<id>Mars</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/mars</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<configuration>
<pomDependencies>consider</pomDependencies>
</configuration>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
<environments>
<environment>
<os>${os}</os>
<ws>${ws}</ws>
<arch>${arch}</arch>
</environment>
</environments>
<target>
<artifact>
<groupId>com.in2soft.otx.checker</groupId>
<artifactId>rcp</artifactId>
<version>1.0.0-SNAPSHOT</version>
<classifier>rcp</classifier>
</artifact>
</target>
</configuration>
</plugin>
</plugins>
</build>

cyclic dependency using the p2-maven-plugin

I 've been using the p2-maven-plugin and I have some problems: it seems to be generating cycling dependencies but I could not find why (the same jars in maven show no problem). I am wondering whether anyone can help.
here is my pom.xml
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.reficio.rcp</groupId>
<artifactId>example-p2-site</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>
<build>
<plugins>
<plugin>
<groupId>org.reficio</groupId>
<artifactId>p2-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<artifacts>
<!-- specify your depencies here -->
<!-- groupId:artifactId:version -->
<artifact><id>org.apache.shiro:shiro-aspectj:1.3.2</id></artifact>
<artifact><id>org.apache.shiro:shiro-core:1.3.2</id></artifact>
<artifact><id>org.apache.shiro:shiro-ehcache:1.3.2</id></artifact>
<artifact><id>net.sf.ehcache:ehcache-core:2.6.9</id></artifact>
<artifact><id>net.sf.ehcache:ehcache:2.9.0</id></artifact>
<artifact><id>commons-logging:commons-logging:1.1.1</id></artifact>
<artifact><id>org.slf4j:slf4j-simple:1.6.1</id></artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>reficio</id>
<url>http://repo.reficio.org/maven/</url>
</pluginRepository>
</pluginRepositories>
here is the cyclic dependency (look for org.apache.shiro.core)
Thanks in advance
K. Apostolou

Tycho: Categorize p2 metadata

Iam trying to generate a categorized p2 repository with Tycho. There are basically three steps to make (compare Eclipse documentation):
Download Bundles
Trigger org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
Trigger org.eclipse.equinox.p2.publisher.CategoryPublisher
which i configured in a maven pom-file. Steps 1 and 2 are doing well whereas step 3 fails with:
Status ERROR: this code=0 publishing result null children=[Status ERROR: org.eclipse.equinox.p2.updatesite code=0 Error
generating category xml action. org.eclipse.equinox.p2.core.ProvisionException: Error reading update site file:/<path>/category.xml.]
Here is my pom.file
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>demo</groupId>
<artifactId>simple-p2-repository</artifactId>
<version>0.1.0-SNAPSHOT</version>
<name>Simple p2 repository build</name>
<packaging>pom</packaging>
<properties>
<tycho-version>0.18.0</tycho-version>
</properties>
<build>
<plugins>
<!-- Step 1 -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-bundles-for-publishing</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<version>2.7.5</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.basedir}/target/source/plugins</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- Step 2 -->
<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>
<compress>true</compress>
<append>true</append>
<publishArtifacts>true</publishArtifacts>
</configuration>
</plugin>
<!-- Step3 -->
<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>${basedir}/category.xml</categoryDefinition>
</configuration>
</plugin>
</plugins>
</build>
</project>
And my category.xml
<?xml version="1.0" encoding="UTF-8"?>
<site>
<category-def name="all" label="Maven osgi-bundles"/>
<iu>
<category name="all"/>
<query>
<expression type="match">providedCapabilities.exists(p | p.namespace == 'osgi.bundle')</expression>
</query>
</iu>
</site>
If i manually execute the steps the same error occurs. What am i missing?
Although it is theoretically possible to call the low-level p2 actions via Tycho, I wouldn't recommend this approach for the problem you are trying to solve.
The artifact is already available in a Maven repository, so you can easily add it to the target platform of a Tycho build via pomDependencies=consider. Then you can for example build a p2 repository with the artifact, using Tycho's packaging type eclipse-repository.
You'll need the following POM configuration...
...
<packaging>eclipse-repository</packaging>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<version>2.7.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<pomDependencies>consider</pomDependencies>
</configuration>
</plugin>
</plugins>
</build>
... and a category.xml which explicitly lists the bundles you want to include:
<?xml version="1.0" encoding="UTF-8"?>
<site>
<bundle id="org.apache.cxf.bundle" version="0.0.0">
<category name="all"/>
</bundle>
<category-def name="all" label="Maven osgi-bundles"/>
</site>

Why is update repo URL not configured on cross platform Tycho build for Windows artifact?

I have a cross-platform Tycho build running on Mac OS X that produces Windows, Mac and a p2 repo outputs.
Generally all is fine except that the Windows RCP does NOT get configured with the update repo URL details from my p2.inf addRepository instructions (and so p2 update fails) - it DOES for the Mac OS X app... which seems suspicious... why one and not the other?!
Is this a Tycho bug anyone might've come across? (I'm currently using Tycho 0.13.0, nervous about switching versions..) Or do I need explicit instructions for this to get applied to the Windows build?
It'll probably help to include some POMs here...
Here's the POM from the product project:
<?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>com.myapp.main.product</artifactId>
<packaging>eclipse-repository</packaging>
<name>my product</name>
<parent>
<groupId>com.myapp</groupId>
<artifactId>parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<relativePath>../com.myapp.parent</relativePath>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-director-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>materialize-products</id>
<goals>
<goal>materialize-products</goal>
</goals>
</execution>
<execution>
<id>archive-products</id>
<goals>
<goal>archive-products</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- SEE: http://dev.eclipse.org/mhonarc/lists/tycho-user/msg00362.html
SEE: https://issues.sonatype.org/browse/TYCHO-300 -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/products/com.myapp.main.product/icons</outputDirectory>
<resources>
<resource>
<directory>icons</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<version>1.9.0-SNAPSHOT</version>
</project>
And the parent POM:
<?xml version="1.0" encoding="UTF-8"?>
<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>com.myapp</groupId>
<artifactId>parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>../com.myapp.doc</module>
<module>../com.myapp.lots.of.plugins</module>
<module>../com.myapp.main</module>
<module>../com.myapp.main.nl</module>
<module>../com.myapp.branding</module>
<module>../com.myapp.branding.nl</module>
<module>../com.myapp.feature.platform</module>
<module>../com.myapp.feature.core</module>
<module>../com.myapp.main.product</module>
</modules>
<properties>
<tycho-version>0.13.0</tycho-version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86</arch>
</environment>
<environment>
<os>macosx</os>
<ws>carbon</ws>
<arch>x86</arch>
</environment>
<!-- 64 bit platforms
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
-->
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<!-- MacOS specific vm arguments for UI testing -->
<profile>
<id>osx</id>
<activation>
<property>
<name>java.vendor.url</name>
<value>http://www.apple.com/</value>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<appArgLine>-XstartOnFirstThread</appArgLine>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<profile>
<id>coverage</id>
<activation>
<property>
<name>coverage</name>
</property>
</activation>
<properties>
<emma.session.out.file>${project.build.directory}/emma/${project.artifactId}.es</emma.session.out.file>
<emma.filter>com.myapp.*</emma.filter>
<eclemma.instrument.bundles>com.myapp.backup.tests,com.myapp.common.tests,com.myapp.model.tests</eclemma.instrument.bundles>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${emma.session.out.file}</file>
<type>es</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.tycho</groupId>
<artifactId>maven-osgi-test-plugin</artifactId>
<version>${tycho-version}</version>
<!--
<configuration>
<systemProperties combine.children="append">
<eclemma.help>true</eclemma.help>
<emma.session.out.file>${emma.session.out.file}</emma.session.out.file>
<emma.filter>${emma.filter}</emma.filter>
<eclemma.instrument.bundles>${eclemma.instrument.bundles}</eclemma.instrument.bundles>
</systemProperties>
<frameworkExtensions>
<frameworkExtension>
<groupId>org.eclemma.runtime.equinox</groupId>
<artifactId>org.eclemma.runtime.equinox</artifactId>
<version>1.1.0.200908261008</version>
</frameworkExtension>
</frameworkExtensions>
</configuration>
-->
<configuration>
<skip>${skipFunctional}</skip>
<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>
<product>org.eclipse.sdk.ide</product>
<application>org.eclipse.ui.ide.workbench</application>
<argLine>-Xmx512M</argLine>
<systemProperties combine.children="append">
<emma.session.out.file>${emma.session.out.file}</emma.session.out.file>
<emma.filter>${emma.filter}</emma.filter>
<eclemma.instrument.bundles>${emma.instrument.bundles}</eclemma.instrument.bundles>
</systemProperties>
<frameworkExtensions>
<frameworkExtension>
<groupId>org.eclemma.runtime.equinox</groupId>
<artifactId>org.eclemma.runtime.equinox</artifactId>
<version>1.1.0.200908261008</version>
</frameworkExtension>
</frameworkExtensions>
<application>org.eclipse.ui.ide.workbench</application>
<dependencies>
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.eclipse.sdk.ide</artifactId>
<version>0.0.0</version>
</dependency>
</dependencies>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<repositories>
<repository>
<id>helios-platform</id>
<layout>p2</layout>
<url>${project.baseUri}../../../../targetplatform/org.eclipse.platform-3.7.1</url>
</repository>
<repository>
<id>myapp-targetplatform</id>
<layout>p2</layout>
<url>${project.baseUri}../../../../targetplatform/myapp-targetplatform</url>
</repository>
</repositories>
</project>
Upgraded Tycho to 0.17.0 but it turns out the issue indeed has nothing to do with Tycho - I realized I've tweaked the location properties on Windows in an attempt to prepare to support installation into c:\Program Files post-XP with UAC:
-Dosgi.instance.area=#user.home/Application Data/myapp
-Dosgi.configuration.area=#user.home/Application Data/myapp/.configuration
However moving the osgi.configuration.area out of the installation folder (which defaults to c:\myapp :P) is what causes my p2 problem.