2016-05-21 9 views
0

Mein Eclipse-Produkt muss für drei os (win, linux, mac) mit tycho maven plugin gepackt werden (zip, tar.gz, app).Verschiedene io-Packaging-Operationen von os mit Tycho create-Distributionen?

Meine Eltern pom, die das env-Filterung durch tycho verwendet werden, enthalten die andere Version des Produkts während der Paketphase zu erzeugen:

<?xml version="1.0" encoding="UTF-8"?> 
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>msi.gama</groupId> 
    <artifactId>msi.gama.parent</artifactId> 
    <version>1.7.0-SNAPSHOT</version> 
    <packaging>pom</packaging> 
<build> 
<plugins> 
    <plugin> 
     <!-- You can see the effect of Execution Environnement here : https://wiki.eclipse.org/Tycho/Execution_Environments : 
     Tycho ensures that package imports may only be matched against the selected execution environment , 
     b) Tycho hides packages which are not provided by the configured execution environment. --> 
       <groupId>org.eclipse.tycho</groupId> 
       <artifactId>target-platform-configuration</artifactId> 
       <version>${tycho.version}</version> 
       <configuration> 
        <filters> 
      <!-- FIX the JDT core due to bug in tycho https://www.eclipse.org/forums/index.php/t/1068443/ --> 
        <filter> 
         <type>eclipse-plugin</type> 
          <id>org.eclipse.jdt.core</id> 
          <restrictTo> 
           <version>3.11.2.v20160128-0629</version> 
           <!--<version>3.4.0.v20150518-1201</version>--> 
          </restrictTo> 
        </filter> 
        <!-- work around Equinox bug 348045 --> 
        <filter> 
         <type>p2-installable-unit</type> 
          <id>org.eclipse.equinox.servletbridge.extensionbundle</id> 
          <removeAll /> 
        </filter> 
        </filters> 
      <resolver>p2</resolver> 
      <pomDependencies>consider</pomDependencies> 
        <environments> 
         <environment> 
          <os>linux</os> 
          <ws>gtk</ws> 
          <arch>x86</arch> 
         </environment> 
         <environment> 
          <os>linux</os> 
          <ws>gtk</ws> 
          <arch>x86_64</arch> 
         </environment> 
         <environment> 
          <os>win32</os> 
          <ws>win32</ws> 
          <arch>x86</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> 
       </configuration> 
       </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-resources-plugin</artifactId> 
       <version>2.5</version> 
       <configuration> 
       <encoding>UTF-8</encoding> 
       </configuration> 
      </plugin> 

    </plugins> 
      </build> 
     </project> 

Mein pom.xml für Produktordner:

<?xml version="1.0" encoding="UTF-8"?> 
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <modelVersion>4.0.0</modelVersion> 
    <parent> 
    <groupId>msi.gama</groupId> 
    <artifactId>msi.gama.parent</artifactId> 
    <version>1.7.0-SNAPSHOT</version> 
    <relativePath>../msi.gama.parent/</relativePath> 
    </parent> 
    <artifactId>msi.gama.application.product</artifactId> 
    <packaging>eclipse-repository</packaging> 
    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.eclipse.tycho</groupId> 
       <artifactId>tycho-p2-repository-plugin</artifactId> 
       <version>${tycho.version}</version> 
       <configuration> 
        <includeAllDependencies>true</includeAllDependencies> 
       </configuration> 
      </plugin> 
      <!-- If the project contains more than one product file ... --> 
      <plugin> 
       <groupId>org.eclipse.tycho</groupId> 
       <artifactId>tycho-p2-director-plugin</artifactId> 
       <version>${tycho.version}</version> 
       <executions> 
        <execution> 
         <id>create-distributions</id> 
         <goals> 
          <goal>materialize-products</goal> 
          <goal>archive-products</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
      </build> 
     </project> 

Das Ergebnis in Ordner:

➜ products git:(master) ls 
msi.gama.application.product      msi.gama.application.product-linux.gtk.x86.zip  msi.gama.application.product-win32.win32.x86_64.zip 
msi.gama.application.product-linux.gtk.x86_64.zip msi.gama.application.product-macosx.cocoa.x86_64.zip msi.gama.application.product-win32.win32.x86.zip 

➜ products git:(master) cd msi.gama.application.product 
➜ msi.gama.application.product git:(master) ls 
linux macosx win32 

Mein Problem ist, dass einige spezifische Operation zu b brauchen e für jedes Betriebssystem.

Zum Beispiel, für MACOS-Verpackung, ich brauche einige Ordner und Dateien zu rekopieren, um die Metadaten der .app-Anwendung zu erstellen.

Gibt es eine Möglichkeit, kopieren, Filter IO-Operationen mit Tycho, oder ich brauche etwas wie Maven-Ressource-Plugin?

Wenn dies der Fall ist, wie kann ich Maven-Ressource-Plugin-Betrieb von os bei diesem Schritt der Verpackung in Tycho angeben?

Antwort

0

1- Gibt es eine Möglichkeit, Kopier-, Filter-IO-Operationen mit tycho zu spezifizieren, oder muss ich etwas wie maven-resource-plugin verwenden?

Ja, Sie können maven-resource-plugin verwenden und es haben Filteroperationen.

2- Wenn dies der Fall ist, wie kann ich Maven-Ressource-Plugin-Betrieb von os bei diesem Schritt der Verpackung in Tycho angeben?

Sie können mehrere Ausführungen in maven-resource-plugin definieren, jede Ausführung kann einige Dateien in Ihr gewünschtes OS-Zielpaket kopieren.

Beispiel:

 <plugin> 
      <artifactId>maven-resources-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>copy-resources-win</id> 
        <phase>prepare-package</phase> 
        <goals> 
         <goal>copy-resources</goal> 
        </goals> 
        <configuration> 
         <outputDirectory>${project.build.directory}/products/msi.gama.application.product/win32/win32/x86/configurations</outputDirectory> 
         <nonFilteredFileExtensions> 
          <nonFilteredFileExtension>app</nonFilteredFileExtension> 
          <nonFilteredFileExtension>config</nonFilteredFileExtension> 
         </nonFilteredFileExtensions> 
         <resources> 
          <resource> 
           <directory>sourcefolder</directory> 
          </resource> 
         </resources> 
        </configuration> 
       </execution> 
       <execution> 
        <id>copy-resources-mac</id> 
        <phase>prepare-package</phase> 
        <goals> 
         <goal>copy-resources</goal> 
        </goals> 
        <configuration> 
         <outputDirectory>${project.build.directory}/products/msi.gama.application.product/macosx/cocoa/x86_64</outputDirectory> 
         <nonFilteredFileExtensions> 
          <nonFilteredFileExtension>extension1</nonFilteredFileExtension> 
          <nonFilteredFileExtension>extesion2</nonFilteredFileExtension> 
         </nonFilteredFileExtensions> 
         <resources> 
          <resource> 
           <directory>macfolder</directory> 
          </resource> 
         </resources> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 

entnehmen Sie bitte maven-resources-plugin optionale Parameter für weitere Details

Hoffnung, das hilft.

Verwandte Themen