
- Maven install dependency from pom command line install#
- Maven install dependency from pom command line code#
This is what going wrong, the install:file -Dfile -DgroupId -D. Then I went to ~/.m2/repository/./target/1.0.0/target.pom to find the pom file of the target, but nothing in it!. 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= -DartifactId=target -Dversion=1.0.0īut 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: does not exist But I haven't seen any real consequences of that. The only downside I see to this approach is that the artifact gets deployed as type pom instead of type jar.
Maven install dependency from pom command line code#
Maven install dependency from pom command line install#
The attach-artifact execution should be under so it doesn't get executed if you mvn install or mvn deploy the parent pom.Some of the pieces of this that initially tripped me up:

Inspired by a post to the maven-users list and using the build-helper plugin, in the parent pom, I have: Ok, I found a solution that allows me to run just mvn install or mvn deploy and have the jar file installed to the local or remote repository.


To get this to work, at least for deploying, I tried putting the following in my parent pom: Īnd then having each of the child poms define the jarfile property. I'd like to be able to install or deploy these dependencies with something as simple as mvn install and mvn deploy (or maybe mvn install:install-file and mvn deploy:deploy-file) and have all the necessary properties for these commands ( artifactId, repositoryId, etc.) be read from the pom.xml files.

These pom.xml files all have a common parent pom that declares some of the common info (e.g. We've made pom.xml files for each jar file that declare the groupId, artifactId, dependencies, etc. Some of the jar files have their own dependencies and we also need to declare these. For each of these we have a jar file that we'd like to be able to install and/or deploy to our repository. We have a number of third party dependencies that aren't hosted anywhere.
