저는 Tycho가있는 Eclipse RCP 응용 프로그램에 대해 jUnit 테스트를 실행하려고합니다.Manifest.mf가 org.junit을 찾을 수 없습니다.
나는 Run> jUnit-Test를 클릭했을 때 실행되는 간단한 jUnit 테스트를 만들었다. 하지만 mvn 테스트를 실행하려면 jUnit을 찾지 못합니다.
저는 인터넷에서 jUnit을 Build-Path에 추가해야한다고 읽었습니다. -> 벌써 했어. 또한 JUnit을 Manifest.mf 파일에 require-bundle으로 추가해야한다는 것을 알게되었습니다. 그러나 문제가있다 !! 오류가 발생했습니다 : 번들 'org.junit'canot을 해결할 수 있습니다.
내 MANIFEST.MF 파일은 다음과 같다 :
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tests
Bundle-SymbolicName: myPackageName
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: myCompany
Fragment-Host: thePackageWhereTestesPluginIs
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.junit
내 실수 어디에 있습니까? org.junit4를 가져 가면 해결할 수 없습니다 ...
Thank you!
업데이트 : 지금은 대신 필요 - 번들의 사용
:
Import-package: org.junit4
(또는 org.junit은 그 행동은 동일)과는 MANIFEST.MF 파일에 해결 될 수 있습니다 . 하지만 실행하면 다음 오류가 발생합니다. [오류] -> [도움말 1] org.apache.maven.InternalErrorException : 내부 오류 : java.lang.RuntimeException : org.osgi.framework.BundleException : 번들 myTestBundle 해결할 수 없음 해결 오류 : 번들 myTestBundle - 누락 된 제약 : 가져 오기 - 패키지 : org.junit4; 버전 = "0.0.0"
어떻게 해결할 수 있습니까?
감사합니다. 테스트 번들의
내 치어 파일 :
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>myProject.tycho.master</artifactId>
<groupId>myProject</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../myProject.tycho.master/pom.xml</relativePath>
</parent>
<groupId>myProject</groupId>
<artifactId>myProject.myTestBundle</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
</dependency>
</dependencies>
</project>
부모 POM :
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>myProject</groupId>
<artifactId>myProject.tycho.master</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<tycho.version>0.17.0</tycho.version>
</properties>
<modules>
<module>../myProject.myTestBundle</module>
</modules>
<repositories>
<!-- configure p2 repository to resolve against -->
<repository>
<id>Repository1</id>
<layout>p2</layout>
<url>url-to-a-p2-site-on-my-server</url>
</repository>
</repositories>
<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>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
<target>
<artifact>
<groupId>myGroupId</groupId>
<artifactId>myGroupId.target</artifactId>
<classifier>targetPlatform</classifier>
</artifact>
</target>
<environments>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86</arch>
</environment>
<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>
</environments>
<ignoreTychoRepositories>false</ignoreTychoRepositories>
</configuration>
</plugin>
</plugins>
</build>
</project>
업데이트 : 내가 문제가 해결 같아! 내 p2 업데이트 사이트에 jUnit을 추가했는데 오류가 발생하지 않았습니다!
당신의 치어 파일을 게시 할 수 너의 pom 파일. – khmarbaise
이제 추가했습니다. 도움을 주셔서 감사합니다. – tralala
Tycho가 더 나은 오류 메시지를 출력해야합니다. https://bugs.eclipse.org/bugs/show_bug.cgi?id=405790 – oberlies