PhantomJS Maven Core

A library for downloading, installing, and executing phantomjs.

License

License

Categories

Categories

JavaScript Languages Maven Build Tools Ant
GroupId

GroupId

com.github.klieber
ArtifactId

ArtifactId

phantomjs-maven-core
Last Version

Last Version

0.7
Release Date

Release Date

Type

Type

jar
Description

Description

PhantomJS Maven Core
A library for downloading, installing, and executing phantomjs.

Download phantomjs-maven-core

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.klieber/phantomjs-maven-core/ -->
<dependency>
    <groupId>com.github.klieber</groupId>
    <artifactId>phantomjs-maven-core</artifactId>
    <version>0.7</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.klieber/phantomjs-maven-core/
implementation 'com.github.klieber:phantomjs-maven-core:0.7'
// https://jarcasting.com/artifacts/com.github.klieber/phantomjs-maven-core/
implementation ("com.github.klieber:phantomjs-maven-core:0.7")
'com.github.klieber:phantomjs-maven-core:jar:0.7'
<dependency org="com.github.klieber" name="phantomjs-maven-core" rev="0.7">
  <artifact name="phantomjs-maven-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.klieber', module='phantomjs-maven-core', version='0.7')
)
libraryDependencies += "com.github.klieber" % "phantomjs-maven-core" % "0.7"
[com.github.klieber/phantomjs-maven-core "0.7"]

Dependencies

compile (8)

Group / Artifact Type Version
org.apache.maven : maven-core jar 3.2.1
org.codehaus.plexus : plexus-utils jar 3.0.22
org.eclipse.aether : aether-api jar 0.9.1.v20140329
org.eclipse.aether : aether-util jar 0.9.1.v20140329
de.schlichtherle.truezip : truezip-driver-zip jar 7.7.8
de.schlichtherle.truezip : truezip-driver-tar jar 7.7.8
de.schlichtherle.truezip : truezip-file jar 7.7.8
org.slf4j : slf4j-api jar 1.7.12

test (6)

Group / Artifact Type Version
junit : junit jar 4.12
org.slf4j : slf4j-nop jar 1.7.12
org.mockito : mockito-core jar 1.10.19
org.powermock : powermock-module-junit4 jar 1.6.2
org.powermock : powermock-api-mockito jar 1.6.2
eu.codearte.catch-exception : catch-exception jar 1.4.4

Project Modules

There are no modules declared in this project.

phantomjs-maven-plugin

This project is no longer being actively maintained. This aligns with the announcement that the PhantomsJS is no longer in active development. Please consider using Headless Chrome as an alternative. Thank you everyone for your support!

Build Status Coverage Status Maven Central Stories in Ready Flattr this git repo

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 phantomjs.binary available after it installs phantomjs so that you can use it to configure other maven plugins that use phantomjs or so that it can be used in your JUnit testing.

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 hello.js with the argument Bob (see full example here):

<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

Versions

Version
0.7
0.6