Maven Dependency System Scope Warning

  • Post author:
  • Post category:Java

We use PubNub and it is not in the Maven central repository as of this writing, so we have been using it as as system scope dependency in our Maven pom.xml. The dependency XML looks like this:

<dependency>
	<groupId>pubnub</groupId>
	<artifactId>pubnub</artifactId>
	<version>${pubnub.version}</version>
	<scope>system</scope>
	<systemPath>${basedir}/lib/pubnub-3.1.jar</systemPath>
</dependency>

We get a Maven warning about this setting and have been ignoring it for some time. To finally remove the warning, we have moved PubNub to our local repository by running mvn install.

mvn install:install-file -Dfile=libpubnub-3.1.jar -DgroupId=pubnub -DartifactId=pubnub -Dversion=3.1 -Dpackaging=jar

Now we can remove the system scope.

<dependency>
	<groupId>pubnub</groupId>
	<artifactId>pubnub</artifactId>
	<version>${pubnub.version}</version>
</dependency>