他のサードパーティに依存するMaven/Tychoを使用してEclipseプラグインを構築する必要があります。依存関係の埋め込みはTychoでまだサポートされていないため、次のようにプロジェクトを2つに分割しました。
A-thirdparty
: maven-bundle-pluginによってビルドされ、「Embed-Dependency」命令を持ち、プラグイン「A」に必要なすべてのパッケージをエクスポートするパッケージ「bundle」を使用したプロジェクトA
:tycho-maven-pluginを使用したパッケージング「eclipse-plugin」と、にpomDependencies
設定されたTychoのtarget-platform-configurationプラグインを使用したプロジェクトconsider
。
それらを個別にビルドすると(最初はサードパーティのアグリゲーター、次にプロジェクトA自体)、すべてが正常に機能します。ただし、(マルチモジュールPOMを使用して)両方のプロジェクトを集約すると、次のMavenエラーが発生します。
Caused by: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from A 1.0.0.qualifier to package org.apache.axis2.transaction 0.0.0.", "Unable to satisfy dependency from A 1.0.0.qualifier to package org.apache.axis2.addressing.i18n 0.0.0.", ...
プロジェクトを集約してビルドするとこのエラーが発生するのはなぜですか。それがTychoのバグである場合、どのような回避策が考えられますか?
ただし、集約POMにモジュールを1つだけ残しておけば、エラーは発生しません(独立してどのモジュールか)。
編集
小さな、同様のマルチモジュールサンプルでは再現できません。つまり、私のPOM階層に何かがあるということです。
EDIT2
同じ依存関係のセット(axis2とaxiom libsのカップル)を含めた後、小さな同様のマルチモジュールサンプルで再現することができました。
EDIT3:最小限の例
今、問題は、私が含めたサードパーティライブラリに必要なすべてのサードパーティが欠落していることであるかどうか疑問に思っています。もしそうなら、なぜ私は両方のモジュールを別々に実行するときに正常にビルドでき、親のマルチモジュールpom.xmlを介して実行された場合にのみビルドが失敗するのですか?以下の例には、 first -thirdpartyという名前のpom-firstアーティファクトにバンドルされた単一のaxis2-kernelJARが1つだけ含まれています。
の代わりにA
、exampleにはkeywoardがありfirst
ます。フォルダ構造は次のとおりです。
./pom.xml
./first-thirdparty
pom.xml
./first
src/main/java/org/mydemo/Test.java // has just one method that simply returns AxisFault.class.getSimpleName(); to test import resolution
META-INF/MANIFEST.MF
build.properties
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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.mydemo</groupId>
<artifactId>first-aggregator</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
<modules>
<module>first-thirdparty</module>
<module>first</module>
</modules>
</project>
のPOM first-thirdparty
。axis2-kernel JARを埋め込むだけです(他のライブラリはありません..):
<?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>org.mydemo</groupId>
<artifactId>first-aggregator</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<properties>
<manifest-location>META-INF</manifest-location>
</properties>
<packaging>bundle</packaging>
<groupId>org.mydemo</groupId>
<artifactId>first-thirdparty</artifactId>
<version>1.0.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.5.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Embed-Dependency>
axis2-kernel
</Embed-Dependency>
<_exportcontents>
org.apache.axis2.*;version="1.5.1"
</_exportcontents>
<Bundle-ClassPath>{maven-dependencies}</Bundle-ClassPath>
<Embed-Transitive>true</Embed-Transitive>
<Embed-Directory>jars</Embed-Directory>
<_failok>true</_failok>
<_nouses>true</_nouses>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
のPOMfirst
は、日食プラグインであり、以下に依存しfirst-thirdparty
ます。
<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>org.mydemo</groupId>
<artifactId>first-aggregator</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>org.mydemo</groupId>
<artifactId>org.mydemo.first-bundle</artifactId>
<packaging>eclipse-plugin</packaging>
<version>1.0.0-SNAPSHOT</version>
<properties>
<tycho.ver>0.14.1</tycho.ver>
</properties>
<repositories>
<repository>
<id>helios</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/indigo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.mydemo</groupId>
<artifactId>first-thirdparty</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho.ver}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.ver}</version>
<configuration>
<pomDependencies>consider</pomDependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>
モジュールのMANIFEST.MF first
; axis2-kernelのすべてのパッケージを明示的にインポートします。
Manifest-Version: 1.0
Bundle-Version: 1.0.0.qualifier
Tool: Bnd-0.0.357
Bundle-Name: first-bundle
Bnd-LastModified: 1334819004300
Created-By: 1.6.0_25 (Sun Microsystems Inc.)
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.mydemo.first-bundle
Export-Package: org.mydemo
Import-Package: org.apache.axis2.clustering.context,
org.apache.axis2.modules,
org.apache.axis2.deployment.util,
org.apache.axis2.dataretrieval.client,
org.apache.axis2.clustering,
org.apache.axis2.wsdl.util,
org.apache.axis2.clustering.configuration,
org.apache.axis2.java.security,
org.apache.axis2.deployment.resolver,
org.apache.axis2.util,
org.apache.axis2.wsdl,
org.apache.axis2.addressing.metadata,
org.apache.axis2.i18n,
org.apache.axis2.deployment.scheduler,
org.apache.axis2.dataretrieval,
org.apache.axis2.dispatchers,
org.apache.axis2.transport,org.apache.axis2.service,
org.apache.axis2.deployment.repository.util,
org.apache.axis2.client,
org.apache.axis2.context,
org.apache.axis2.classloader,
org.apache.axis2.receivers,
org.apache.axis2.engine,
org.apache.axis2.addressing,
org.apache.axis2.deployment,
org.apache.axis2.transport.http,
org.apache.axis2.phaseresolver,
org.apache.axis2.context.externalize,
org.apache.axis2.transaction,
org.apache.axis2.description,
org.apache.axis2.addressing.wsdl,
org.apache.axis2.transport.http.util,
org.apache.axis2.util.threadpool,
org.apache.axis2,
org.apache.axis2.handlers,
org.apache.axis2.addressing.i18n,
org.apache.axis2.builder,
org.apache.axis2.description.java2wsdl,
org.apache.axis2.builder.unknowncontent,
org.apache.axis2.namespace,
org.apache.axis2.description.java2wsdl.bytecode,
org.apache.axis2.client.async,
org.osgi.framework;version="1.3.0"
Bundle-Localization: plugin