Steerpike
Steerpike

Reputation: 1853

Manually install a jar in my local Maven repo

I have a project which has a dependency on a locally stored .jar file. This .jar file contains core dependencies for the module I need to work on. The jar has it's own pom file.

I'm using Windows and IntelliJ.

I'm trying to import the jar into my local .m2 repo as follows:

mvn install:install-file
"-Dfile=C:/webApp/web-core-app/resources/web-core-3.1.17-SNAPSHOT.jar"
"-DpomFile=C:/webApp/web-core-app/resources/web-core-3.1.17-SNAPSHOT.pom"

I keep getting the following error:

"The system cannot find the file specified"

This is probably an obvious one but I've tried all sorts of options. Can anyone give me a nudge?

Upvotes: 1

Views: 13580

Answers (2)

DwB
DwB

Reputation: 38300

It seems likely that you are not able to consistently enter the long path to the files in question, since you appear to have done it wrong twice already in the text of your question.

Try this:

  1. make a temporary directory somewhere on your local disk. Lets call it c:\tmp
  2. Copy the jar file and the pom file to the c:\tmp directory.
  3. Run the command to load it into Maven from the c:\tmp directory.

Here are some example commands (long commands wrapped to make reading easier):

c:
cd \tmp
mvn install:install-file -Dfile=web-core-3.1.17-SNAPSHOT.jar
-DpomFile=web-core-3.1.17-SNAPSHOT.pom.xml

Here is a Link To Some Helpful Maven Info

Here is a nutty suggestion: If the web-core*.jar file was built by you using maven, then in the web-core*.jar project directory, run the following command to have Maven install it in the local repo:

mvn install

Upvotes: 5

Clover
Clover

Reputation: 559

Try removing double quotes and as @Meier said, add absolute path

Sample:

mvn install:install-file -Dfile=C:/webApp/web-core-app/resources/web-core-3.1.17-SNAPSHOT.jar -DpomFile=path/to/your/xml/web-core-3.1.17-SNAPSHOT.pom.xml

Upvotes: 0

Related Questions