可能重複:
How to reference mockito within tycho?無法解析的Mockito依賴於第谷項目
我要去跟第谷的測試功能項目建設,但它未能解決中列出的依賴我的pom來自Maven中央存儲庫,它在我的父pom中列出。下面是相關的部分從我父POM:
<properties>
<tycho-version>0.12.0</tycho-version>
</properties>
<repositories>
<repository>
<id>helios</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/helios/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<build>
<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>
<pomDependencies>consider</pomDependencies>
<resolver>p2</resolver>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
,並在這裏我有POM:
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>parent</artifactId>
<groupId>com.example</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.example</groupId>
<artifactId>com.example.testing.feature</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</dependency>
</dependencies>
,當我在我的功能項目運行mvn清潔套裝,我得到如下:
[INFO]添加存儲庫http://download.eclipse.org/releases/helios/ [INFO]添加存儲庫http://download.eclipse.org/releases/helios/ [調試]添加了p2存儲庫helios(http://download.eclipse.org/releases/helios/ ) [DEBUG]忽略Maven倉庫中央(http://repo1.maven.org/maven2)
然後我的構建失敗,因爲我的依賴無法解析。我錯過了什麼嗎?這是因爲爲目標平臺配置配置了p2解析器嗎?
控制檯輸出最重要的部分丟失了:哪個依賴項無法解析?可能是'org.mockito.mockito-all'的傳遞依賴鏈中的某些東西(參見[這個答案](http://stackoverflow.com/a/11951980/1523648)) – oberlies 2012-08-27 15:56:44