Search code examples
javaintellij-ideajava-money

IntelliJ: How to import a folder of .java files as a library?


It's probably a stupid question, but I can't figure out how to properly import a folder of .java files as a library into my IntelliJ project.

I am trying to use the JavaMoney API, which I downloaded from here.

I know that the normal way would be File > Project Structure > Modules > Dependencies > + JARs or Directories, yet that always adds an "Empty Library" to the list, which is nowhere to be seen in the Project View.

Could someone set me on the right track here?


Solution

  • You should not use the sources directly. You should start to use maven (or gradle). In that case you can simply add a dependency:

    <dependency>
        <groupId>javax.money</groupId>
        <artifactId>money-api</artifactId>
        <version>1.0.1</version>
    </dependency>
    

    If you don't want to use maven, you should import the existing maven project from the repository and export it as a *.jar file.

    Or you simply download the prebuilt version from a mvn-repository.