2013-04-26 22 views
7

Tycho eklentisini kullanarak Maven ile birlikte çalışan bir Eclipse RCP uygulamasına sahibim. Modüller olarak tüm eklentileri ve özellikleri içeren bir ana POM var.Tycho: Eklentileri ayrı ayrı oluştururken projenin diğer eklentilerine bağımlılıklar çözümlenemiyor

, Maven ile ana POM'u yüklerse, sonuçta oluşan reaktör yapısı düzgün çalışır. Tüm modüller oluşturulur ve yüklemesi başarılı olur. Ancak

, ben uygulamanın diğer eklentileri ayrı ayrı Eclipse eklentileri birini kendi bağımlılıkları inşa halinde çözülemeyen. üçüncü parti kütüphaneleri (örneğin Eclipse platformuna) için

bağımlılıklar ince işe görünmektedir. Uygulamamızın Eclipse eklentileriyle sadece bu tip bağımlılıklar başarıyla oluşturulmaktadır.

konsol çıktısı şudur: nedeniyle başarılı reaktör inşasına

[INFO] Resolving dependencies of MavenProject: com.mycompany.myproduct:com.mycompany.myproduct.gui.editors:1.8.15-SNAPSHOT @ /<path>/com.mycompany.myproduct.gui.editors/pom.xml 
[INFO] Cannot complete the request. Generating details. 
[INFO] Cannot complete the request. Generating details. 
[INFO] {osgi.ws=gtk, osgi.os=linux, osgi.arch=x86, org.eclipse.update.install.features=true} 
[ERROR] Cannot resolve project dependencies: 
[ERROR] Software being installed: com.mycompany.myproduct.gui.editors 1.8.15.qualifier 
[ERROR] Missing requirement: com.mycompany.myproduct.gui.editors 1.8.15.qualifier requires 'bundle com.mycompany.myproduct.preferences 1.8.15' but it could not be found 
[ERROR] 
[ERROR] Internal error: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from com.mycompany.myproduct.gui.editors 1.8.15.qualifier to bundle com.mycompany.myproduct.preferences 1.8.15.", "Unable to satisfy dependency from com.mycompany.myproduct.gui.editors 1.8.15.qualifier to bundle com.mycompany.myproduct.gui.utils 1.8.15.", "No solution found because the problem is unsatisfiable."] -> [Help 1] 
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from com.mycompany.myproduct.gui.editors 1.8.15.qualifier to bundle com.mycompany.myproduct.preferences 1.8.15.", "Unable to satisfy dependency from com.mycompany.myproduct.gui.editors 1.8.15.qualifier to bundle com.mycompany.myproduct.gui.utils 1.8.15.", "No solution found because the problem is unsatisfiable."] 
     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:168) 
     ... 

, tüm eklenti kurar firmamız depo (biz Artifactory kullanın) içindedir. Artifactory web uygulamasında, mevcut preferences eklentisinin 1.8.15-SNAPSHOT yapısını açıkça görüyorum. Ancak bu depoya erişilemez.

Veri havuzu bilgileri settings.xml dosyasında belirtilmiştir. ebeveyn POM başarıyla bu deposundan alınır Not: Ayarlar dosyanın içeriği

[INFO] Scanning for projects... 
Downloading: http://artifactory.buildnet.mycompany.com/artifactory/libs-snapshot-local/com/mycompany/myproduct/gui.parent/1.0-SNAPSHOT/maven-metadata.xml 
Downloaded: http://artifactory.buildnet.mycompany.com/artifactory/libs-snapshot-local/com/mycompany/myproduct/gui.parent/1.0-SNAPSHOT/maven-metadata.xml (594 B at 3.3 KB/sec) 

olduğunu

: Bu ana POM (projemize o ustadan ayrılır unutmayın olduğunu

<settings> 
    <servers> 
    ... (only relevant for deploy) 
    </servers> 
    <mirrors> 
    <mirror> 
     <id>mycompany-remote-mirror</id> 
     <name>mycompany remote repositories mirror</name> 
     <url>http://artifactory.buildnet.mycompany.com/artifactory/remote-repos</url> 
     <mirrorOf>*,!eclipse*,!mycompany-snapshots,!mycompany-releases</mirrorOf> 
    </mirror> 
    </mirrors> 
    <profiles> 
    <profile> 
     <id>mycompany-default</id> 
     <repositories> 
     <repository> 
      <id>mycompany-snapshots</id> 
      <name>MyCompany snapshots repository</name> 
      <releases> 
      <enabled>false</enabled> 
      <updatePolicy>always</updatePolicy> 
      <checksumPolicy>warn</checksumPolicy> 
      </releases> 
      <snapshots> 
      <enabled>true</enabled> 
      <updatePolicy>always</updatePolicy> 
      <checksumPolicy>fail</checksumPolicy> 
      </snapshots> 
      <url>http://artifactory.buildnet.mycompany.com/artifactory/libs-snapshot-local</url> 
      <layout>default</layout> 
     </repository> 
     <repository> 
      <id>mycompany-releases</id> 
      <name>MyCompany releases repository</name> 
      <releases> 
      <enabled>true</enabled> 
      <updatePolicy>always</updatePolicy> 
      <checksumPolicy>warn</checksumPolicy> 
      </releases> 
      <snapshots> 
      <enabled>false</enabled> 
      <updatePolicy>never</updatePolicy> 
      <checksumPolicy>fail</checksumPolicy> 
      </snapshots> 
      <url>http://artifactory.buildnet.mycompany.com/artifactory/libs-release-local</url> 
      <layout>default</layout> 
     </repository> 
     </repositories> 
    </profile> 
    </profiles> 
    <activeProfiles> 
    <activeProfile>mycompany-default</activeProfile> 
    </activeProfiles> 
</settings> 

modüllerini içeren POM):

aşağıdaki
<project ...> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.mycompany.myproduct</groupId> 
    <artifactId>gui.parent</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>pom</packaging> 

    <properties> 
    <product-id>MyProduct</product-id> 
    <tycho.version>0.17.0</tycho.version> 
    <tycho-extras.version>0.17.0</tycho-extras.version> 
    <eclipse.version>juno</eclipse.version> 
    <eclipse.repo>http://download.eclipse.org/releases/${eclipse-version}</eclipse.repo> 
    </properties> 

    <distributionManagement> 
    ... 
    </distributionManagement> 

    <repositories> 
    <repository> 
     <id>eclipse</id> 
     <url>${eclipse.repo}</url> 
     <layout>p2</layout> 
    </repository> 
    </repositories> 

    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.eclipse.tycho</groupId> 
     <artifactId>tycho-maven-plugin</artifactId> 
     </plugin> 
     <plugin> 
     <groupId>org.eclipse.tycho</groupId> 
     <artifactId>target-platform-configuration</artifactId> 
     </plugin> 
     <plugin> 
     <groupId>org.eclipse.tycho</groupId> 
     <artifactId>tycho-source-plugin</artifactId> 
     </plugin> 
     <plugin> 
     <groupId>org.eclipse.tycho</groupId> 
     <artifactId>tycho-versions-plugin</artifactId> 
     </plugin> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-release-plugin</artifactId> 
     </plugin> 
    </plugins> 

    <pluginManagement> 
     <plugins> 
     <!-- PARENT 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> 
      ... 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.eclipse.tycho</groupId> 
      <artifactId>tycho-source-plugin</artifactId> 
      <version>${tycho.version}</version> 
      ... 
     <plugin> 
      <groupId>org.eclipse.tycho</groupId> 
      <artifactId>tycho-versions-plugin</artifactId> 
      <version>${tycho.version}</version> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-release-plugin</artifactId> 
      <version>2.4.1</version> 
     </plugin> 
     <!-- END OF PARENT PLUGINS --> 

     <!-- DEFAULT PLUGINS --> 
     <plugin> 
      <groupId>org.eclipse.tycho</groupId> 
      <artifactId>tycho-compiler-plugin</artifactId> 
      <version>${tycho.version}</version> 
      <configuration> 
      <compilerArguments> 
       <inlineJSR/> 
       <enableJavadoc/> 
       <encoding>ISO-8859-1</encoding> 
      </compilerArguments> 
      </configuration> 
     </plugin> 
     <!-- END OF DEFAULT PLUGINS --> 

     <!-- OTHER PLUGINS --> 
     ... (maven-resources, tycho-surefire, tycho-p2, tycho-p2-director, 
      tycho-p2-repository, ...) 
     <!-- END OF OTHER PLUGINS --> 
     </plugins> 
    </pluginManagement> 
    </build> 
</project> 

başkalarına bağımlılıkları ile bir eklenti pom.xml gibidir:

aşağıdaki gibi
<project ...> 
    <modelVersion>4.0.0</modelVersion> 
    <parent> 
    <groupId>com.mycompany.myproduct</groupId> 
    <artifactId>gui.parent</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    </parent> 
    <artifactId>com.mycompany.myproduct.gui.editors</artifactId> 
    <version>1.8.15-SNAPSHOT</version> 
    <packaging>eclipse-plugin</packaging> 
</project> 

Ve aynı eklentinin MANIFEST.MF dosyasıdır:

Manifest-Version: 1.0 
Bundle-ManifestVersion: 2 
Bundle-Name: MyProduct Editors Plug-in 
Bundle-SymbolicName: com.mycompany.myproduct.gui.editors;singleton:=true 
Bundle-Version: 1.8.15.qualifier 
Bundle-Activator: com.mycompany.myproduct.gui.editors.Activator 
Bundle-ActivationPolicy: lazy 
Export-Package: com.mycompany.myproduct.gui.editors, 
com.mycompany.myproduct.gui.editors.logger, 
com.mycompany.myproduct.gui.editors.report 
Bundle-Vendor: MyCompany 
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 
Require-Bundle: org.eclipse.ui.workbench;bundle-version="3.104.0", 
org.eclipse.core.runtime;bundle-version="3.8.0", 
org.eclipse.jface;bundle-version="3.8.0", 
com.mycompany.myproduct.preferences;bundle-version="1.8.15", 
com.mycompany.myproduct.gui.utils;bundle-version="1.8.15", 
org.eclipse.ui.workbench;bundle-version="3.104.0" 

cevap

7

Tycho, bağımlılıklarını gidermek için Maven depolarında görünmüyor (çünkü Maven depoları bir OSGi bildiriminde belirtilen bağımlılıkları çözmek için yeterli meta verilere sahip değil). Bunun yerine, Tycho uzaklardan gelebilecek eserler için p2 depolarına ihtiyaç duyar.,

  • bir CI inşa reaktörden tüm eserler toplayan bir p2 depo üretmek var:

    Yani reaktörün parçalarının Bir yapıyla sizin kullanım örneğini kapsaması için aşağıdakileri yapmanız gerekir ve p2 deposunu statik bir URL'de yayınlayın. (En basit çözüm, bir Jenkins işini kullanmak ve yapının çalışma alanına işaret eden URL'yi kullanmaktır.)

  • Projenizde, POM'daki p2 planıyla birlikte depo olarak CI build p2 deposu ekleyen bir profil oluşturun. . Bu şekilde

, projenin eserler de bir parçası olacak bir modül en target platform aynı anda diğer modüller inşa olmasa bile.

+0

Ne yazık ki, bu doğru cevap gibi görünüyor. Tycho'nun yerel Maven repo'mdaki (ya da p2 değil) eserleri bulabilmesi için herhangi bir fikir var, ama bir şirket Maven deposunda değil mi? – tbacker

+2

Tycho, yerel olarak oluşturulmuş diğer yapılara karşı bina kullanımının desteklenmesi amacıyla [bunun için açık destek] (http://wiki.eclipse.org/Tycho/Target_Platform#Locally_built_artifacts) 'a sahiptir. Aynı şey uzak depolar için de oradaydı, fakat bu [doğal olarak ölçeklenmiyor] (https://issues.sonatype.org/browse/TYCHO-335). – oberlies

+0

Aslında Nexus maven deposunu kullanarak bunu otomatik olarak çalışıyoruz. Tycho'nun oluşturduğu eserlerimizi (örneğin, url depoları/ürünlerim) dağıttığımız varsayılan maven deposu da içeriğini p2 mizanpajında ​​(url depoları/myproduct/.meta/p2) sunar. Her iki url de projemizin depo listesine eklendiğinde, bu kutudan çıktı gibi görünüyor! Dağıtılan bağımlılıklar çözülür ve yerel depodaki .m2/repository/p2/osgi/bundles' içinde ayrı bir dizine indirilir. – tbacker

1

Ben sadece maven koordinatlarına ek olarak ebeveyne göreli bir yol sağlamak gerek. Göreli yol olmadan, yalnızca ana pompa en azından yerel repo'nuzdaysa çalışır.

+0

Ebeveynin havuzdan alınması çalışır. Ebeveynler orada bulunabilir çünkü depolarda ayarlar dosyasında tanımlanmıştır. Göreli bir yol kullanmıyorum çünkü her seferinde tam uygulamayı kontrol etmeye zorluyor. Onu depodan alarak, her zaman erişilebilir. – tbacker

+1

Aslında, göreceli bir yol belirtiyorsunuz: eğer 'relativePath' varsayılanı atlandıysa, '.. '. Ancak, göreceli yolun işaret ettiği konumda * farklı * POM olmadığı sürece bu bir problem değildir. – oberlies

İlgili konular