Ad

How Can I Pass Command Line Option To Phantomjs Maven Plugin

Im using phantomjs-maven-plugin in my Java project. I was trying to pass command line option to phantomjs with my pom.xml something like that(described in the plugin docs:

<plugin>
            <groupId>com.github.klieber</groupId>
            <artifactId>phantomjs-maven-plugin</artifactId>
            <version>0.7</version>
            <executions>
                <execution>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>install</goal>
                        <goal>exec</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <version>2.1.1</version>
                <checkSystemPath>true</checkSystemPath>
                <commandLineOptions>--ssl-protocol=any --ignore-ssl-errors</commandLineOptions>
                <script>assets/test.js</script>
                <arguments>
                    <argument>${liberty.https.server.port}</argument>
                </arguments>
            </configuration>
        </plugin>

Generally , what i was trying to do is something like that:

phantomjs --ssl-protocol=any --ignore-ssl-errors test.js

but with no luck for now, after hours of searching.

When i sty to run my maven task I get the following error:

[INFO] Executing phantomjs command
Invalid values for 'ssl-protocol' option.

I guess I have some syntax issues with this command line option.

Thanks for your help!

Ad

Answer

Finally I found what I did wrong here with the configuration. Just needed to move the <commandLineOptions> to configuration section inside the <execution> area. it finally will look line that:

    <execution>
        <phase>integration-test</phase>
        <goals>
            <goal>install</goal>
            <goal>exec</goal>
        </goals>
        <configuration>
            <commandLineOptions>--ssl-protocol=any --ignore-ssl-errors=true</commandLineOptions>
        </configuration>
    </execution>

and I removed that from the main configuration section below that.

I manage to figure out that what I did before that was to pass command line arguments to the execution of my test.js script and to the execution of the phantom.js .

I hope it will serve some lost guys like me :)

Ad
source: stackoverflow.com
Ad