2

I want to develop java libray using org.robotframework(2.8.4) and maven.

My pom.xml:

<dependencies>
        <dependency>
            <groupId>org.robotframework</groupId>
            <artifactId>robotframework</artifactId>
            <version>2.8.4</version>
        </dependency>
<dependencies>

I want my custom script file follow format (without add classpath)

java -jar myjarfile.jar %*

How can i do that

1 Answer 1

2

you must create file main of Robot framework like:

    import org.robotframework.RobotFramework;

    public class RobotFrameworkTest {
        public static void main(String[] args) {
            prepareYourEnvironmentTest();
            RobotFramework.main(args);
        }
        private static void prepareYourEnvironmentTest() {
            // your code
        }
    }

In pom.xml file you must use maven shade plugin:

<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>
Sign up to request clarification or add additional context in comments.

1 Comment

Great work! I use spring framework to create robot test lib. It works! Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.