temp
temp

Reputation: 571

Import JAR files to spring using maven

I tried to import some JAR files to my maven spring project using maven install plugin. I placed the JARs in a lib folder in my base directory (where the POM.XML file is) and installed them one by one manually by running mvn install. My xml looks like:

EDIT:

    <dependency>
        <groupId>com.keydoxWeb</groupId>
        <artifactId>keydox</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>myPath\codecs.jar</systemPath>
    </dependency>

    <!-- and so on.. -->

Still telling me this error:

"Should use a variable instead of a hard coded path"

Upvotes: 1

Views: 1012

Answers (2)

unigeek
unigeek

Reputation: 2826

To import jars to your local repo, you generally would not have to or want to edit a pom.xml file. Rather there are shell commands that you can use to import the jars to your local maven repo (typically located at ~/.m2). Said commands are described here -- looks like this:

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

Once you do this, you'll also have to bring the dependencies into your projects pom.xml as explicit dependencies. That will look like this:

  <dependencies>   
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.6.0</version>
    </dependency>
    ...
  </dependencies>

Hope it helps!

Upvotes: 1

Konstantin Pribluda
Konstantin Pribluda

Reputation: 12367

Usually you do not have to import jars manually - they are installed by maven into local repository. And eclipse needs to know where this maven repository is. You may regenerate eclipse project files via

mvn eclipse:eclipse

(or switch to IntelliJ IDEA which opens maven projects natively)

Upvotes: 1

Related Questions