Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import Eclipse user libraries into IntelliJ Idea

I have lib.userlibraries file with the following content:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<eclipse-userlibraries version="2">
  <library name="MyLib" systemlibrary="false">
    <archive path=PATH_TO_LOCAL_JAR_1/>
    <archive path=PATH_TO_LOCAL_JAR_2/>
    ...
    <archive path=PATH_TO_LOCAL_JAR_100/>
  </library>
</eclipse-userlibraries>

I want to import these local jar files to the project in IntelliJ Idea. I can do it manually via File -> Project Structure... -> Libraries, but it will require to import each jar file separately. Is there automatic way to import this userlibraries file to IntelliJ Idea project?

like image 887
user3705896 Avatar asked Nov 02 '25 15:11

user3705896


2 Answers

The other answer about using the IntelliJ import feature for eclipse projects should be your first "stop".

Beyond that: importing doesn't necessarily work for all projects. We have a large, complicated eclipse project. Trying to import that in IntelliJ simply didn't work (the module definition that IntelliJ created was completely wrong, and lead to thousands and thousands of build errors).

In that specific case, it might be faster to use a powerful text editor, like:

  • open the eclipse .classpath file
  • create a new IntelliJ project, and import maybe one of the required libraries manually
  • open the corresponding module xyz.iml file
  • simply compare/copy ( get the JAR file names from eclipse, and use editor magic to create the raw strings you need for the .iml file )

Of course, that seems silly, but as said: using a text editor, I got a large setup with 15 modules/projects to build fine in less than an hour.

And the real answer: base your project setup on a tool like maven or gradle. Because these tools allow you to generate eclipse or IntelliJ configuration files. If possible, always do that. Even when it means to learn a new tool, and a lengthy transition period.

like image 182
GhostCat Avatar answered Nov 04 '25 11:11

GhostCat


In IntelliJ IDEA open the Eclipse project by importing from Eclipse wizard. It will give you an opportunity to select user libraries.

like image 36
Andrey Avatar answered Nov 04 '25 12:11

Andrey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!