我想使用org.robotframework(2.8.4)和maven开发java libray。
我的pom.xml:
<dependencies>
<dependency>
<groupId>org.robotframework</groupId>
<artifactId>robotframework</artifactId>
<version>2.8.4</version>
</dependency>
<dependencies>
我希望我的自定义脚本文件遵循格式(不添加类路径)
java -jar myjarfile.jar %*
我该怎么做
答案 0 :(得分:2)
你必须创建Robot框架的文件主体,如:
import org.robotframework.RobotFramework;
public class RobotFrameworkTest {
public static void main(String[] args) {
prepareYourEnvironmentTest();
RobotFramework.main(args);
}
private static void prepareYourEnvironmentTest() {
// your code
}
}
在pom.xml文件中,您必须使用maven shade插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>ors.robotframework.RobotFrameworkTest</Main-Class>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>