我正在尝试使用 tycho 构建我的 eclipse 插件。
我的包com.mycompany.math需要org.apache.commons.math-1.2.0,它安装在我的 p2-repository 中。依赖项在org.mycompany.math的 MANIFEST.MF 中定义:
Require-Bundle: org.apache.commons.math;bundle-version="1.2.0",
在我的构建过程中,我收到了 org.apache.commons.math-classes 无法解决的错误消息。在构建开始之前,maven/tycho 下载了 2.1.0 版本。所以,我的问题是,当我在 MANIFEST.MF 中定义我使用 1.2.0 时,为什么要下载 maven/tycho 的 2.1.0。
您可以在我的父 pom.xml 中看到我定义了三个 p2 存储库。最后一个,包含我需要的 1.2.0 版本。
我的父母 pom.xml:
<project...>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>com.mycompany.build</artifactId>
<version>3.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Build</name>
<description>Parent POM for full builds</description>
<modules>
<!-- my modules -->
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tycho-version>0.16.0</tycho-version>
</properties>
<repositories>
<!-- configure p2 repository to resolve against -->
<repository>
<id>juno</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/juno/</url>
</repository>
<repository>
<id>orbit</id>
<layout>p2</layout>
<url>http://download.eclipse.org/tools/orbit/downloads/drops/S20121021123453/repository/</url>
</repository>
<repository> <-- CONTAINS ORG.APACHE.COMMONS.MATH-1.2.0 !
<id>comp</id>
<layout>p2</layout>
<url>http:our-adress.com/p2/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<!-- enable tycho build extension -->
<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>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</dependencyManagement>
还有我的com.company.math pom.xml
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>com.mycompany.math</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Math</name>
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>com.mycompany</groupId>
<artifactId>com.mycompany.build</artifactId>
<version>3.1.0-SNAPSHOT</version>
<relativePath>../com.mycompany.build</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>commons-math</groupId>
<artifactId>commons-math</artifactId>
<version>1.2</version>
</dependency>
</dependencies>