Ardesco / driver-binary-downloader-maven-plugin

A Maven plugin that will download the WebDriver stand alone server executables for use in your mavenised Selenium project.
Apache License 2.0
92 stars 52 forks source link

Causes maven antrun to run more than once #30

Closed mse-rspenceley closed 8 years ago

mse-rspenceley commented 9 years ago

Hi

I'm using Maven to not only download the WebDrivers, but also to launch Selenium. My POM file contains the following:

<build>
        <plugins>
            <plugin>
                <groupId>com.lazerycode.selenium</groupId>
                <artifactId>driver-binary-downloader-maven-plugin</artifactId>
                <version>1.0.7</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>selenium</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-antrun-plugin</artifactId>
             <version>1.7</version>
                <executions>
                    <execution>
                        <id>hub</id>
                        <phase>test-compile</phase>
                        <configuration>
                            <target>
                                <echo message="Launching Selenium Hub"/>
                                <java classname="org.openqa.grid.selenium.GridLauncher"
                                  classpathref="maven.test.classpath"
                                  failonerror="true"
                                  fork="false">
                                    <arg line="-role hub"/>
                                </java>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>node</id>
                        <phase>test-compile</phase>
                        <configuration>
                            <target>
                                <echo message="Launching Selenium Node"/>
                                <java classname="org.openqa.grid.selenium.GridLauncher"
                                  classpathref="maven.test.classpath"
                                  failonerror="true"
                                  fork="false">
                                    <arg line="-role node -nodeConfig selenium/${seleniumNodeConfig}"/>
                                </java>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

When I run mvn test, it fires up the Selenium Hub and Node, then downloads the binaries, then tries to fire up Selenium again, obviously failing because its already running (I don't want to turn off failonerror for that). Doesn't seem to matter how I change phases, this always happens. Any idea?

Ardesco commented 9 years ago

The binary downloader doesn't start selenium. It only downloads binaries.

Does it try to start selenium up twice if you remove the binary downloader

mse-rspenceley commented 9 years ago

I know it doesn't, the antrun task does that for me.

Yes, if I remove the downloader it runs twice; it runs the antrun tasks, then the downloader, then the antrun task again. Happens even if the antrun task is just 'echo Hello' or whatever

Ardesco commented 9 years ago

So it doesn't sound like a bug the the binary downloader (or standalone server plugin) then...

I would guess that your problem could be that you are using ant to start stuff up in the test compile phase and then selenium will try and run tests in the test, or integration test has. Some of what you have configured selenium to do may clash with what the antrun plugin is doing.