Configuring dependencies via properties file

Answered

Hi.

The point is adding dependencies in project. For example I can add jar via gui - project settings - modules - dependencies. I point a path to classes files on my file system. Another user on his local machine want to do the same. He must again add dependencies via gui. Can I have user.properties file which will be store paths to jars/classes directories on my file system and IDEA could use this file to add dependencies on project without gui confuguring?

5 comments
Comment actions Permalink

You should consider using Maven or Gradle instead of inventing a wheel. IDEA supports both.

Another option is to store all the dependencies inside the project so that they will be referenced with the relative paths from the project configuration files and will work on all the systems.

If neither is possible, use Path Variables, IDEA will ask for the value of the path variable on a new system when another user opens a project.

0
Comment actions Permalink

If neither is possible, use Path Variables, IDEA will ask for the value of the path variable on a new system when another user opens a project.

I can add value for my path variable(path to the jars dir). How then this value/variable I can use to set dependencies on project? How path from path variable I can use to set classpath to the project?

 

 

0
Comment actions Permalink

It works automatically. IDEA will replace paths with variables when the project is saved and vice versa when project is loaded, see https://www.jetbrains.com/idea/help/path-variables.html.

0
Comment actions Permalink

Okay.  I've created path variable - path_to_jars and set absolute path value to it. Then I go to project structure - modules - dependencies - plus jars or dirictories - and then typing name of path variable - $path_to_jars or just path_to_jars...In both case I got the same error - "specified path cannot be found"

 

 

0
Comment actions Permalink

As I said, it works transparently and automatically on project save/load. You don't use the path variable explicitly in any paths.

0

Please sign in to leave a comment.