1

I have followed some instructions saying to first right click on a dependency, and fill in the dependency dialogue with any names/version number. This adds the dependency to pom.xml. So far so good.

But then the instructions said that "Dependencies" should now be expandable and that there would be something to right click there in order to open another dialogue to select the existing .jar file. The problem here is that adding dependency in pom.xml file doesn't change anything to the Dependencies folders which remains empty.

I feel like these instructions were probably for an old version. How do you do it with version 11?

Please note that my programming skills are much towards C#, JavaScript, PHP. I haven't really touched Java for 10 years.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
TTT
  • 1,848
  • 2
  • 30
  • 60

1 Answers1

0

I'd suggest that you add your dependency in your local Maven repository. Thus it will work in any IDE or even on the command line. You can add a dependency this way:

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

mvn install:install-file -Dfile=deps.jar -DgroupId=com.group.id -DartifactId=deps -Dversion=1.1 -Dpackaging=jar

More information: Guide to installing 3rd party JARs

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jonatan Cloutier
  • 899
  • 9
  • 26
  • Thank you, well I do not actually have such a thing as a local repository, I simply created a "Java with Maven" project, because I had to choose between that and "Java with Gradle" and "Java with Ant" and current Netbeans didn't give me any other choice. My first thought was just to create a "vanilla" project and add it a reference, but that's apparently not an option anymore. (Also I've edited the original question to mention that Java is far from being my usual developement environement...) – TTT Sep 05 '19 at 21:33
  • You still have a local repositories and this should work. But maybe someone will have a solution less related to maven – Jonatan Cloutier Sep 05 '19 at 21:37
  • 1
    Thank you. I finally solved it, I realised that there was an online repository and an example to add it in pom.xml for it for the .jar that I needed, then I had to right click on "Dependencies" and then on "Download declared dependencies". Not the pricse answer to my but solved my problem for now. – TTT Sep 05 '19 at 23:27