0

I have a situation like below: 1. I have a JAR which is available in cloud URL 2. I want to download the JAR and use it as a JAR in my project. 3. For downloading I am using Maven ant run plugin and putting it in specific folder of the project.

Now I want to add the jar to classpath file via pom.xml

I have downloaded the JAR from the cloud and placed it in specific folder.

Is there anyway in which as soon as I download the JAR from cloud, I can modify my classpath by adding a classpathEntry through POM.xml?

  • Possible duplicate of [How to add local jar files to a Maven project?](https://stackoverflow.com/questions/4955635/how-to-add-local-jar-files-to-a-maven-project) – J Fabian Meier Nov 11 '19 at 07:41

1 Answers1

0

There are various ways but the easiest option is to download the file to your local repository with the file path matching to your dependency's groupId, artifactId and version.

Assuming below is the dependency that you are trying to add to you pom.xml

<dependency>
    <groupId>your.company</groupId>
    <artifactId>downloaded-file</artifactId>
    <version>1.0.0</version>
</dependency>

then download the file to /your/company/downloaded-file/downloaded-file-1.0.0.jar

Ramu
  • 641
  • 6
  • 9
  • You would still be missing a POM. – J Fabian Meier Nov 11 '19 at 07:40
  • True but if the jar is not using Maven, then generating a default pom doesn't add much value except Maven throws a warning message saying it is unable to find the pom file. To install the file we either have to manually execute the command or use ant to programmatically execute the command. So I don't see a good reason to install the file using maven command if Maven only throws a warning message. – Ramu Nov 11 '19 at 13:04