You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

You can manually modify your build system to ensure that all the required dependencies are available.

Adding Dependencies in Maven

Modify the pom.xml file by adding new entries to the <dependencies> section. The following entries include all the required libraries:

<dependency>
	<groupId>junit</groupId>
	<artifactId>junit</artifactId>
	<version>4.12</version>
	<scope>test</scope>
</dependency>
<dependency>
	<groupId>org.mockito</groupId>
	<artifactId>mockito-all</artifactId>
	<version>1.10.19</version>
	<scope>test</scope>
</dependency>
<dependency>
	<groupId>com.liferay</groupId>
	<artifactId>org.powermock.modules.junit4</artifactId>
	<version>1.5.6.LIFERAY-PATCHED-1</version>
</dependency>
<dependency>
	<groupId>org.powermock</groupId>
	<artifactId>powermock-core</artifactId>
	<version>1.6.5</version>
</dependency>
<dependency>
	<groupId>org.powermock</groupId>
	<artifactId>powermock-api-mockito</artifactId>
	<version>1.6.5</version>
	<scope>test</scope>
</dependency>
<dependency>
	<groupId>org.powermock</groupId>
	<artifactId>powermock-api-support</artifactId>
	<version>1.6.5</version>
</dependency>
<dependency>
	<groupId>pl.pragmatists</groupId>
	<artifactId>JUnitParams</artifactId>
	<version>1.0.6</version>
</dependency>

Adding Dependencies in Gradle

Modify the build.gradle file by adding new entries to the dependencies section. The following entries include all the required libraries:

testCompile 'org.powermock:powermock-module-junit4:1.6.5'
testCompile 'org.powermock:powermock-api-mockito:1.6.5'
testCompile 'junit:junit:4.11'
testCompile 'pl.pragmatists:JUnitParams:1.0.6'

Adding Dependencies in Ant

Ant requires that you manually add all the required JAR files to a separate directory, and include that directory by modifying the build.xml file  in the following way:

<classpath>
    <!-- filesets can be used in classpath and bootpath -->
	<fileset dir="C:/directory_name/lib">
				<include name="**/*.jar"/>
    </fileset>
</classpath>

The following libraries are required:

  • junit-4.11
  • JUnitParams-1.0.6
  • mockito-all-1.9.5
  • powermock-mockito-1.5.5-full

The libraries are available online or in the [INSTALL_DIR]/examples/demo/lib.


  • No labels