I have a project where I intend to use XMPP for IM. I have called into NetBeans, the smack dependency and it shows in the pom.xml file as:
<dependency>
<groupId>org.igniterealtime.smack</groupId>
<artifactId>smack-java8</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>org.igniterealtime.smack</groupId>
<artifactId>smack-tcp</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>org.igniterealtime.smack</groupId>
<artifactId>smack-im</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>org.igniterealtime.smack</groupId>
<artifactId>smack-extensions</artifactId>
<version>4.4.0</version>
</dependency>
However, when I try to add smack to the moduleinfo or my code tries to import org.igniterealtime.smack there is an error...module not found. The clean and build with dependencies does download it and it is in my .m2/org.igniterealtime/smack folder.
I am really not sure what is blinding Netbeans from seeing what is in the local repo.
I have also tried to use the jivesoftware version with the same result. Not sure that is a valid test but that is what I have tried.
Anyone have a clue what is happening?
You need to provide the correct module name for the smack dependency.
when I try to add smack to the moduleinfo or my code tries to import org.igniterealtime.smack there is an error...module not found
This (probably) means that you have specified the wrong module name for smack in your module-info. You did not provide the module-info in the question, so I don't know what the incorrect value you set there is.
The smack dependency does not have a module-info. You can see this if you download the jar file and extract the contents. It also does not have an Automatic-Module-Name
setting in the manifest. Therefore the automatic module name will be derived from the jar file. The name is derived according to these (complex) rules in the static ModuleFinder of(Path... entries)
documentation, the gist of which is simply summarized in:
So the likely module name for the smack dependency is:
smack.java8
You can add that as a module to your project using this line in your module-info.java
:
requires smack.java8;
You may need to do the same for your other smack dependencies (and perhaps other 3rd party libraries that your project is using), for example:
requires smack.java8;
requires smack.tcp;
requires smack.im;
requires smack.extensions;
You also need to ensure that the required dependency is on the Java module path (not the classpath). Maven is aware of modular projects and will place the dependencies on the module path (even the automatic ones), if you use a recent Maven release. When you import the Maven project into netbeans, I don't know if netbeans will configure the netbeans project to place required dependencies on the module path (I know Idea does that automatically for modular projects).
To learn more about automatic modules see:
I did not try to actually get smack to work in a modular project when composing this answer.
Not all non-modular software will work in a module environment, so there is a possibility that even if you set up the system as described above, you may still get failures. In which case it is likely best to make your project non-modular by removing the module-info.java from your project and specifying JavaFX module dependencies via VM arguments as documented for non-modular projects in the openjfx.io Getting Started documentation.