3

I want to use Jmathplot.jar

I tried to put it as a dependency

<dependency>
      <groupId>jmathplot</groupId>
      <artifactId>jmathplot</artifactId>
      <version>1.0</version>
      <scope>system</scope>
      <systemPath>${project.basedir}/lib/jmathplot.jar</systemPath>
    </dependency>

but when installing I get this error:

Some problems were encountered while building the effective model for com.NResearch:dable-start-tRisk:jar:0.1-SNAPSHOT 
[WARNING] 'dependencies.dependency.systemPath' for jmathplot:jmathplot:jar should not point at files within the project directory, ${project.basedir}/lib/jmathplot.jar will be unresolvable by dependent projects @ line 44, column 19 

How can I get around this please?

EDIT1:

I cannot change Maven to include all dependent jars into a single jar. As this is uploaded to a web project.

ManInMoon
  • 6,795
  • 15
  • 70
  • 133

2 Answers2

1

"Dependent" is using your project, "dependency" is used by your project.

The real error here is that jmathplot.jar is in a folder that can really only reliably be found by your project. Even though your dependents know how to find your artifact in the local repository, they won't know where the sources are for your artifact, hence won't be able to find lib/jmathplot.jar. You can fix that by changing the systemPath to an absolute path. It can still be parametrized, but then please use properties rather than implicit properties (such as ${project.basedir}.

It'd be better to get rid of the systemPath dependency, by installing jmathplot into a company repository, so it can be used alike 'normal' artifacts. But that may not be a useful option if you have to distribute your artifact out of the reach of your company repository. It would even be better if jmathplot would just get deployed to the Maven central repository.

As a last resort you may choose to bundle the dependencies (not the dependents). You can do this:

  • Using the Maven Shade Plugin. It lets you choose which packages to include which may be useful to bundle only jmathplot (and not other dependencies).
  • Using the Maven Assembly Plugin. It has a predefined descriptor for "JAR with dependencies" which would fit your use case. You could create your own descriptor off of that example and set dependencySets.dependencySet.scope=system to only include the system dependencies that are giving you trouble.
Sander Verhagen
  • 8,540
  • 4
  • 41
  • 63
-1

Best way is to install your dependency on your local repository. To do this:

1) using project source, install to local repository using mvn install

2) if you don't have source code, install to local repository using this

hope it's help

nota: you are spamming around this question, do you ? (see here: JMathPlot what is the Maven dependency code please )

Community
  • 1
  • 1
Vokail
  • 630
  • 8
  • 27
  • Does this mvn command need to be installed on my windows PC? And do I call from command window? I was hoping I could do this from within eclipse? – ManInMoon Oct 28 '13 at 17:24
  • To install maven please see [this](http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html) You can launch same command from Eclipse using launch configuration -> new launch configuration -> maven – Vokail Oct 29 '13 at 10:11