1

我目前尝试通过 Maven 在 Eclipse RCP 上运行 SWTBot 测试。

这是我的 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>my.package</groupId>
<artifactId>my.package.swtbot</artifactId>
<version>1.0.0</version>
<packaging>eclipse-test-plugin</packaging>
<parent>
    <groupId>my.package</groupId>
    <artifactId>my.package.parent</artifactId>
    <version>0.0.1</version>
    <relativePath>../my.package.parent/pom.xml</relativePath>
</parent>

但我得到这些错误:

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: my.package.swtbot 1.0.0
[ERROR]   Missing requirement: my.package.swtbot 1.0.0 requires 'bundle org.eclipse.swtbot.eclipse.core 0.0.0' 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 my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.eclipse.core 0.0.0.; Unable to satisfy dependency from my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.eclipse.finder 0.0.0.; Unable to satisfy dependency from my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.eclipse.gef.finder 0.0.0.; Unable to satisfy dependency from my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.junit4_x 0.0.0.; Unable to satisfy dependency from my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.forms.finder 0.0.0.; Unable to satisfy dependency from org.eclipse.jdt.core 3.9.0.v_OTDT_r220_201306071800 to org.eclipse.objectteams.otdt.core.patch.feature.group [2.0.0,3.0.0).; Unable to satisfy dependency from org.eclipse.jdt.core 3.9.1.v_OTDT_r221_201309101918 to org.eclipse.objectteams.otdt.core.patch.feature.group [2.0.0,3.0.0).; Unable to satisfy dependency from org.eclipse.jdt.core 3.9.2.v_OTDT_r222_201402180730 to org.eclipse.objectteams.otdt.core.patch.feature.group [2.0.0,3.0.0).; 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 my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.eclipse.core 0.0.0.; Unable to satisfy dependency from my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.eclipse.finder 0.0.0.; Unable to satisfy dependency from my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.eclipse.gef.finder 0.0.0.; Unable to satisfy dependency from my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.junit4_x 0.0.0.; Unable to satisfy dependency from my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.forms.finder 0.0.0.; Unable to satisfy dependency from org.eclipse.jdt.core 3.9.0.v_OTDT_r220_201306071800 to org.eclipse.objectteams.otdt.core.patch.feature.group [2.0.0,3.0.0).; Unable to satisfy dependency from org.eclipse.jdt.core 3.9.1.v_OTDT_r221_201309101918 to org.eclipse.objectteams.otdt.core.patch.feature.group [2.0.0,3.0.0).; Unable to satisfy dependency from org.eclipse.jdt.core 3.9.2.v_OTDT_r222_201402180730 to org.eclipse.objectteams.otdt.core.patch.feature.group [2.0.0,3.0.0).; No solution found because the problem is unsatisfiable.]
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:166)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.RuntimeException: No solution found because the problem is unsatisfiable.: [Unable to satisfy dependency from my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.eclipse.core 0.0.0.; Unable to satisfy dependency from my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.eclipse.finder 0.0.0.; Unable to satisfy dependency from my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.eclipse.gef.finder 0.0.0.; Unable to satisfy dependency from my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.junit4_x 0.0.0.; Unable to satisfy dependency from my.package.swtbot 1.0.0 to bundle org.eclipse.swtbot.forms.finder 0.0.0.; Unable to satisfy dependency from org.eclipse.jdt.core 3.9.0.v_OTDT_r220_201306071800 to org.eclipse.objectteams.otdt.core.patch.feature.group [2.0.0,3.0.0).; Unable to satisfy dependency from org.eclipse.jdt.core 3.9.1.v_OTDT_r221_201309101918 to org.eclipse.objectteams.otdt.core.patch.feature.group [2.0.0,3.0.0).; Unable to satisfy dependency from org.eclipse.jdt.core 3.9.2.v_OTDT_r222_201402180730 to org.eclipse.objectteams.otdt.core.patch.feature.group [2.0.0,3.0.0).; No solution found because the problem is unsatisfiable.]
    at org.eclipse.tycho.p2.resolver.AbstractResolutionStrategy.newResolutionException(AbstractResolutionStrategy.java:98)
    at org.eclipse.tycho.p2.resolver.ProjectorResolutionStrategy.resolve(ProjectorResolutionStrategy.java:88)
    at org.eclipse.tycho.p2.resolver.AbstractResolutionStrategy.resolve(AbstractResolutionStrategy.java:63)
    at org.eclipse.tycho.p2.impl.resolver.P2ResolverImpl.resolveDependencies(P2ResolverImpl.java:157)
    at org.eclipse.tycho.p2.impl.resolver.P2ResolverImpl.resolveDependencies(P2ResolverImpl.java:107)
    at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.doResolveDependencies(P2TargetPlatformResolver.java:348)
    at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.resolveDependencies(P2TargetPlatformResolver.java:321)
    at org.eclipse.tycho.core.resolver.DefaultTychoDependencyResolver.resolveProject(DefaultTychoDependencyResolver.java:109)
    at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:75)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:310)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    ... 11 more

我真的不知道如何满足这些依赖关系,有人知道吗?:)

4

1 回答 1

1

您需要将 SWTBot p2 存储库添加到Tycho 构建的目标平台<repositories>,例如通过在父 pom.xml的部分中添加以下代码段:

<repository>
    <id>swtbot</id>
    <url>http://download.eclipse.org/technology/swtbot/releases/2.2.1/</url>
    <layout>p2</layout>
</repository>

如果您需要不同版本的 SWTBot,可以在SWTBot 主页的下载部分找到指向 p2 存储库的链接。

于 2014-11-28T15:31:32.997 回答