如何从外部 java 库导入 robot-file?

How can I import robot-file from external java library?

我使用Java + Robot Framework 来测试微服务。 所以我为每个服务创建了几个测试项目。 为了进行测试,我创建了一些 java 类 关键字以在低级别上使用 HTTP 和 JSON。我将这些 类 分离到一个库中,我计划将其作为 Maven 依赖项添加到测试项目中。

此外,我想将常用关键字添加到此外部库的 robot-file 中。

但问题是我无法在测试中导入那些 robot-file。

请注意第一张图是外部工程,第二张图是测试工程

有没有人遇到过这样的问题,如果遇到过,您做出了怎样的决定?

我设法通过 Maven 插件应用 hack。所以我只是复制当前项目中的资源。

<build>
       …
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>prototype-apitesting</groupId>
                                    <artifactId>apitesting</artifactId>
                                    <version>${acceptence.test.library.version}</version>
                                    <type>jar</type>
                                    <includes>com.robot.common/*</includes>
                                    <outputDirectory>${basedir}/src/main/resources</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

外部库的结构

├── java
│   └── com
│       └── robot
│           └── sample
│               └── keywords
│                   └── APITestingKeywords.java
└── resources
    └── com.robot.common
        ├── Config.robot
        ├── HttpAssertions.robot
        └── keywords
            ├── AccountServicesKeywords.robot
            └── SessionServicesKeywords.robot