I am trying to integrate maven with a old style java project to manage dependencies.
To simply download the jars, I could use
mvn dependency:get -DrepoUrl=https://mvnrepository.com -Dartifact=artifactId:groupId:version
But due to some product challenges, I need to add these jars to classPath myself. So if there is some kind of tool/solution to help get these details automatically. Like what all jars got download as part of a specific pom.xml
Example: I could run the above command inside java code with
Runtime.exec()
And parse the output myself, but I was wondering if there is a better way instead of me parsing all that.
Also, please suggest me any better way to deal with such a situation.
PS: I cannot convert the project to Maven project using any tools etc(since I would change the structure of project) rather I have get the similar behavior myself
I found that I could use maven-embedder.jar but I couldn't find much help. I want to use only for downloading the dependency i.e my command to do that would be like below:
mvn test dependency:build-classpath -f "C:\Users\Desktop\My_Pom.xml" -DoutputDirectory="C:\ProgramData\MyDirectoeyRepository"
How could I do this?
I ended up using Maven-Embedder's MavenCli class.