I decided to start work on a little financial calculator for personal use and figured that it would be useful to implement an external library for handling money. I decided on JavaMoney and am still figuring out how Maven and dependencies work.
I have the following code in the POM file:
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>FinancialCalculator</groupId>
<artifactId>FinancialCalculator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>javax.money</groupId>
<artifactId>money-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.javamoney</groupId>
<artifactId>moneta</artifactId>
<version>1.4.1</version>
<type>pom</type>
</dependency>
</dependencies>
</project>
When I try and import javax.money.*;
, it tells me that it cannot be resolved. I imagine I have some great misconception about how this works, so any help would be appreciated. I apologize for my ignorance.
EDIT:
I was told that I need to clean and build the project for Maven to download the appropriate JAR files. I'm using Eclipse, so I went into Project > Clean... and selected the Maven project, and I have auto-build on so it should just rebuild immediately after; but just in case, I also cleaned and manually built the project. I still can't import the javax.money
package, even after cleaning and building a few times. Any help is much appreciated.