机器人框架:为缺少的Jar

时间:2016-09-24 14:32:55

标签: maven-2 automated-tests maven-plugin robotframework

我已经开始学习Robot Framework(使用Java& selenium lib)并且正在尝试编写一个简单的测试用例。你能帮帮我吗? 我已经在提到的lib中复制了工具jar,也在依赖中复制了工具jar 但仍然没有奏效 以下是错误

无法执行目标org.robotframework:robotframework-maven-plugin:1.4.6:在项目上运行(default-cli)JavaRobot:目标org.robotframework的执行default-cli:robotframework-maven-plugin: 1.4.6:运行失败:插件org.robotframework:robotframework-maven-plugin:1.4.6或其中一个依赖项无法解析:找不到工件com.sun:tools:jar:6在指定路径C:\ Program Files \ Java \ jre1.8.0_101 /../ lib / tools.jar - > [帮助1]

这是我的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>com.test.Robot</groupId>
  <artifactId>JavaRobot</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>JavaRobot</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

      <dependency>
      <groupId>org.robotframework</groupId>
      <artifactId>robotframework</artifactId>
      <version>2.8.4</version>
      <scope>test</scope>
    </dependency>

    <dependency>
   <groupId>com.sun</groupId>
   <artifactId>tools</artifactId>
   <version>1.6</version>
   <scope>system</scope>
   <systemPath>C:\Program Files\Java\jdk1.8.0_101\lib\tools.jar</systemPath>
 </dependency>


     <dependency>
      <groupId>com.github.markusbernhardt</groupId>
      <artifactId>robotframework-selenium2library-java</artifactId>
      <version>1.4.0.8</version>
      <scope>test</scope>
    </dependency>
   </dependencies>

   <build>
        <plugins>
            <plugin>
                <groupId>org.robotframework</groupId>
                <artifactId>robotframework-maven-plugin</artifactId>
                <version>1.4.6</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
   </build>
</project>

1 个答案:

答案 0 :(得分:1)

尝试添加排除项,我认为它会解决您的问题。 示例:

<dependency>
<groupId>com.github.markusbernhardt</groupId>
<artifactId>robotframework-selenium2library-java</artifactId>
<version>1.4.0.7</version>
<scope>test</scope>
<exclusions>
    <exclusion>
        <artifactId>tools</artifactId>
        <groupId>com.sun</groupId>
    </exclusion>
</exclusions>