We have a number of third party dependencies that aren\'t hosted anywhere. For each of these we have a jar file that we\'d like to be able to install and/or deploy to our reposi
I meet this problem in my work:
Now I have a target.jar (it has a dependencies list : a.jar, b.jar, c.jar...), I want to use
mvn install:install-file
to put it into my local repo, but when I run the command blow
mvn install:install-file -Dfile=/Users/username/.../target.jar -DgroupId=com.cnetwork.relevance -DartifactId=target -Dversion=1.0.0
but when I use it I found there are many error, the jar which use target.jar cannot find a.jar
, b.jar
, c.jar
, such as:
com.cnetwork.a does not exist
com.cnetwork.b does not exist
com.cnetwork.c does not exist
Then I went to ~/.m2/repository/.../target/1.0.0/target.pom
to find the pom file of the target, but nothing in it!
...
com.cnetwork.relevance
target
1.0.0
....
# no dependencies about a/b/c.jar !!!
This is what going wrong, the install:file -Dfile -DgroupId -D..
does not add dependencies into pom, I correct the answer by this method
if you already have this maven project source
, just install it into local repo
mvn clean install
if you have the jar and the pom of it
, install jar with pom
mvn install:install-file -Dfile=/.../.../target.jar -DpomFile=/.../../target.pom
if you don't have a pom with target jar
, write one and use upper command.
if you cannot recover the pom file of it, may be you should give up.