6
votes

I am getting an error as below:

For dependency Dependency {groupId=weblogic, artifactId=webservices, version=9.2, type=jar}: system- scoped dependency must specify an absolute path system Path

Not sure what is wrong. I have the environment variable configured which I am using in pom.xml

3

3 Answers

12
votes

When using system scope you have to provide an absolute path to the dependency (as opposed to any other dependencies, which are searched in Maven repositories). See System Dependencies in Introduction to the Dependency Mechanism.

Example:

<dependency>
  <groupId>javax.sql</groupId>
  <artifactId>jdbc-stdext</artifactId>
  <version>2.0</version>
  <scope>system</scope>
  <systemPath>${java.home}/lib/rt.jar</systemPath>
</dependency>

Why don't you just install your third-party artifact in your local/company repository?

EDIT: If you have systemPath defined but suspect that environment variable is not resolved, you will get the following error (note the presence of variable in the path):

The project ... has 1 error
'dependencies.dependency.systemPath' for weblogic:webservices:jar must specify an absolute path but is ${env.BEA_HOME}/lib/xyz.jar @ line ...

But if Maven discovers the variable and resolves it properly, the error message quoted above will contain already resolved directory (not a placeholder). Tested on Ubuntu/Maven 3.

1
votes

Can you post your 'Dependency' element from the pom?

Guessing that it's of scope 'system' and that there's a path in there, and that path is a relative path (eg '../../someJar.jar') instead of an absolute path (eg /opt/someDir/someJar.jar).

Maven needs an absolute path.

As a side note, you might want to look in to creating a local shared repository for non-public shared jars and steer away from the 'system' scope. System scope can bite you on the rear when the build is done in other environments.

0
votes

I ran into a similar issue when trying to build the arquillian-was-embedded-8 artifact. I'm using Win 7 64-bit as well. Using Git, I cloned the Arquillian Embedded WAS project within NetBeans and was faced with the same error. I changed my OS Environment variable while I had NetBeans open. Typically, you have to close all Windows Explorer windows and Command Prompt windows for the Environment variable to take effect. I took a chance and closed NetBeans as well. Upon opening NetBeans again, the project resolved the ${env.WAS8_HOME} variable. Strange...but whatever.