commons-lang3-3.1-bin.zip
was downloaded from commons.apache.org and extracted to folder with java jdk/lib
. I need to import Stopwatch from this library. How to do it for IntelliJ IDEA?
Update: Why can't intelliJ just add pom.xml to existing project without trying to delete it?
Solved this way:
Downloaded a lib from http://commons.apache.org/ intelliJ > Project Structure > Dependencies> + > Library > path to lib from commons.apache.org
PS. Still looking for a way to solve this using Maven...
Not solved with Maven:
Cannot Run project. Have to probably I have to configure it somehow...
1
2
How to fix it?
If you can use Maven or Gradle, then you can include the library as a dependency:
$ tree
.
|-- pom.xml
`-- src
|-- main
| `-- java
| `-- test
| `-- App.java
`-- test
`-- java
`-- test
`-- AppTest.java
7 directories, 3 files
pom.xml
<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>myGroup</groupId>
<artifactId>myArtifact</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>deleteme</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
</project>
IntelliJ automatically adds the dependencies to the classpath.
If you open the pom.xml file as a new project in IntelliJ, the dependency will automatically be added to the classpath.
Edit
Otherwise, if you edit your project settings in IntelliJ, go to the modules section, and then the dependencies tab. You can add your dependencies there. See here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With