Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] [Tycho-user] Target Definition entry to local p2 repository

Sorry, lost track of this a bit.
Maybe it helps if I add the information, that we integrate the generated plugins-repository as type "Installation" in eclipse, not as "Software Site".

The following is the configuration-bit we use in the pom to reference the generated repository in the tycho build.
The features, defining dependencies to plugins within this repo live in our product and are not part of this generated repo.

<repository>
            <id>flowfact.target.jenkins</id>
            <layout>p2</layout>
            <url>file:${project.basedir}/../../core/p2-repository/target/repository/</url>
        </repository>


2011/12/16 <Sandra.Kosmalla@xxxxxxxxxxxxx>
Hi,

I found out a solution that works for me: I studied the format of a P2 Repository and I found out that I needed a feature.jar with a feature.xml inside that includes entries to the jars in the plugin folder. Only with this Jar Eclipse detects the P2 repository. So I created a Maven Jar project to build the feature.jar. In this project I have only one file 'featue.xml'. In this file I add information of all plugins that should be in the plugins folder.  The format for this including in the 'feature.xml' is for example:

<plugin
         id="com.caucho.hessian"
         download-size="0"
         install-size="0"
         version="3.2.0.0"
         unpack="false"/>


This entry is for the jar 'com.caucho.hessian_3.2.0.0.jar'.

Then I created a Maven POM project after the instruction of Markward: I use the goal dependency:copy-dependencies to copy the dependency to the plugin foldern and I use the goal dependecy:copy to copy the feature jar in a feature folder. Then I build the p2 repository with the tycho-p2-extras-plugin.

The next problem was that the targe definition file accepts only absolute path to the local p2 repository. That is a problem because I want to use the target definition file independent from local installation. The solution is that I build a target definition file with a token:

<repository location="file:/$repository.location$"/>

This token is replaced by the maven replacer plugin during the maven build with value that is the absolute local path to the generated p2 repostory.

The whole configuration of this Maven POM project looks like that:

<build>
                <plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-dependency-plugin</artifactId>
                                <version>2.3</version>
                                <executions>
                                        <execution>
                                                <id>copy-dependencies</id>
                                                <phase>process-resources</phase>
                                                <goals>
                                                        <goal>copy-dependencies</goal>
                                                </goals>
                                                <configuration>
                                                        <excludeTransitive>true</excludeTransitive>
                                                        <outputDirectory>${project.build.directory}/source/plugins</outputDirectory>
                                                </configuration>
                                        </execution>
                                        <execution>
                                                <id>copy-feature</id>
                                                <phase>process-resources</phase>
                                                <goals>
                                                        <goal>copy</goal>
                                                </goals>
                                                <configuration>
                                                        <artifactItems>
                                                                <artifactItem>
                                                                        <groupId>de.rhenus.fl.p2</groupId>
                                                                        <artifactId>repository.feature</artifactId>
                                                                        <version>0.0.1-SNAPSHOT</version>
                                                                        <type>jar</type>
                                                                        <overWrite>true</overWrite>
                                                                        <outputDirectory>${project.build.directory}/source/features</outputDirectory>
                                                                </artifactItem>
                                                        </artifactItems>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-resources-plugin</artifactId>
                                <version>2.5</version>
                                <executions>
                                        <execution>
                                                <id>copy-target-definition</id>
                                                <phase>process-resources</phase>
                                                <goals>
                                                        <goal>copy-resources</goal>
                                                </goals>
                                                <configuration>
                                                        <resources>
                                                                <resource>
                                                                        <directory>src/main/resources</directory>
                                                                        <includes>
                                                                                <include>${target.definition}</include>
                                                                        </includes>
                                                                </resource>
                                                        </resources>
                                                        <outputDirectory>${project.build.directory}</outputDirectory>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>
                        <plugin>
                                <groupId>com.google.code.maven-replacer-plugin</groupId>
                                <artifactId>maven-replacer-plugin</artifactId>
                                <version>1.4.0</version>
                                <executions>
                                        <execution>
                                                <phase>prepare-package</phase>
                                                <goals>
                                                        <goal>replace</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <configuration>
                                        <ignoreMissingFile>false</ignoreMissingFile>
                                        <file>target/${target.definition}</file>
                                        <regex>false</regex>
                                        <replacements>
                                                <replacement>
                                                        <token>$repository.location$</token>
                                                        <value>${project.build.directory}/repository/</value>
                                                </replacement>
                                                <replacement>
                                                        <token>\</token>
                                                        <value>/</value>
                                                </replacement>
                                        </replacements>
                                </configuration>
                        </plugin>

                        <plugin>
                                <groupId>${tycho.groupid}.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>false</compress>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>build-helper-maven-plugin</artifactId>
                                <version>1.7</version>
                                <executions>
                                        <execution>
                                                <id>attach-artifacts</id>
                                                <phase>package</phase>
                                                <goals>
                                                        <goal>attach-artifact</goal>
                                                </goals>
                                                <configuration>
                                                        <artifacts>
                                                                <artifact>
                                                                        <file>target/${target.definition}</file>
                                                                        <type>target</type>
                                                                        <classifier>indigo</classifier>
                                                                </artifact>
                                                        </artifacts>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>
                </plugins>
        </build>


I think the feature.jar can be generated because all information for the plugin entries are there. Maybe the tycho-p2-extras-plugin can be extended with a flag 'generateFeature' or something like that.

Regards,

Sandra



Von:        Sandra.Kosmalla@xxxxxxxxxxxxx
An:        Tycho user list <tycho-user@xxxxxxxxxxx>
Datum:        09.12.2011 16:05
Betreff:        Re: [tycho-user] [Tycho-user] Target Definition entry to local p2 repository
Gesendet von:        tycho-user-bounces@xxxxxxxxxxx




Hi,

I think the problem is that in the generate P2 repository is not a feature.xml that includes import statements to the bundles in the plugins folder. That could be the reason why Eclipse cannot add the generate local p2 repository to the target definition file.


Regards,


Sandra





Von:        
Oliver Pfau <Oliver.Pfau@xxxxxxxxxxxx>
An:        
'Tycho user list' <tycho-user@xxxxxxxxxxx>
Datum:        
09.12.2011 15:34
Betreff:        
Re: [tycho-user] [Tycho-user] Target Definition entry to local p2 repository
Gesendet von:        
tycho-user-bounces@xxxxxxxxxxx




Hi,

 
probably it is not possible so easy to use the same target definition in eclipse and tycho?

My target definition in eclipse contains 2 directories (eclipse 3.7.1 and my own p2 repository), but for tycho I have the repositories added in the pom.xml or settings.xml.

Tycho does not support target platform entries of type directory and profile and the self created p2 repository I wasn’t able to add in eclipse as site to the target platform. Also with the example from Markward this does not work. Probably a category is missing?

Tried to create a feature project which includes all bundles for the repository and then created a update site project. In the update site project you can add the feature and click „build all“. But I was stuck on an error from eclipse about unresolved dependencies. If I create the p2 with the maven plugin descibed by Markward or with the eclipse.exe, no dependency problem occurs.
 
Von:
tycho-user-bounces@xxxxxxxxxxx [
mailto:tycho-user-bounces@xxxxxxxxxxx] Im Auftrag von Sandra.Kosmalla@xxxxxxxxxxxxx
Gesendet:
Freitag, 9. Dezember 2011 11:01
An:
Tycho user list
Betreff:
Re: [tycho-user] [Tycho-user] Target Definition entry to local p2 repository

 
Hello,


I track this topic with high interest because it covers my current problem. So I tried Markward's idea out.


Like Markward described I copy my dependencies into a folder and build with the tycho-p2-extras-plugin from this folder a p2 site. Then I want to add this generated p2 site to the target definition, but Eclipse cannot discover the content of this p2 site.


Have anybody an idea where my mistake is?

I'm using Eclipse 3.7.1 and Maven Tycho 0.13.0.


I would be happy about a hint.


Regards,


Sandra Kosmalla





Von:        
Markward Schubert <markward.schubert@xxxxxxxxx>
An:        
Tycho user list <tycho-user@xxxxxxxxxxx>
Datum:        
07.12.2011 12:48
Betreff:        
Re: [tycho-user] [Tycho-user] Target Definition entry to local p2        repository
Gesendet von:        
tycho-user-bounces@xxxxxxxxxxx








Maybe I can explain shortly how we solve a similar situation.

We have some own serverside-dependecies and additional thirdparty libraries, our RCP application depends on.
To make them available, we configured a maven project, to generate a p2 repository for these bundles.

Generation works in three steps:

First we resolve all dependencies with the dependency plugin and its copy goal.
Then, also with the maven-depenency-plugin we copy them to a defined destination in the targetfolder.
It is important, that the destination folder is /target/source/plugins or ~/features if you have features.

Then we configured the tycho-p2-extras-plugin to publish the artifacts of this folder into another folder as a valid p2 site.

          <plugin>
              <groupId>org.eclipse.tycho.extras</groupId>
              <artifactId>tycho-p2-extras-plugin</artifactId>
              <version>${tycho-version}</version>
              <executions>
                  <execution>
                      <phase>package</phase>
                      <goals>
                          <goal>publish-features-and-bundles</goal>
                      </goals>
                  </execution>
              </executions>
              <configuration>
                  <compress>false</compress>
              </configuration>
          </plugin>

The result is, that all publishable plugins then are published into the default-folder /target/repository/
This folder then can be consumed as a valid p2-repository by tycho.

Please check out
https://docs.sonatype.org/display/TYCHO/Tycho-extras+-+FeaturesAndBundlesPublisher for an example. This is what inspired us for this solution.

Hope, this helps.


2011/12/7 Oliver Pfau <
Oliver.Pfau@xxxxxxxxxxxx>

No, I am not sure…because it is the first p2 repository I created J

But I do not know how to integrate the 3rd party jars in the tycho build otherwise. The maintenance of the p2 repository is a little bit annoying. I ask myself how the people from eclipse do this.

 

 

Von: tycho-user-bounces@xxxxxxxxxxx [mailto:tycho-user-bounces@xxxxxxxxxxx] Im Auftrag von Markward Schubert
Gesendet:
Dienstag, 6. Dezember 2011 16:46
An:
Tycho user list
Betreff:
Re: [tycho-user] [Tycho-user] Target Definition entry to local p2 repository

 

Oliver, are you sure, the local directory you point to is a valid p2 repository, asked before?
I am not an expert on P2, but we have a pretty similar scenario here, which works out for us.

We actually create our local repo by actively publishing bundles from one simple plugin-folder with the help of the tycho-p2-extras-plugin's publish-features-and-bundles-goal. This creates some metadata, wich makes our repo understood by tycho.

As far as i understand, this goal is a wrapper for the "Features And Bundles Publisher Application" of eclipse.

Hope this helps

2011/12/6 Oliver Pfau <Oliver.Pfau@xxxxxxxxxxxx>

This

  <repository>
      <id>indigo</id>
      <layout>p2</layout>
      <url>
file:${user.home}/p2-repo</url>
  </repository>

in the parent pom also works for me, but I  tried to move all in the .target file of eclipse. At this time I have the defintion on 2 places.... pom and target Definition. I thought it is quite easy to give the target definition to tycho.


-----Ursprüngliche Nachricht-----
Von:
tycho-user-bounces@xxxxxxxxxxx [mailto:tycho-user-bounces@xxxxxxxxxxx] Im Auftrag von Aaron Digulla
Gesendet: Dienstag, 6. Dezember 2011 15:22
An:
tycho-user@xxxxxxxxxxx
Betreff: Re: [tycho-user] Target definition entry to local p2 repository

Zitat von Oliver Pfau <
Oliver.Pfau@xxxxxxxxxxxx>:

> No success. Tycho fails to resolve the dependencies from the local
> p2 repository. Probably I have to define a category in the local p2
> repository. I try this.

No, Tycho ignores categories and features; you can only compile
against bundles.

Are you sure the local repo is valid (artifact and content files are
valid, correct, and up-to-date)?

FWIW, I use this in my POM:

  <repository>
      <id>indigo</id>
      <layout>p2</layout>
      <url>
file:${user.home}/p2-repo</url>
  </repository>

and this works.

Regards,

> -----Ursprüngliche Nachricht-----
> Von:
tycho-user-bounces@xxxxxxxxxxx
> [mailto:
tycho-user-bounces@xxxxxxxxxxx] Im Auftrag von Aaron Digulla
> Gesendet: Dienstag, 6. Dezember 2011 15:02
> An:
tycho-user@xxxxxxxxxxx
> Betreff: Re: [tycho-user] Target definition entry to local p2 repository
>
> Zitat von Oliver Pfau <
Oliver.Pfau@xxxxxxxxxxxx>:
>
>> Hi,
>>
>> I have a custom and local p2 repository. If I add the repository to
>> the target definition file in eclipse location type="Directory" I
>> can build in eclipse.
>> Tycho logs a warning that location type="Directory" is not
>> supported. Is it possible to add the local p2 repository to the
>> target definition to get it work in eclipse and tycho?
>> I tried <repository location="
file:///D:/p2testrepo"/> without
>> success in tycho and eclpse
>
> Try "file:/D:/..."
>
> Regards,
>
> --
> Aaron "Optimizer" Digulla a.k.a. Philmann Dark
> "It's not the universe that's limited, it's our imagination.
> Follow me and I'll show you something beyond the limits."
>
http://www.pdark.de/                   http://blog.pdark.de/
> _______________________________________________
> tycho-user mailing list
>
tycho-user@xxxxxxxxxxx
>
https://dev.eclipse.org/mailman/listinfo/tycho-user
> _______________________________________________
> tycho-user mailing list
>
tycho-user@xxxxxxxxxxx
>
https://dev.eclipse.org/mailman/listinfo/tycho-user
>
>



--
Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."

http://www.pdark.de/                   http://blog.pdark.de/
_______________________________________________
tycho-user mailing list

tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list

tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user

 


_______________________________________________
tycho-user mailing list

tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user




--

MArkward Schubert
Im Hederichsfeld 25
51379 Leverkusen
Mobil: 0177 - 56 113 12
E-Mail: markward.schubert@xxxxxxxxx


_______________________________________________
tycho-user mailing list

tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx

https://dev.eclipse.org/mailman/listinfo/tycho-user_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user


_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user



Back to the top