Reputation: 2451
We have several third-party lib jars, i would like to deploy to Artifactory with dependent jars!
Hence, when third party jar is referenced, all the dependent jars will be downloaded automatically by maven?
for example, xxy-company-api-9.0.jar, this jar may require abc-9.1.jar, commons-lang-1.0.jar etc. When POM references xxy-company artifact, would it should automatically get all dependent jars. Is it possible? how?
NOTE
we have third party JARs by themselves, we do not have source code projects associated with these jars. We get these jars from vendors, providers or other companies. When we receive these jars it comes along with dependent jars etc.
Currently, we load all these jars into libs-release-local. And our project POM have to reference main jar and each of the dependent jar into it.
Question: Is it possible to specify only main jar from repository, and maven will seek all dependent jars from Artifactory automatically without explicit specifying into POM???
i am looking into command mvn install:install-file how to specify dependent jars for install file?
Upvotes: 2
Views: 4353
Reputation: 67524
I'm surprised more people aren't interested in this question. I have to deal with this myself right now. Here's how I achieved it:
Use the deploy-file mojo to manually deploy all the jars to the repository.
I had 21 jars I needed to do this to so I dropped them into a folder and wrote a little program to generate the commands I'd need to run. Then I pasted this in a console.
Create my own pom with a packaging of pom
. Depend on all these files I just deployed. Deploy this pom.
In my project, depend on this pom. It will transitively include all the other jars.
Upvotes: 1
Reputation: 78
You can use the assembly-plugin:
How do I put all required JAR files in a library folder inside the final JAR file with Maven?
And another way it can be, defining the path in resources:
<resources>
> <resource>
> <directory>${WORKSPACE_PATH}/</directory>
> <includes>
> <include>*.jar</include>
> </includes>
> <targetPath>lib</targetPath>
> </resource>
></resources>
Upvotes: 2
Reputation: 22923
Just configure Artifactory as a sole artifacts provider for your build. Once that done, run your build. All the dependencies will be downloaded through Artifactory and cached there.
Upvotes: 0