开源软件名称(OpenSource Name):klieber/phantomjs-maven-plugin开源软件地址(OpenSource Url):https://github.com/klieber/phantomjs-maven-plugin开源编程语言(OpenSource Language):Java 96.5%开源软件介绍(OpenSource Introduction):phantomjs-maven-plugin
A maven plugin for installing the phantomjs binary on your system automatically. You no longer need to have phantomjs pre-installed on your CI server or development workstation in order to use it as part of your build. Just add the following to your build: <project>
...
<!-- phantomjs-maven-plugin needs maven 3.1+ -->
<prerequisites>
<maven>3.1</maven>
</prerequisites>
...
<build>
<plugins>
<plugin>
<groupId>com.github.klieber</groupId>
<artifactId>phantomjs-maven-plugin</artifactId>
<version>${phantomjs-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
<configuration>
<version>1.9.7</version>
</configuration>
</plugin>
</plugins>
</build>
...
</projects>
The plugin also makes the property Example using with jasmine-maven-plugin: <project>
...
<build>
<plugins>
<plugin>
<groupId>com.github.klieber</groupId>
<artifactId>phantomjs-maven-plugin</artifactId>
<version>${phantomjs-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
<configuration>
<version>1.9.7</version>
</configuration>
</plugin>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>${jasmine-maven-plugin-version}</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
<configuration>
<webDriverClassName>org.openqa.selenium.phantomjs.PhantomJSDriver</webDriverClassName>
<webDriverCapabilities>
<capability>
<name>phantomjs.binary.path</name>
<value>${phantomjs.binary}</value>
</capability>
</webDriverCapabilities>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</projects> Example using in a JUnit test: <project>
...
<build>
<plugins>
<plugin>
<groupId>com.github.klieber</groupId>
<artifactId>phantomjs-maven-plugin</artifactId>
<version>${phantomjs-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
<configuration>
<version>1.9.7</version>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<systemPropertyVariables>
<phantomjs.binary>${phantomjs.binary}</phantomjs.binary>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
...
</projects> Then your JUnit test can access it like this: package org.example;
import org.junit.Test;
import java.io.File;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class ExampleTest {
@Test
public void shouldHavePhantomJsBinary() {
String binary = System.getProperty("phantomjs.binary");
assertNotNull(binary);
assertTrue(new File(binary).exists());
}
} The plugin can also execute phantomjs scripts for you as well. The following downloads phantomjs automatically if it isn't already present on the system and then executes the script <project>
...
<build>
<plugins>
<plugin>
<groupId>com.github.klieber</groupId>
<artifactId>phantomjs-maven-plugin</artifactId>
<version>${phantomjs-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>install</goal>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<version>1.9.7</version>
<checkSystemPath>true</checkSystemPath>
<script>hello.js</script>
<arguments>
<argument>Bob</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
...
</projects>
More documentation can be found on the plugin site: http://klieber.github.io/phantomjs-maven-plugin |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论