Where do I put an external dependency in Maven?
Owen Thomas <[email protected]> Wed, 17 Sep 2025 20:09:47 +1000
| Newsgroups | gmane.comp.java.ide.netbeans.user |
|---|---|
| Message-ID | <CACtgfN=L+Qf4=JzMZwb5jr_XtSLCMDAUF5QNArorTQV19FOnWA@mail.gmail.com> |
Hello.
Although I have used a build tool for some time, I am only now trying to
use it to manage dependencies to external libraries used by my project. The
first such library I am trying to use is BSON.
I am using a multi-module project, and, possibly because I am ignorant, I
have chosen to insert the dependency in the top level POM of the overall
project, not any of the sub-projects. So, I have inserted the following
dependency (appears in boldface) in the following location of my top level
POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cliquespace</groupId>
<artifactId>Cliquespace</artifactId>
<version>0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>Concept</module>
<module>PeerDevice</module>
<module>PeerInitiator</module>
<module>PeerRespondent</module>
<module>SwingGUI</module>
<module>Glion</module>
<module>Renderer</module>
<module>Neuron</module>
<module>RelayNeuron</module>
<module>PulseNeuron</module>
</modules>
*<dependencies> <dependency>
<groupId>org.mongodb</groupId> <artifactId>bson</artifactId>
<version>3.8.1</version> </dependency> </dependencies>*
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
The reason I did this was because I wanted the library to be available
across all of the sub-projects.
However, when I type "import org." into the editor of a source file in the
PeerDevice sub-project, I am expecting the editor to suggest "mongodb", yet
this suggestion does not come up.
What am I doing wrong?
Thanks,
Owen.
PS: I did try the PeerDevice sub-project and found the same result. Also, I
don't know if this is important or not, but I have a file module-info.java
in the package root directory for each of my sub-projects.