2017-01-13 5 views
0

Ich habe einen OSGI Server, entwickelt unter Eclipse, der auf Windows, Macosx und Linux läuft. Tycho und Maven machen die Zielkonfiguration für diese Plattformen perfekt.Wie füge ich eine Datei in eine spezifische Zieldatei ein

Jetzt muss ich eine startup.sh oder startup.bat in der endgültigen. Zip-Datei gemäß der endgültigen os + ws und Bogen Platte einfügen. Gibt es so etwas wie ein „configuration.environments.environment.os“ und so weiter Maven Variablen ich meine Skripte Ordner neben dem Produktzielordner wie folgt verwenden könnte kopieren:

delivery_folder/ 
->x86_64/ 
->scripts/ 

Hier ist ein Auszug aus dem Produkt Pom-Datei:

Ich möchte Tycho Target-Environnement-Mechanismus verwenden.

Ich habe Setup Tycho mit:

<plugin> 
<groupId>org.eclipse.tycho</groupId> 
<artifactId>target-platform-configuration</artifactId> 
<version>${tycho.version}</version> 
<configuration> 
<environments> 
    <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> 

Vielen Dank für Ihre Hilfe

Antwort

0

Anstatt das eher Low-Level mitmaven-resoures-plugin, können Sie auch PDE-Stil rootfiles verwenden, die Dateien plattformspezifische erlaubt in einem eclipse-repository aufgenommen werden (was ich übernehmen, ist die Art Verpackung Ihrer ZIP Herstellung):

root.win32.win32.x86=rootfiles 

die Tycho FAQ für Details. (Beachten Sie, dass die kommende Version Tycho version 1.0.0 die Unterstützung für Root-Dateien in Tycho weiter verbessert, indem sie die Syntax root.folder.<subfolder> unterstützt.)

0

Ich würde verwenden Profile bauen, dies zu erreichen. Sie können ein Profil für jede Plattform geben Sie unterstützen, und die optional hinzufügen activation:

<profiles> 
    <profile> 
     <id>win32-win32-x86</id> 
     <activation> 
      <os> 
       <arch>x86</arch> 
       <family>windows</family> 
      </os> 
     </activation> 
     <properties> 
      <target.os>win32</target.os> 
      <target.ws>win32</target.ws> 
      <target.arch>x86</target.arch> 
     </properties> 
    </profile> 
    <profile> 
     <id>win32-win32-x86_64</id> 
     <activation> 
      <os> 
       <arch>x86_64</arch> 
       <family>windows</family> 
      </os> 
     </activation> 
     <properties> 
      <target.os>win32</target.os> 
      <target.ws>win32</target.ws> 
      <target.arch>x86_64</target.arch> 
     </properties> 
    </profile> 
    <profile> 
     <id>gtk-linux-x86</id> 
     <activation> 
      <os> 
       <arch>i386</arch> 
       <family>unix</family> 
       <name>linux</name> 
      </os> 
     </activation> 
     <properties> 
      <target.os>linux</target.os> 
      <target.ws>gtk</target.ws> 
      <target.arch>x86</target.arch> 
     </properties> 
    </profile> 
    <profile> 
     <id>gtk-linux-amd64</id> 
     <activation> 
      <os> 
       <arch>amd64</arch> 
       <family>unix</family> 
       <name>linux</name> 
      </os> 
     </activation> 
     <properties> 
      <target.os>linux</target.os> 
      <target.ws>gtk</target.ws> 
      <target.arch>x86_64</target.arch> 
     </properties> 
    </profile> 
    <profile> 
     <id>cocoa-macosx-i386</id> 
     <activation> 
      <os> 
       <arch>i386</arch> 
       <family>unix</family> 
       <name>mac os x</name> 
      </os> 
     </activation> 
     <properties> 
      <target.os>macosx</target.os> 
      <target.ws>cocoa</target.ws> 
      <target.arch>x86</target.arch> 
     </properties> 
    </profile> 
    <profile> 
     <id>cocoa-macosx-x86_64</id> 
     <activation> 
      <os> 
       <arch>x86_64</arch> 
       <family>unix</family> 
       <name>mac os x</name> 
      </os> 
     </activation> 
     <properties> 
      <target.os>macosx</target.os> 
      <target.ws>cocoa</target.ws> 
      <target.arch>x86_64</target.arch> 
     </properties> 
    </profile> 
</profiles> 

Diese drei Eigenschaften festgelegt werden, die verwendet werden können, Ihr Verzeichnis zu konfigurieren:

  • ${target.os}
  • ${target.ws}
  • ${target.arch}

Dann in Ihrer maven-resources-plugin Konfiguration:

<outputDirectory>${project.build.directory}/products/${project.artifactId}/${target.os}.${target.ws}.${target.arch}</outputDirectory> 
Verwandte Themen